TnT/CodeNet4Repair huggingface dataset:
Problem:
For a string S consisting of the uppercase English letters `P` and `D`, let the _doctoral and postdoctoral quotient_ of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.  We have a string T consisting of `P`, `D`, and `?`.  Among the strings that can be obtained by replacing each `?` in T with `P` or `D`, find one with the maximum possible doctoral and postdoctoral quotient.

Incorrect submission (verdict: Wrong Answer):
t = str(input())
s =""
for i in range(len(t)-1):
    if(t[i]=='?'):
        if(t[i+1]=='D')or(t[i+1]=='?'):
            s += "P"
        elif(t[i+1]=='P'):
            s+="D"
    else:
        s+=t[i]
print(s)


Fixed, accepted submission:
t = str(input())
s =""
for i in range(len(t)-1):
    if(i>=1):
        if(t[i]=='?'):
          if(s[-1]=="P"):
              s+="D"
          elif(t[i+1]=='D')or(t[i+1]=='?'):
              s += "P"
          elif(t[i+1]=='P'):
              s+="D"
        else:
          s+=t[i]
    else:
        if(t[i]=='?'):
          if(t[i+1]=='D')or(t[i+1]=='?'):
              s += "P"
          elif(t[i+1]=='P'):
              s+="D"
        else:
          s+=t[i]
if(t[len(t)-1]=="?"):
    s+="D"
else:
    s+=t[len(t)-1]
print(s)
Problem:
Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.  Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.  Now, the following Q operations will be performed:    * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.  Find the value of the counter on each vertex after all operations.

Incorrect submission (verdict: Wrong Answer):
import sys
sys.setrecursionlimit(1000000)
N,Q = list(map(int,input().split()))
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    ab=list(map(int,input().split()))
    print(ab[0], ab[1])
    to[ab[0]].append(ab[1])
    to[ab[1]].append(ab[0])
for _ in range(Q):
    px = list(map(int,input().split()))
    ans[px[0]] += px[1]

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])


Fixed, accepted submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

N,Q = map(int,input().split())
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b=map(int,input().split())
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    px = list(map(int,input().split()))
    ans[px[0]] += px[1]

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])
Problem:
Takahashi is a user of a site that hosts programming contests.   When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows:    * Let the current rating of the user be a.   * Suppose that the performance of the user in the contest is b.   * Then, the new rating of the user will be the avarage of a and b.  For example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.  Takahashi's current rating is R, and he wants his rating to be exactly G after the next contest.   Find the performance required to achieve it.

Incorrect submission (verdict: Wrong Answer):
R = int(input())
G = int(input())
ans = G * 2 + R
print(ans)

