10

Python Template For emulating online judge

 1 year ago
source link: https://codeforces.com/blog/entry/109178?f0a28=1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Hi, This is a python template I am using currently. Similar templates are already available in C++ and I wanted one in python. In case anyone wants to use it, here it is :)

import sys
from os import path
def input():
    return sys.stdin.readline().strip()

    
def solve(n,array):
    # YOUR CODE HERE
    pass

def main():
    # testcases = 1 
    
    testcases = int(input()) # multiple testcases
    for _ in range(testcases):
        n = int(input())
        array = list(map(int,input().split()))
        solve(n,array)
        

if __name__ == "__main__":
    if(path.exists('input.txt')):
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    main()
        

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK