TnT/CodeNet4Repair huggingface dataset:
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
L = [0,0,0,0]
S = N*[0]
for i in range(N):
    S[i] = input()
    if S[i]=="AC":
        L[0]+=1
    elif S[i]=="WA":
        L[1]+=1
    elif S[i]=="TLE":
        L[2]+=1
    else:
        L[3]+=1
print(f"AC×{L[0]}")
print(f"WA×{L[1]}")
print(f"TLE×{L[2]}")
print(f"RE×{L[3]}")

Fixed, accepted submission:
N = int(input())
L = [0,0,0,0]
S = N*[0]
for i in range(N):
    S[i] = input()
    if S[i]=="AC":
        L[0]+=1
    elif S[i]=="WA":
        L[1]+=1
    elif S[i]=="TLE":
        L[2]+=1
    else:
        L[3]+=1
print(f"AC x {L[0]}")
print(f"WA x {L[1]}")
print(f"TLE x {L[2]}")
print(f"RE x {L[3]}")
Problem:
You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.

Incorrect submission (verdict: Wrong Answer):
S = str(input().split())
print(S[::2])

Fixed, accepted submission:
S = str(input())
print(S[::2])
Problem:
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?  Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:    * r_1 + c_1 = r_2 + c_2   * r_1 - c_1 = r_2 - c_2  For example, in the following figure, the bishop can move to any of the red squares in one move:  

Incorrect submission (verdict: Wrong Answer):

H, W = map(int,input().split())

if H % 2 == 0 :
    print(H * W / 2 )
else :
    print(int(int(H / 2) * W + int(W / 2) + 1))

Fixed, accepted submission:
H, W = map(int,input().split())
if H>1 and W>1 :
    print(int(H/2)*W  + (int(W/2)+W%2)*(H%2))
else :
    print(1)
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

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

i = N // 1000
ans = N - i * 1000
print(ans)

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

i = N // 1000
if N % 1000 != 0:
    i += 1
ans = i * 1000 - N
print(ans)
Problem:
Takahashi wants to gain muscle, and decides to work out at AtCoder Gym.  The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i. When Button i is not lighten up, nothing will happen by pressing it.  Initially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.  Determine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
A = [int(input())-1 for _ in range(n)]

push = set([])
ans = 0
b = 0

while 1:
  if b in push:
    print(-1)
    exit()
  push.add(b)
  b = A[b]
  ans += 1

  if b== 2:
    print(ans)
    break
  

Fixed, accepted submission:
n = int(input())
A = [int(input())-1 for _ in range(n)]

push = set([])
ans = 0
b = 0

while 1:
  if b in push:
    print(-1)
    exit()
  push.add(b)
  b = A[b]
  ans += 1

  if b== 1:
    print(ans)
    break
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
A, B, X = map(int, input().split())

if X > A + B or X < A:
    print('No')
else:
    print('Yes')

Fixed, accepted submission:
A, B, X = map(int, input().split())

if X > A + B or X < A:
    print('NO')
else:
    print('YES')
Problem:
Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.

Incorrect submission (verdict: Time Limit Exceeded):
a,b,c=map(int,input().split())
count=0
while a<=b:
    if c%a==0:
        count+=1

print(count)


Fixed, accepted submission:
a,b,c=map(int,input().split())
count=0
while a<=b:
    if c%a==0:
        count+=1
    a+=1
print(count)
Problem:
Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i.  The N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.  When each player, except the first one to arrive, arrives at the place, the player gets **comfort** equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.  What is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
comforts = list(map(int,input().split()))
newcomforts = sorted(comforts, reverse=True)
print(newcomforts[1] * (n-1))

Fixed, accepted submission:
n = int(input())
comforts = list(map(int,input().split()))
newcomforts = sorted(comforts, reverse=True)
x = 0
if n%2 == 0:
  for i in range(1, int(n/2)):
    x += newcomforts[i]
  print(x * 2 + newcomforts[0])
else:
  for i in range(1, int((n-1)/2)):
    x += newcomforts[i]
  print(x*2 + newcomforts[0] + newcomforts[int((n+1)/2-1)])