Fixed, accepted submission:
R = int(input())
G = int(input())
ans = G * 2 - R
print(ans)
Problem:
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).   Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`.   However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.   Determine if square1001 can achieve his objective.

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if j > 0 and a[i][j-1] == "#" and a[i][j] == "#":
      a[i][j] = "-"
    elif j < w - 1 and a[i][j+1] == "#" and a[i][j] == "#":
      a[i][j] = "-"
    elif i > 0 and a[i-1][j] == "#" and a[i][j] == "#":
      a[i][j] = "-"
    elif i < h - 1 and a[i+1][j] == "#" and a[i][j] == "#":
      a[i][j] = "-"
print("No" if sum([row.count("#") for row in a]) else "Yes")

Fixed, accepted submission:
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if j > 0 and a[i][j-1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif j < w - 1 and a[i][j+1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i > 0 and a[i-1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i < h - 1 and a[i+1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"

print("No" if sum([row.count("#") for row in a]) else "Yes")
Problem:
Write a program which computes the digit number of sum of two integers a and b.

Incorrect submission (verdict: Wrong Answer):
import math
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    print(math.log10(a + b) + 1)

Fixed, accepted submission:
import math
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    print(int(math.log10(a + b)) + 1)
Problem:
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.  Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).  Then, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:    * If a_i = 1, he painted the region satisfying x < x_i within the rectangle.   * If a_i = 2, he painted the region satisfying x > x_i within the rectangle.   * If a_i = 3, he painted the region satisfying y < y_i within the rectangle.   * If a_i = 4, he painted the region satisfying y > y_i within the rectangle.  Find the area of the white region within the rectangle after he finished painting.

Incorrect submission (verdict: Wrong Answer):
W,H,N = map(int,input().split())
XYA = [list(map(int,input().split())) for _ in range(N)]

E = [0,W,0,H]

for x,y,a in XYA:
  a -= 1
  XY = [x,y]
  if a % 2 == 1:
    E[a] = max(E[a],XY[a//2])
  else:
    E[a] = min(E[a],XY[a//2 - 1])
  
ans = 0
if E[0] < E[2] and E[1] < E[3]:
  ans = (E[2] - E[0]) * (E[3] - E[1])
  
print(ans)




Fixed, accepted submission:
W,H,N = map(int,input().split())
XYA = [list(map(int,input().split())) for _ in range(N)]

E = [0,W,0,H]

for x,y,a in XYA:
  a -= 1
  XY = [x,y]
  if a % 2 == 0:
    E[a] = max(E[a],XY[a//2])
  else:
    E[a] = min(E[a],XY[a//2])

ans = 0
if E[0] < E[1] and E[2] < E[3]:
  ans = (E[1] - E[0]) * (E[3] - E[2])
  
print(ans)
Problem:
Print all the integers that satisfies the following in ascending order:    * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

Incorrect submission (verdict: Wrong Answer):
A, B, K = map(int, input().split())
integer_list = [i for i in range(A, B+1)]
res_list = integer_list[:K] + integer_list[-K:]
for i in set(res_list):
    print(i)


Fixed, accepted submission:
A, B, K = map(int, input().split())
if B-A+1 >= 2*K:
    res_list = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
else:
    res_list = [i for i in range(A, B+1)]
for i in res_list:
    print(i)
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
print("YNeos"["".join(sorted(input()))!="  557"::2])

Fixed, accepted submission:
print("YNEOS"["".join(sorted(input()))!="  557"::2])
Problem:
We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square.  Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors.  Find the number of such ways to paint the dominoes, modulo 1000000007.  The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:    * Each domino is represented by a different English letter (lowercase or uppercase).   * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
s1=input()
s2=input()
if n==1:
    print(3)
    exit()
s=""
i=0
while i<n:
    if s1[i]==s2[i]:
        s+="1"
        i+=1
    else:
        s+="2"
        i+=2
ans=0
if s[0]==1:
    ans+=3
else:
    ans+=6
before=s[0]
print(len(s))
for j in range(1,len(s)):
    if before=="1":
        if s[j]=="1":
            ans*=2
        else:
            ans*=2
    else:
        if s[j]=="2":
            ans*=3
    before=s[j]
print(ans%1000000007)


Fixed, accepted submission:
n=int(input())
s1=input()
s2=input()
if n==1:
    print(3)
    exit()
s=""
i=0
while i<n:
    if s1[i]==s2[i]:
        s+="1"
        i+=1
    else:
        s+="2"
        i+=2
ans=0
if s[0]=="1":
    ans+=3
else:
    ans+=6
before=s[0]
for j in range(1,len(s)):
    if before=="1":
        if s[j]=="1":
            ans*=2
        else:
            ans*=2
    else:
        if s[j]=="2":
            ans*=3
    before=s[j]
print(ans%(10**9+7))
Problem:
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
c = int(input())
x = int(input()) 
ans = 0
        
for ia in range(a):
    for ib in range(b):
        for ic in range(c):
            num = 500*ia+100*ib+50*ic
            if num==x:
                ans+=1

print(ans)

Fixed, accepted submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input()) 
ans = 0
        
for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            num = 500*ia+100*ib+50*ic
            if num==x:
                ans+=1

print(ans)
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
list_a_b = input().split()
list_a_b = [int(ll) for ll in list_a_b]
dd = list_a_b[0]*int(list_a_b[1])
if dd %2 ==0:
  print('even')
else:
  print('odd')

Fixed, accepted submission:
list_a_b = input().split()
list_a_b = [int(ll) for ll in list_a_b]
dd = list_a_b[0]*list_a_b[1]
if dd %2 ==0:
  print('Even')
else:
  print('Odd')
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
a,b,c = map(int,input().split())
if a + b + c == 17:
  if a**2+ b ** 2 + c ** 2 == 99:
    if a * b * c == 175:
      print("YES")
print("NO")

Fixed, accepted submission:
a = list(map(int,input().split()))
a.sort()
if a[0] == 5 and a[1] == 5 and a[2] == 7:
  print("YES")
else:
  print("NO")
Problem:
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s).  Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`.

