Wrongly Penalized in START176

On March 10, 2025, I received a mail from CodeChef saying:

CodeChef - You have been caught for plagiarism in START176

It mentioned that:

We identified that your submissions in Starters 176 (Rated till 4 stars) used AI-generated code or involved converting an Accepted (AC) solution to another programming language, which violates CodeChef’s policies. Your rating will be dropped by 275 points as a penalty, and we might also permanently ban some of the cheaters.

They did not tell me about which submissions my code matched with. It said to reply within 2 days if I thought I was being wrongly penalized and I did the same within half an hour.

I have read the Code of Conduct of CodeChef prior to the contest as well, and I have never violated it. I have never used any AI tool during a contest, never shared my code with anyone else nor asked anyone for their codes. I mentioned the same and wrote two mails till date, but got no replies in either, which made me write this post. I am ready to do whatever it takes to prove the same. My submissions for those contest problems have been removed so I cannot share the links to them, but since CodeChef stores the last written code to a problem, I can share the code to the problems.

Clothing Store

Problem Link: Clothing Store

Code
using System;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int T = int.Parse(Console.ReadLine());
		StringBuilder v = new StringBuilder();
		for(; T > 0; T--)
		{
		    string[] ip = Console.ReadLine().Split(' ');
		    int X = int.Parse(ip[0]), Y = int.Parse(ip[1]), Z = int.Parse(ip[2]), A = int.Parse(ip[3]), B = int.Parse(ip[4]), C = int.Parse(ip[5]);
		    int takeX = Math.Min(X, A);
		    X -= takeX;
		    A -= takeX;
		    int takeY = Math.Min(Y, B);
		    Y -= takeY;
		    B -= takeY;
		    int takeZ = Math.Min(Z, C);
		    Z -= takeZ;
		    C -= takeZ;
		    int takeYX = Math.Min(Y, A);
		    A -= takeYX;
		    int takeZX = Math.Min(Z, A);
		    A -= takeZX;
		    Z -= takeZX;
		    int takeZY = Math.Min(Z, B);
		    B -= takeZY;
		    v.Append(takeX + takeY + takeZ + takeYX + takeZX + takeZY);
		    v.Append("\n");
		}
		Console.Write(v);
	}
	
	private static bool IsPrime(int x)
	{
	    for(int i = 2; i*i <= x; i++)
	    {
	        if(x % i == 0)
	            return false;
	    }
	    return true;
	}
	
	private static bool IsVowel(char ch)
	{
	    ch = char.ToLower(ch);
	    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
	}
	
	private static bool IsPalindrome(string S)
	{
	    int beg = 0, end = S.Length - 1;
	    while(beg <= end)
	    {
	        if(S[beg++] != S[end--])
	            return false;
	    }
	    return true;
	}
	
	private static long gcd(long a, long b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int gcd(int a, int b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int factorial(int x)
	{
	    int f = 1;
	    for(int i = 2; i <= x; i++)
	        f *= i;
	    return f;
	}
	
	private static int nCr(int n, int r)
	{
	    int f = 1;
	    int j = 2;
	    for(int i = n; i > n-r; i--)
	    {
	        f *= i;
	        if(j <= r && f % j == 0)
	            f /= j++;
	    }
	    for(; j <= r; j++)
	        f /= j;
	    return f;
	}
	
	private static int nPr(int n, int r)
	{
	    int f = 1;
	    for(int i = n; i > n-r; i--, f *= i);
	    return f;
	}
	
	private static int CountOdd(int[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += ar[i]&1;
	    return odd;
	}
	
	private static int CountOdd(string[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += int.Parse(ar[i])&1;
	    return odd;
	}
	
	private static long Sum(string[] ar, int N)
	{
	    long s = 0;
	    for(int i = 0; i < N; i++)
	        s += long.Parse(ar[i]);
	    return s;
	}
	
	private static int[] ToIntArray(string[] ar, int N)
	{
	    int[] ans = new int[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = int.Parse(ar[i]);
	    return ans;
	}
	
	private static long[] ToLongArray(string[] ar, int N)
	{
	    long[] ans = new long[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = long.Parse(ar[i]);
	    return ans;
	}
	
	private static long pow(long b, long pow, int mod)
	{
	    long ans = 1;
	    while(pow != 0)
	    {
	        if((pow & 1) == 1)
	            ans = (ans % mod) * (b % mod) % mod;
	        b = (b % mod) * (b % mod) % mod;
	        pow >>= 1;
	    }
	    return ans;
	}
}

class PriorityQueue<T>
{
    Comparison<T> comparator;
    List<T> heap;
    int n;
    
    public PriorityQueue(Comparison<T> a)
    {
        comparator = a;
        heap = new List<T>();
        n = 0;
    }
    
    public void Add(T element)
    {
        if(n == heap.Count)
        {
            heap.Add(element);
        }
        else
        {
            heap[n] = element;
        }
        n++;
        BuildHeap();
    }
    
    public bool IsEmpty()
    {
        return n == 0;
    }
    
    public T Peek()
    {
        return heap[0];
    }
    
    public T Poll()
    {
        T temp = heap[0];
        heap[0] = heap[n-1];
        n--;
        BuildHeap();
        return temp;
    }
    
    private void BuildHeap()
    {
        for(int i = n/2 - 1; i >= 0; i--)
            Heapify(i);
    }
    
    private void Heapify(int i)
    {
        int left = 2 * i + 1, right = 2 * i + 2;
        int min = i;
        if(left < n && comparator(heap[min], heap[left]) > 0)
            min = left;
        if(right < n && comparator(heap[min], heap[right]) > 0)
            min = right;
        if(min == i)
            return;
            
        T temp = heap[min];
        heap[min] = heap[i];
        heap[i] = temp;
        Heapify(min);
    }
}
Costly Summit

Problem Link: Costly Summit

Code
using System;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Collections.Generic;

public class Test
{
    static int[,] dp;
	public static void Main()
	{
		// your code goes here
		int T = int.Parse(Console.ReadLine());
		StringBuilder v = new StringBuilder();
		for(; T > 0; T--)
		{
		    string[] ip = Console.ReadLine().Split(' ');
		    int N = int.Parse(ip[0]), C = int.Parse(ip[1]);
		    string S = Console.ReadLine();
		    int[] f = new int[5];
		    for(int i = 0; i < N; i++)
		        f[S[i] - 65]++;
		    Array.Sort(f);
		    dp = new int[5, 11];
		    for(int i = 0; i < 5; i++)
		    {
		        for(int j = 0; j < 11; j++)
		            dp[i, j] = -1;
		    }
		    v.Append(func(0, 1, C, f));
		    v.Append("\n");
		}
		Console.Write(v);
	}
	
	private static int func(int ind, int tr, int C, int[] f)
	{
	    if(ind == f.Length)
	        return 0;
	    if(dp[ind, tr] != -1)
	        return dp[ind, tr];
	    if(f[ind] == 0)
	        return func(ind + 1, tr, C, f);
	    int learn = C + func(ind + 1, tr, C, f), skip = tr * f[ind] + ((f[ind] - 1) * f[ind] / 2) + func(ind + 1, tr + f[ind], C, f);
	    return dp[ind, tr] = Math.Min(learn, skip);
	}
	
	private static bool IsPrime(int x)
	{
	    for(int i = 2; i*i <= x; i++)
	    {
	        if(x % i == 0)
	            return false;
	    }
	    return true;
	}
	
	private static bool IsVowel(char ch)
	{
	    ch = char.ToLower(ch);
	    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
	}
	
	private static bool IsPalindrome(string S)
	{
	    int beg = 0, end = S.Length - 1;
	    while(beg <= end)
	    {
	        if(S[beg++] != S[end--])
	            return false;
	    }
	    return true;
	}
	
	private static long gcd(long a, long b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int gcd(int a, int b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int factorial(int x)
	{
	    int f = 1;
	    for(int i = 2; i <= x; i++)
	        f *= i;
	    return f;
	}
	
	private static int nCr(int n, int r)
	{
	    int f = 1;
	    int j = 2;
	    for(int i = n; i > n-r; i--)
	    {
	        f *= i;
	        if(j <= r && f % j == 0)
	            f /= j++;
	    }
	    for(; j <= r; j++)
	        f /= j;
	    return f;
	}
	
	private static int nPr(int n, int r)
	{
	    int f = 1;
	    for(int i = n; i > n-r; i--, f *= i);
	    return f;
	}
	
	private static int CountOdd(int[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += ar[i]&1;
	    return odd;
	}
	
	private static int CountOdd(string[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += int.Parse(ar[i])&1;
	    return odd;
	}
	
	private static long Sum(string[] ar, int N)
	{
	    long s = 0;
	    for(int i = 0; i < N; i++)
	        s += long.Parse(ar[i]);
	    return s;
	}
	
	private static int[] ToIntArray(string[] ar, int N)
	{
	    int[] ans = new int[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = int.Parse(ar[i]);
	    return ans;
	}
	
	private static long[] ToLongArray(string[] ar, int N)
	{
	    long[] ans = new long[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = long.Parse(ar[i]);
	    return ans;
	}
	
	private static long pow(long b, long pow, int mod)
	{
	    long ans = 1;
	    while(pow != 0)
	    {
	        if((pow & 1) == 1)
	            ans = (ans % mod) * (b % mod) % mod;
	        b = (b % mod) * (b % mod) % mod;
	        pow >>= 1;
	    }
	    return ans;
	}
}

class PriorityQueue<T>
{
    Comparison<T> comparator;
    List<T> heap;
    int n;
    
    public PriorityQueue(Comparison<T> a)
    {
        comparator = a;
        heap = new List<T>();
        n = 0;
    }
    
    public void Add(T element)
    {
        if(n == heap.Count)
        {
            heap.Add(element);
        }
        else
        {
            heap[n] = element;
        }
        n++;
        BuildHeap();
    }
    
    public bool IsEmpty()
    {
        return n == 0;
    }
    
    public T Peek()
    {
        return heap[0];
    }
    
    public T Poll()
    {
        T temp = heap[0];
        heap[0] = heap[n-1];
        n--;
        BuildHeap();
        return temp;
    }
    
    private void BuildHeap()
    {
        for(int i = n/2 - 1; i >= 0; i--)
            Heapify(i);
    }
    
    private void Heapify(int i)
    {
        int left = 2 * i + 1, right = 2 * i + 2;
        int min = i;
        if(left < n && comparator(heap[min], heap[left]) > 0)
            min = left;
        if(right < n && comparator(heap[min], heap[right]) > 0)
            min = right;
        if(min == i)
            return;
            
        T temp = heap[min];
        heap[min] = heap[i];
        heap[i] = temp;
        Heapify(min);
    }
}
Same And

Problem Link: Same And

Code
using System;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int T = int.Parse(Console.ReadLine());
		StringBuilder v = new StringBuilder();
		for(; T > 0; T--)
		{
		    string[] ip = Console.ReadLine().Split(' ');
		    long N = long.Parse(ip[0]), M = long.Parse(ip[1]);
		    StringBuilder ans = new StringBuilder();
		    int count = 1;
		    ans.Append(N);
		    ans.Append(" ");
		    for(int i = 0; i < 63; i++)
		    {
		        if((N & (1L << i)) > 0)
		            continue;
		        if((N | (1L << i)) > M)
		            break;
		        count++;
		        ans.Append(N | (1L << i));
		        ans.Append(" ");
		    }
		    if(count <= 1)
		        v.Append(-1);
		    else
		    {
		        v.Append(count);
		        v.Append("\n");
		        v.Append(ans);
		    }
		    v.Append("\n");
		}
		Console.Write(v);
	}
	
	private static bool IsPrime(int x)
	{
	    for(int i = 2; i*i <= x; i++)
	    {
	        if(x % i == 0)
	            return false;
	    }
	    return true;
	}
	
	private static bool IsVowel(char ch)
	{
	    ch = char.ToLower(ch);
	    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
	}
	
	private static bool IsPalindrome(string S)
	{
	    int beg = 0, end = S.Length - 1;
	    while(beg <= end)
	    {
	        if(S[beg++] != S[end--])
	            return false;
	    }
	    return true;
	}
	
	private static long gcd(long a, long b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int gcd(int a, int b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int factorial(int x)
	{
	    int f = 1;
	    for(int i = 2; i <= x; i++)
	        f *= i;
	    return f;
	}
	
	private static int nCr(int n, int r)
	{
	    int f = 1;
	    int j = 2;
	    for(int i = n; i > n-r; i--)
	    {
	        f *= i;
	        if(j <= r && f % j == 0)
	            f /= j++;
	    }
	    for(; j <= r; j++)
	        f /= j;
	    return f;
	}
	
	private static int nPr(int n, int r)
	{
	    int f = 1;
	    for(int i = n; i > n-r; i--, f *= i);
	    return f;
	}
	
	private static int CountOdd(int[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += ar[i]&1;
	    return odd;
	}
	
	private static int CountOdd(string[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += int.Parse(ar[i])&1;
	    return odd;
	}
	
	private static long Sum(string[] ar, int N)
	{
	    long s = 0;
	    for(int i = 0; i < N; i++)
	        s += long.Parse(ar[i]);
	    return s;
	}
	
	private static int[] ToIntArray(string[] ar, int N)
	{
	    int[] ans = new int[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = int.Parse(ar[i]);
	    return ans;
	}
	
	private static long[] ToLongArray(string[] ar, int N)
	{
	    long[] ans = new long[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = long.Parse(ar[i]);
	    return ans;
	}
	
	private static long pow(long b, long pow, int mod)
	{
	    long ans = 1;
	    while(pow != 0)
	    {
	        if((pow & 1) == 1)
	            ans = (ans % mod) * (b % mod) % mod;
	        b = (b % mod) * (b % mod) % mod;
	        pow >>= 1;
	    }
	    return ans;
	}
}

class PriorityQueue<T>
{
    Comparison<T> comparator;
    List<T> heap;
    int n;
    
    public PriorityQueue(Comparison<T> a)
    {
        comparator = a;
        heap = new List<T>();
        n = 0;
    }
    
    public void Add(T element)
    {
        if(n == heap.Count)
        {
            heap.Add(element);
        }
        else
        {
            heap[n] = element;
        }
        n++;
        BuildHeap();
    }
    
    public bool IsEmpty()
    {
        return n == 0;
    }
    
    public T Peek()
    {
        return heap[0];
    }
    
    public T Poll()
    {
        T temp = heap[0];
        heap[0] = heap[n-1];
        n--;
        BuildHeap();
        return temp;
    }
    
    private void BuildHeap()
    {
        for(int i = n/2 - 1; i >= 0; i--)
            Heapify(i);
    }
    
    private void Heapify(int i)
    {
        int left = 2 * i + 1, right = 2 * i + 2;
        int min = i;
        if(left < n && comparator(heap[min], heap[left]) > 0)
            min = left;
        if(right < n && comparator(heap[min], heap[right]) > 0)
            min = right;
        if(min == i)
            return;
            
        T temp = heap[min];
        heap[min] = heap[i];
        heap[i] = temp;
        Heapify(min);
    }
}
Friendly Binary Strings

Problem Link: Friendly Binary Strings

Code
using System;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int T = int.Parse(Console.ReadLine());
		StringBuilder v = new StringBuilder();
		for(; T > 0; T--)
		{
		    int N = int.Parse(Console.ReadLine());
		    string A = Console.ReadLine(), B = Console.ReadLine();
		    int[] f = new int[3];
		    for(int i = 0; i < N; i++)
		    {
		        if(A[i] == B[i])
		            f[A[i] - 48]++;
		        else
		            f[2]++;
		    }
		    bool good = true;
		    for(int beg = 0, end = N-1; beg < end; beg++, end--)
		    {
		        if(f[0] > 1)
		            f[0] -= 2;
		        else if(f[1] > 1)
		            f[1] -= 2;
		        else if(f[2] > 1)
		            f[2] -= 2;
		        else
		            good = false;
		    }
		    v.Append(good ? "YES" : "NO");
		    v.Append("\n");
		}
		Console.Write(v);
	}
	
	private static bool IsPrime(int x)
	{
	    for(int i = 2; i*i <= x; i++)
	    {
	        if(x % i == 0)
	            return false;
	    }
	    return true;
	}
	
	private static bool IsVowel(char ch)
	{
	    ch = char.ToLower(ch);
	    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
	}
	
	private static bool IsPalindrome(string S)
	{
	    int beg = 0, end = S.Length - 1;
	    while(beg <= end)
	    {
	        if(S[beg++] != S[end--])
	            return false;
	    }
	    return true;
	}
	
	private static long gcd(long a, long b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int gcd(int a, int b)
	{
	    if(b == 0)
	        return a;
	    return gcd(b, a % b);
	}
	
	private static int factorial(int x)
	{
	    int f = 1;
	    for(int i = 2; i <= x; i++)
	        f *= i;
	    return f;
	}
	
	private static int nCr(int n, int r)
	{
	    int f = 1;
	    int j = 2;
	    for(int i = n; i > n-r; i--)
	    {
	        f *= i;
	        if(j <= r && f % j == 0)
	            f /= j++;
	    }
	    for(; j <= r; j++)
	        f /= j;
	    return f;
	}
	
	private static int nPr(int n, int r)
	{
	    int f = 1;
	    for(int i = n; i > n-r; i--, f *= i);
	    return f;
	}
	
	private static int CountOdd(int[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += ar[i]&1;
	    return odd;
	}
	
	private static int CountOdd(string[] ar, int N)
	{
	    int odd = 0;
	    for(int i = 0; i < N; i++)
	        odd += int.Parse(ar[i])&1;
	    return odd;
	}
	
	private static long Sum(string[] ar, int N)
	{
	    long s = 0;
	    for(int i = 0; i < N; i++)
	        s += long.Parse(ar[i]);
	    return s;
	}
	
	private static int[] ToIntArray(string[] ar, int N)
	{
	    int[] ans = new int[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = int.Parse(ar[i]);
	    return ans;
	}
	
	private static long[] ToLongArray(string[] ar, int N)
	{
	    long[] ans = new long[N];
	    for(int i = 0; i < N; i++)
	        ans[i] = long.Parse(ar[i]);
	    return ans;
	}
	
	private static long pow(long b, long pow, int mod)
	{
	    long ans = 1;
	    while(pow != 0)
	    {
	        if((pow & 1) == 1)
	            ans = (ans % mod) * (b % mod) % mod;
	        b = (b % mod) * (b % mod) % mod;
	        pow >>= 1;
	    }
	    return ans;
	}
}

class PriorityQueue<T>
{
    Comparison<T> comparator;
    List<T> heap;
    int n;
    
    public PriorityQueue(Comparison<T> a)
    {
        comparator = a;
        heap = new List<T>();
        n = 0;
    }
    
    public void Add(T element)
    {
        if(n == heap.Count)
        {
            heap.Add(element);
        }
        else
        {
            heap[n] = element;
        }
        n++;
        BuildHeap();
    }
    
    public bool IsEmpty()
    {
        return n == 0;
    }
    
    public T Peek()
    {
        return heap[0];
    }
    
    public T Poll()
    {
        T temp = heap[0];
        heap[0] = heap[n-1];
        n--;
        BuildHeap();
        return temp;
    }
    
    private void BuildHeap()
    {
        for(int i = n/2 - 1; i >= 0; i--)
            Heapify(i);
    }
    
    private void Heapify(int i)
    {
        int left = 2 * i + 1, right = 2 * i + 2;
        int min = i;
        if(left < n && comparator(heap[min], heap[left]) > 0)
            min = left;
        if(right < n && comparator(heap[min], heap[right]) > 0)
            min = right;
        if(min == i)
            return;
            
        T temp = heap[min];
        heap[min] = heap[i];
        heap[i] = temp;
        Heapify(min);
    }
}
Mex-P Tree (Easy)

Problem Link: Mex-P Tree (Easy)

Code
import java.io.*;
import java.util.*;
 
class CodeChef
{
    static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        }
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() { return Integer.parseInt(next()); } 
  
        long nextLong() { return Long.parseLong(next()); } 
  
        double nextDouble() { return Double.parseDouble(next()); } 

        int[] nextIntArray(int n)
        {
            int[] ans = new int[n];
            for(int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

        Integer[] nextIntegerArray(int n)
        {
            Integer[] ans = new Integer[n];
            for(int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

        long[] nextLongArray(int n)
        {
            long[] ans = new long[n];
            for(int i = 0; i < n; i++)
                ans[i] = nextLong();
            return ans;
        }

        String[] nextStringArray(int n)
        {
            String[] ans = new String[n];
            for(int i = 0; i < n; i++)
                ans[i] = next();
            return ans;
        }
  
        String nextLine() 
        { 
            String str = ""; 
            try { 
                if(st.hasMoreTokens()){ 
                    str = st.nextToken("\n"); 
                } 
                else{ 
                    str = br.readLine(); 
                } 
            } 
            catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
 
    static final int mod = (int)(1e9) + 7;
    static final long INF = (long)(1e18);
    static final int INF_INT = (int)(1e9);
 
    private static int gcd(int a, int b)
    {
        if(a % b == 0)
            return b;
        return gcd(b, a % b);
    }
    
    static Integer[][] dp;
    static List<List<Integer>> graph;
    static TreeSet<Integer> primes;
    static int[] ar;

    public static void main(String args[]) throws IOException
    {
        FastReader fr = new FastReader();
        // Scanner fr = new Scanner(System.in);
        // Scanner fr = new Scanner(new File("C:\\Users\\ykgup\\Downloads\\test_input.txt"));
        int _t = fr.nextInt();
        primes = new TreeSet<>();
        int MAX = 130;
        boolean[] sieve = new boolean[MAX];
        sieve[0] = sieve[1] = true;
        for(int i = 2; i*i < MAX; i++)
        {
            if(sieve[i])
                continue;
            for(int j = i*i; j < MAX; j += i)
                sieve[j] = true;
        }
        for(int i = 0; i < MAX; i++)
        {
            if(!sieve[i])
                primes.add(i);
        }
        // int _t = 1;
        // int _case = 1;
        StringBuilder _v = new StringBuilder();
        PrintWriter out = new PrintWriter(System.out);
        while(_t-- > 0)
        {
            int n = fr.nextInt();
            ar = fr.nextIntArray(n);
            graph = new ArrayList<>();
            for(int i = 0; i < n; i++)
                graph.add(new ArrayList<>());
            for(int i = 0; i < n-1; i++)
            {
                int u = fr.nextInt() - 1, v = fr.nextInt() - 1;
                graph.get(u).add(v);
                graph.get(v).add(u);
            }
            for(int root = 0; root < n; root++)
            {
                _v.append(dfs(root, -1, 0));
                _v.append(" ");
            }
            _v.append("\n");
        }
        out.print(_v);
        out.flush();
    }
    
    private static long dfs(int src, int parent, int x)
    {
        x = gcd(x, ar[src]);
        long ans = 0;
        for(int prime : primes)
        {
            if(x % prime == 0)
                continue;
            ans += prime;
            break;
        }
        for(int v : graph.get(src))
        {
            if(v == parent)
                continue;
            ans += dfs(v, src, x);
        }
        return ans;
    }
}

There are a few things I myself would like to clear out. I switched my coding language to Java for the last problem since I had to use a TreeSet and I find using the functions of Java’s TreeSet easier as compared to the SortedSet class in C#. I make use of C# since I have been making games for quite a bit of time and do not want to lose touch with the language (A game’s repository). Java is my primary language for solving problems. I am attaching links to my Leetcode and Codeforces profiles where this thing can be verified (Leetcode, Codeforces).

I would like the CodeChef team to kindly look at my submissions again and let me know what proofs are needed for me to verify the originality of my codes. CodeChef was the first platform I began coding at and it’s been a long, hard and exciting journey which I do not want to end with such a mishappening. It took a lot of effor to reach the 4* from 2* in the past 10 months and I do not want to lose that. I can regain the rating but still the flag of cheating on my profile remains which makes it impossible for me to showcase my profile on my resume, when the statistics of my CodeChef profile can help my resume to be shortlisted at certain places.

Let me know what is needed from my end for the same. I do not want my profile to be tagged a cheater’s cause that’s not who I am.

1 Like

Could any admin let me know when I can expect a reply in the mail?

Hello,
Can you please explain why you changed your language for last problem i.e., mex-tree(easy) , okay you are saying because for treeset but in your code you just travelled through primes, you can also do that in array right? But still why treeset?

Yes, I could have used an array for the same, but at the time of the contest I was mainly focused on doing the problem quickly so I overlooked the fact that the primes would already be in a sorted order. I did need them sorted cause I was looking for the first prime that would not divide the gcd.

Also I do switch to Java frequently when solving problems, at times for convenience otherwise due to some language specific reasons. Here are a couple of such submissions:

https://www.codechef.com/viewsolution/1100068233
https://www.codechef.com/viewsolution/1105217712
https://www.codechef.com/viewsolution/1088690020
https://www.codechef.com/viewsolution/1109473203
https://www.codechef.com/viewsolution/1096101676
https://www.codechef.com/viewsolution/1136493437
https://www.codechef.com/viewsolution/1087636741
https://www.codechef.com/viewsolution/1130005000
https://www.codechef.com/viewsolution/1124049552