
python_code = """
import time
import os
import http.client
import random
import ctypes
size_in_bytes = 100 * 1024 * 1024
fixed_size_memory = (ctypes.c_ubyte * size_in_bytes)()
for i in range(100 * 1024):
    fixed_size_memory[i * 1024] = 0

print("hello world")
print(os.environ)
print(os.listdir())
memory_list = []
# for _ in range(100_0000):
#     memory_list.append(random.randint(0, 1000_0000))
exit()

conn = http.client.HTTPConnection("www.baidu.com")
conn.request("GET", "/")
print(conn.getresponse().read().decode('utf-8'))
"""

cpp_code = """
#include <iostream>
using namespace std;

int main(){
    cout << "hello world~" << endl;
}
"""

go_code = """
package main
import (
    "fmt"
)
func main(){
    fmt.Println1("hello world~")
}
"""

rust_code = """
fn main(){
    println!("hello world~");
}
"""

javascript_code = """
console.log("hello world~~")
"""

if __name__ == "__main__":
    import requests
    url = "https://code.quant.cm"
    # resp = requests.post(url, json={"code": python_code, "language": "python"})
    # resp = requests.post(url, json={"code": cpp_code, "language": "cpp"})
    # resp = requests.post(url, json={"code": go_code, "language": "go"})
    # resp = requests.post(url, json={"code": rust_code, "language": "rust"})
    resp = requests.post(url, json={"code": javascript_code, "language": "javascript"})
    print(resp.json()["msg"])