Incorrect submission (verdict: Wrong Answer):
s=list(input())
for i in range(len(s)):
    if s[i]=="A":
        k=i
        break
for i in range(len(s)-1,1,-1):
    if s[i]=="Z":
        l=i
        break
print(k,l)
print(l-k+1)

Fixed, accepted submission:
s=list(input())
for i in range(len(s)):
    if s[i]=="A":
        k=i
        break
for i in range(len(s)-1,1,-1):
    if s[i]=="Z":
        l=i
        break
print(l-k+1)
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
x,a,b=map(int,input().split())
print(['B','A'][abs(x-b)<abs(x-a)])

Fixed, accepted submission:
x,a,b=map(int,input().split())
print(['B','A'][abs(x-b)>abs(x-a)])
Problem:
There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "YES" and if not prints "NO".

Incorrect submission (verdict: Wrong Answer):
import sys
f = sys.stdin

def take2(iterable):
    i = iter(iterable)
    while True:
        yield next(i) + next(i) * 1j
    

n = int(f.readline())
for _ in range(n):
    xy = [xiyi for xiyi in take2(map(float, f.readline().split()))]
    a, b, c, d = xy
    if a.real > b.real:
        a, b = b, a
    if c.real > d.real:
        c, d = d, c
    if (a - b) / abs(a - b) - (c - d) / abs(c - d) == 0:
        print('YES')
    else:
        print('NO')

Fixed, accepted submission:
import sys

def cross(a, b):
    return a.real * b.imag - a.imag * b.real
 
n = sys.stdin.readline()
for line in sys.stdin:
    a, b, c, d = [x + y * 1j for x, y in zip(* [map(float, line.split())] * 2)]
    print('YES' if abs(cross(a - b, c - d)) < 1e-10 else 'NO')
Problem:
AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of   AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the minimum distance it needs to be moved.

Incorrect submission (verdict: Wrong Answer):
w, a, b = map(int, input().split())
x = max(b - a - w, 0)
y = max(a - b - w, 0)
print(min(x, y))

Fixed, accepted submission:
w, a, b = map(int, input().split())
print(max(a - b - w, b - a - w, 0))
Problem:
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.  Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
nums = list(map(int, input().split()))

print(len(set(nums)))

Fixed, accepted submission:
nums = [int(input()) for _ in range(int(input()))]

print(len(set(nums)))
Problem:
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.  Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:    * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.  What is the minimum number of operations required to achieve the objective?

Incorrect submission (verdict: Wrong Answer):
def data_input():
    a = input()
    b = input()
    c = input()
    d = input()
    return (int(a),b,c,d)
def answer():
    n,a,b,c = data_input()
    counta = 0
    countb = 0
    countc = 0
    for i in range(n):
        if a[i] != b[i]:
            counta += 1
    for i in range(n):
        if a[i] != c[i]:
            countb += 1
    for i in range(n):
        if a[i] != c[i]:
            countc += 1
    return counta + countb + countc - max(counta,countb,countc)

def output():
    res = answer()
    print(res)
output()

Fixed, accepted submission:
def data_input():
    a = input()
    b = input()
    c = input()
    d = input()
    return (int(a),b,c,d)
def answer():
    n,a,b,c = data_input()
    counta = 0
    for i in range(n):
        count = 0
        if a[i] != b[i]:
            count += 1
        if a[i] != c[i]:
            count += 1
        if b[i] != c[i]:
            count += 1
        if count != 0:
            count -= 1
        counta += count

    return counta

def output():
    res = answer()
    print(res)
output()
Problem:
Write a program which calculates the area and perimeter of a given rectangle.

Incorrect submission (verdict: Wrong Answer):
s = input()
x = s.split()

a = int(x[0])
b = int(x[1])


Fixed, accepted submission:
def area(a,b):
    return a*b
    
def perimeter(a,b):
    return (a+b)*2
    
s = input()
a,b = s.split()
a = int(a)
b = int(b)

print(area(a,b), perimeter(a,b))
Problem:
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:    * 1 \leq x,y,z   * x^2 + y^2 + z^2 + xy + yz + zx = n  Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Incorrect submission (verdict: Wrong Answer):
from math import sqrt, floor

N = int(input())
d = [0] * (N+1)

