Download benchmarks/Algorithms/modular_inverse/solution.c from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 258 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/modular_inverse/solution.c
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Algorithms/modular_inverse/solution.c
-
curl -L -o solution.c https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/modular_inverse/solution.c
258 Bytes
| int exgcd(int a, int b, int *x, int *y) | |
| ; | |
| int modular_inverse(int a, int modulus) | |
| { | |
| int x; | |
| int y; | |
| int g = exgcd(a, modulus, &x, &y); | |
| int inverse = x % modulus; | |
| if (inverse < 0) { | |
| inverse += modulus; | |
| } | |
| return inverse; | |
| } | |