Problem:
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Incorrect submission (verdict: Wrong Answer):
n,a,b=map(int,input().split())
def num(x):
  ans=0
  while x>0:
    ans+=x%10
    x=x//10
  return ans
count=0
for i in range(1,n+1):
  if a<=num(i)<=b:
    count+=1
print(count)

Fixed, accepted submission:
n,a,b=map(int,input().split())
def num(x):
  ans=0
  while x>0:
    ans+=x%10
    x=x//10
  return ans
count=0
for i in range(1,n+1):
  if a<=num(i)<=b:
    count+=i
print(count)
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
print(n%1000)


Fixed, accepted submission:
n=int(input())
if n%1000==0:
    ans=0
else:
    ans=1000-n%1000
print(ans)
Problem:
For a given weighted graph $G = (V, E)$, find the shortest path from a source to each vertex. For each vertex $u$, print the total weight of edges on the shortest path from vertex $0$ to $u$.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
from collections import defaultdict
G = defaultdict(list)
for i in range(n):
    i = [int(i) for i in input().split()]
    k = i[1]
    G[i[0]] = list(zip(i[2::2],i[3::2]))

def mind(Q, d):
    c = float('inf')
    ret = 0
    for i, j in enumerate(d):
        if c > j and i in Q:
            c = j
            ret = i
    return ret

def dijkstra(G):
    d = [0] + [float('inf')] * (n - 1)
    Q = set(range(n))
    while len(Q) != 0:
        u = mind(Q, d)
        print(u)
        Q = Q - set([u])
        for v, c in G[u]:
            if d[v] > d[u] + c:
                d[v] = d[u] + c
    return d

for i,j in enumerate(dijkstra(G)):
    print(i, j)

Fixed, accepted submission:
n = int(input())
from collections import defaultdict
G = defaultdict(list)
for i in range(n):
    i = [int(i) for i in input().split()]
    k = i[1]
    G[i[0]] = list(zip(i[2::2],i[3::2]))

def mind(Q, d):
    c = float('inf')
    ret = 0
    for i, j in enumerate(d):
        if c > j and i in Q:
            c = j
            ret = i
    return ret

def dijkstra(G):
    d = [0] + [float('inf')] * (n - 1)
    Q = set(range(n))
    while len(Q) != 0:
        u = mind(Q, d)
        Q = Q - set([u])
        for v, c in G[u]:
            if d[v] > d[u] + c:
                d[v] = d[u] + c
    return d

for i,j in enumerate(dijkstra(G)):
    print(i, j)
Problem:
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.

Incorrect submission (verdict: Wrong Answer):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())








a = input().split()                          




b = ''.join([a[0],a[1]])
print(b)
c = int(b)
j(pow(int(np.sqrt(c)),2) == c)

Fixed, accepted submission:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())








a = input().split()                          




b = ''.join([a[0],a[1]])
c = int(b)
j(pow(int(np.sqrt(c)),2) == c)
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):
list = list(map(int, input().split()))
if list.count(5)==2 and list.count(7)==1:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
list = list(map(int, input().split()))
if list.count(5)==2 and list.count(7)==1:
    print('YES')
else:
    print('NO')