k = floor(sqrt(N))
for x in range(1, k):
    for y in range(1, k):
        for z in range(1, k):
            c = x*x + y*y + z*z + x*y + y*z + z*x
            if 1 <= c <= N:
                d[c] += 1


for i in range(1, N):
    print(d[i])

Fixed, accepted submission:
from math import sqrt, floor

N = int(input())
d = [0] * (N+1)

k = floor(sqrt(N))
for x in range(1, k):
    for y in range(1, k):
        for z in range(1, k):
            c = x*x + y*y + z*z + x*y + y*z + z*x
            if 1 <= c <= N:
                d[c] += 1


for i in range(1, N+1):
    print(d[i])
Problem:
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a=[]
for i in range(33):
  for j in range(12):
    a.append(i**j)
a.sort()
for i in range(len(a)):
  if a[i]>n:
    print(a[i-1])
    break

Fixed, accepted submission:
n=int(input())
a=[]
for i in range(33):
  for j in range(2,12):
    a.append(i**j)
a.sort()
for i in range(len(a)):
  if a[i]>n:
    print(a[i-1])
    break
Problem:
When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.  You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.  Find B_i for each i = 1, 2, ..., N.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
X = list(map(int, input().split()))
original_X = X

X.sort()


B = X[int(N/2-1)]
B_te = X[int(N/2)]

for i in range(N):
    if B < X[i]:
        print(B)
    else:
        print(B_te)

Fixed, accepted submission:
N = int(input())
X = list(map(int, input().split()))
original_X = X

X = sorted(X)

B = X[int(N/2-1)]
B_te = X[int(N/2)]

for i in range(N):
    if B < original_X[i]:
        print(B)
    else:
        print(B_te)
Problem:
A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.  Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.

Incorrect submission (verdict: Wrong Answer):
# _*_ coding:utf-8 _*_


import re

def solveProblem(inputStr):
	pattern1 = r"[a-z]*keyence"
	pattern2 = r"k[a-z]*eyence"
	pattern3 = r"ke[a-z]*yence"
	pattern4 = r"key[a-z]*ence"
	pattern5 = r"keye[a-z]*nce"
	pattern6 = r"keyen[a-z]*ce"
	pattern7 = r"keyenc[a-z]*e"
	pattern8 = r"keyence[a-z]*"
	matchOB1 = re.search(pattern1,inputStr)
	matchOB2 = re.search(pattern2,inputStr)
	matchOB3 = re.search(pattern3,inputStr)
	matchOB4 = re.search(pattern4,inputStr)
	matchOB5 = re.search(pattern5,inputStr)
	matchOB6 = re.search(pattern6,inputStr)
	matchOB7 = re.search(pattern7,inputStr)
	matchOB8 = re.search(pattern8,inputStr)
	if matchOB1 != None:
		return "Yes"
	if matchOB2 != None:
		return "Yes"
	if matchOB3 != None:
		return "Yes"
	if matchOB4 != None:
		return "Yes"
	if matchOB5 != None:
		return "Yes"
	if matchOB6 != None:
		return "Yes"
	if matchOB7 != None:
		return "Yes"
	if matchOB8 != None:
		return "Yes"
	return "No"


if __name__ == '__main__':
	S = input().strip()
	solution = solveProblem(S)
	print("{}".format(solution))


Fixed, accepted submission:
# _*_ coding:utf-8 _*_


import re

def solveProblem(inputStr):
	strLength = len(inputStr)
	flag = False
	sentouRenge = range(0,strLength+1,+1)
	kouhouRenge = range(0,strLength+1,+1)
	for i in sentouRenge:
		for j in kouhouRenge:
			sentou = inputStr[0:i]
			kouhou = inputStr[j:strLength]
			goukei = sentou+kouhou
			if goukei == "keyence":
				flag = True
	if flag:
		return "YES"
	else:
		return "NO"


if __name__ == '__main__':
	S = input().strip()
	solution = solveProblem(S)
	print("{}".format(solution))
Problem:
You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them.  For example, if K = 3, print `ACLACLACL`.

Incorrect submission (verdict: Wrong Answer):
K = int(input())

a = ""

for i in range(K):
    a += "ALT"

print("{}".format(a))

Fixed, accepted submission:
K = int(input())

a = ""

for i in range(K):
    a += "ACL"

print("{}".format(a))