// "bool", "NoneType", "true", "false", "type", "None", "int", "string", "print"

a = 2.71828;
b = 3.1415926;
print(a, type(a), string(a) + "<<", int(a) + 10000);
print(a + b, a * b, a + b <= a * b, a + float(20), float(100) / float(1000));

class DisjointSet {
    fn __init__(self, n) {
        self.data = [];
        idx = 0;
        while idx < n {
            self.data.append(-1);
            idx = idx + 1;
        }
        return self;
    }
    fn __string__(self) {
        return "DisjointSet(" + string(self.data) + ")";
    }
    fn find(self, idx) {
        if self.data[idx] < 0 {
            return idx;
        }
        self.data[idx] = self.find(self.data[idx]);
        return self.data[idx];
    }
    fn union(self, a, b) {
        fa = self.find(a);
        fb = self.find(b);
        if fa == fb {
            return None;
        }
        if self.data[fa] < self.data[fb] {
            self.data[fa] = self.data[fa] + self.data[fb];
            self.data[fb] = fa;
        }
        else {
            self.data[fb] = self.data[fb] + self.data[fa];
            self.data[fa] = fb;
        }
    }
}

s = DisjointSet(10);
s.union(1, 2);
s.union(1, 5);
print(s);


s = "Hello World!";
s1 = s[0, 5];
print(s, s1, s[s.len() - 1]);

arr = [1, 2, 3, 4, 5];
arr1 = arr[1, arr.len()];
print(arr, arr1);
arr1[0] = 100;
print(arr, arr1);
arr[1] = 1000;
print(arr, arr1);

a = 100;
b = a;
print(a, b);
a = 300;
print(a, b);

a = "12";
b = "34";
a = int(a + "00" + b);
print(a, a * 2);

arr = [1, 2, 3, 4, 5];
arr[3] = "IEEE";


arr.append("SJTU");
print(arr);
print(arr.pop(), arr.pop(), arr);

class A {
    fn __init__(self, a) {
        self.a = a;
        return self;
    }
    fn iadd(self, d) {
        self.a = self.a + d;
    }
    fn __string__(self) {
        return self.__name__ + "[[" + string(self.a) + "]]";
    }
    fn __call__(self, t) {
        return self.a * t;
    }
}

a = A(100);
print(a.iadd(11));
print(a, string(a), string(a).len());
print(a(3));

hello_world = "Hello World!";
hello_world.author = "HellOwhatAs";

fn init() {
    fn ret() {
        print(hello_world, "by", hello_world.author, "\n");
    }
    return ret;
}
init()();

fn fib(x) {
    if x <= 1 { return x; }
    return fib(x - 1) + fib(x - 2);
}

print(fib(20));

cnt = 10;
while cnt > 0 {
    print(cnt, "WhileDB");
    cnt = cnt - 1;
}

print(true.__and__(true), bool.__or__(false, 1 == 2), true.__type__(""));

print(print(type(NoneType)));

print(int);
print(string);
print(string(bool));
print("OK");
print(string(string));
if true {
    a = 1234;
    b = 123;
    result = 1234 - b * 10;
    tmp = (result <= 4) && true;
    print(tmp);
    print(int(!tmp) != int(tmp) == true);
    print(result);
}

if 1001011 {
    print("ALWAYS");
}