Problem:
You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`.

Incorrect submission (verdict: Wrong Answer):
import re
n,s,k=open(0)
print(re.sub("[^"+s[int(k)-1]+"]","*",s))

Fixed, accepted submission:
import re
n,s,k=open(0)
print(re.sub("[^" + s[int(k)-1] + "]", "*", s[:-1]))
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

Incorrect submission (verdict: Wrong Answer):

a = int(input())

sum = a * (a+1) / 2
print(sum)


Fixed, accepted submission:

a = int(input())

sum = a * (a+1) / 2
print(int(sum))
Problem:
AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.  The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code.  How many different PIN codes can he set this way?  Both the lucky number and the PIN code may begin with a 0.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
S = list(map(int,list(input())))
S_riv=S[::-1]
l_lis=[0]*N
r_lis=[0]*N
mat=([0 for j in range(10)])
l_set=set([])
r_set=set([])
for i,s in enumerate(S):
  l_lis[i]=l_set.copy()
  l_set.add(s)
  
for i,s in enumerate(S_riv):
  r_lis[i]=r_set.copy()
  r_set.add(s)
  
r_lis.reverse()
ans=0
for i,s in enumerate(S):
  length=len(l_lis[i])
  ans+=(length-mat[s])*len(r_lis[i])
  mat[s]=length
  


Fixed, accepted submission:
N = int(input())
S = list(map(int,list(input())))
S_riv=S[::-1]
l_lis=[0]*N
r_lis=[0]*N
mat=([0 for j in range(10)])
l_set=set([])
r_set=set([])
for i,(r,l) in enumerate(zip(S_riv,S)):
  l_lis[i]=l_set.copy()
  r_lis[i]=r_set.copy()
  l_set.add(l)
  r_set.add(r)
  
r_lis.reverse()
ans=0
for i,s in enumerate(S):
  length=len(l_lis[i])
  ans+=(length-mat[s])*len(r_lis[i])
  mat[s]=length
  
print(ans)
Problem:
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Incorrect submission (verdict: Wrong Answer):
N,A,B=map(int,input().split())
counter=0
for i in range(N):
  n=str(i+1)
  s=len(n)
  n_total=0
  for t in range(s):
    n_total+=int(n[t])
  if A<= n_total <=B:
    counter+=1
print(counter)

Fixed, accepted submission:
N,A,B=map(int,input().split())
counter=0
for i in range(N):
  n=str(i+1)
  s=len(n)
  n_total=0
  for t in range(s):
    n_total+=int(n[t])
  if A<= n_total <=B:
    counter+=int(i+1)
print(counter)
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==5 and b==5):
	print("Yes")
elif(b==5 and c==5):
	print("Yes")
elif(a==5 and c==5):
	print("Yes")
else:
	print("No")

Fixed, accepted submission:
a,b,c = map(int, input().split())
if(a==5 and b==5):
	print("YES")
elif(b==5 and c==5):
	print("YES")
elif(a==5 and c==5):
	print("YES")
else:
	print("NO")
Problem:
You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:    * The graph is simple and connected.   * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.  It can be proved that at least one such graph exists under the constraints of this problem.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
print(n*(n-1)//2-n//2)
for i in range(1,n):
  for j in range(i+1,n+1):
    if i == j or i+j == n+1:
      continue
    print(i,j)

Fixed, accepted submission:
n = int(input())
print(n*(n-1)//2-n//2)
if n%2:
  m = n
else:
  m = n+1
for i in range(1,n):
  for j in range(i+1,n+1):
    if i+j == m:
      continue
    print(i,j)
Problem:
You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}.  Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise.

Incorrect submission (verdict: Wrong Answer):
a = input()
b = input()
print("Yes" if a[::-1] == b else "No")

Fixed, accepted submission:
a = input()
b = input()
print("YES" if a[::-1] == b else "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 = input()
print(s.rfind("Z")-s.find("A"))


Fixed, accepted submission:
S = input()
print(1+S.rfind("Z")-S.find("A"))
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Incorrect submission (verdict: Wrong Answer):
def main(n, a):
    box = [0 for _ in range(n)]
    for i in range(n, 0, -1):
        if i > n // 2:
            factors = []
        else:
            factors = [x for x in range(i + 1, n + 1) if x % i == 0]
        if a[i - 1] == 0:
            if sum([a[i - 1]] + factors) % 2 == 1:
                box[i - 1] = 1
        else:
            if sum([a[i - 1]] + factors) % 2 == 0:
                box[i - 1] = 1
    print(sum(box))
    print(' '.join(map(str, box)))


n = int(input())
a = list(map(int, input().split()))
main(n, a)

Fixed, accepted submission:
def main(n, a):
    box = [0] * n
    for i in range(n, 0, -1):
        if a[i - 1] != sum(box[i - 1 :: i]) % 2:
            box[i - 1] = 1

    box_indices = [i + 1 for i in range(n) if box[i] == 1]
    print(sum(box))
    print(*box_indices)


n = int(input())
a = list(map(int, input().split()))
main(n, a)
Problem:
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:    * A consists of integers between X and Y (inclusive).   * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.  Find the maximum possible length of the sequence.

Incorrect submission (verdict: Wrong Answer):
X, Y = map(int, input().split())
ans = 0
while X <= Y:
    Y /= 2
    print(Y)
    ans += 1
print(ans)

Fixed, accepted submission:
X, Y = map(int, input().split())
ans = 0
while X <= Y:
    X *= 2
    ans += 1
print(ans)
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
ans=0
for i in range(n):
    ans+=i
print(ans)

Fixed, accepted submission:
n = int(input())
ans=0
for i in range(1,n+1):
    ans+=i
print(ans)
Problem:
Snuke has N hats. The i-th hat has an integer a_i written on it.  There are N camels standing in a circle. Snuke will put one of his hats on each of these camels.  If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No`.    * The bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.  What is XOR? The bitwise XOR x_1 \oplus x_2 \oplus \ldots \oplus x_n of n non- negative integers x_1, x_2, \ldots, x_n is defined as follows: - When x_1 \oplus x_2 \oplus \ldots \oplus x_n is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3 \oplus 5 = 6.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
c = list(map(int, input().split()))
c_set = set(c)
ans = 'no'

