Spaces:
Sleeping
Sleeping
| # test_phase1.py | |
| from phase1.classifier import classify | |
| human_py = """ | |
| t = int(input()) | |
| for _ in range(t): | |
| n = int(input()) | |
| a = list(map(int, input().split())) | |
| d = {} | |
| for x in a: | |
| d[x] = d.get(x, 0) + 1 | |
| ans = 0 | |
| for k in d: | |
| ans = max(ans, d[k]) | |
| print(ans) | |
| """ | |
| ai_py = """ | |
| import sys | |
| from collections import Counter | |
| from typing import List | |
| def solve(arr: List[int]) -> int: | |
| \"\"\"Find the maximum frequency of any element in the array.\"\"\" | |
| if not arr: | |
| return 0 | |
| return max(Counter(arr).values()) | |
| def main() -> None: | |
| data = sys.stdin.read().split() | |
| idx = 0 | |
| t = int(data[idx]); idx += 1 | |
| for _ in range(t): | |
| n = int(data[idx]); idx += 1 | |
| arr = list(map(int, data[idx:idx+n])); idx += n | |
| print(solve(arr)) | |
| if __name__ == "__main__": | |
| main() | |
| """ | |
| print("Testing Phase 1 directly...\n") | |
| h = classify(human_py, "python") | |
| a = classify(ai_py, "python") | |
| print(f"Human code → P1 = {h:.4f} ({'AI' if h > 0.5 else 'Human'})") | |
| print(f"AI code → P1 = {a:.4f} ({'AI' if a > 0.5 else 'Human'})") | |
| print() | |
| h_ok = h < 0.5 | |
| a_ok = a > 0.5 | |
| print(f"Human sample: {'PASS' if h_ok else 'FAIL'}") | |
| print(f"AI sample: {'PASS' if a_ok else 'FAIL'}") | |
| print(f"Overall: {'PASS' if (h_ok and a_ok) else 'FAIL'}") |