if n % 2 == 1 and len(c_set) == 3:
    if c[0] ^ c[1] == c[2]:
        ans = 'yes'


print(ans)


Fixed, accepted submission:
n = int(input())
c = list(map(int, input().split()))
c.sort()
c_set = set(c)
set_list = list(c_set)
ans = 'No'


if c.count(0) == n:
    ans = 'Yes'
elif c[0] == 0:
    if n % 3 == 0 and len(c_set) == 2 and c.count(0) == int(n / 3):
        ans = 'Yes'
elif n == 3:
    if c[0] ^ c[1] == c[2]:
        ans = 'Yes'
else:
    if n % 3 == 0 and len(c_set) == 3:
        ank = int(n / 3)
        if c.count(c[0]) == ank and c.count(c[ank]) == ank and set_list[0] ^ set_list[1] == set_list[2]:
            ans = 'Yes'

print(ans)
Problem:
You are given an integer N.  Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.  If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
for a in range(1,3501):
  for b in range(1,3501):
    s = n*a*b
    t = 4*a*b-n*b-n*a
    if t!=0 and s%t==0:
      c = s/t
      print(a,b,s)
      exit()

Fixed, accepted submission:
n = int(input())
if n<=3000:
  for a in range(1,3501):
    for b in range(1,3501):
      s = n*a*b
      #s=4
      t = 4*a*b-n*b-n*a
      #t=8-4-2
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()
else:
  for a in range(3501,1,-1):
    for b in range(3501,1,-1):
      s = n*a*b
      #s=4
      t = 4*a*b-n*b-n*a
      #t=8-4-2
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()
Problem:
Takahashi loves numbers divisible by 2.  You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.  Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.  For example,    * 6 can be divided by 2 once: 6 -> 3.   * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.   * 3 can be divided by 2 zero times.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(N-1)

Fixed, accepted submission:
N = int(input())
count = 0
while True:
    c = 2**count
    if c > N:
        print(c//2)
        break
    else:
        count +=1
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else:
            S = S[5]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')


Fixed, accepted submission:
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')
Problem:
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.  Given an integer N, determine whether it is a Harshad number.

Incorrect submission (verdict: Wrong Answer):

def sum_digit(num):
    sums = 0
    while num != 0:
        sums += num % 10
        num //= 10
    return sums

n = int(input())
if sum_digit(n)%n == 0:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
def sum_digit(num):
    sums = 0
    while num != 0:
        sums += num % 10
        num //= 10
    return sums

n = int(input())
if n % sum_digit(n) == 0:
    print('Yes')
else:
    print('No')