Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03308 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
print(max(a)-min(a))
Problem p03359 (python)

Fixed submission:
a,b=map(int,input().split())
if a <= b:
  print(a)
else:
  print(a-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,inout().split())
if a <= b:
  print(a)
else:
  print(a-1)
Problem p03238 (python)

Fixed submission:
#coding: utf-8

if int(input()) == 1:
    print ('Hello World')
else:
    A = int(input())
    B = int(input())
    print (A+B)

Buggy submission (verdict: Runtime Error):
if int(input()) == 1:
 print 'Hello World'
else:
 A = int(input())
 B = int(input())
 C = A + B
 print C

Buggy submission (verdict: Runtime Error):
#coding: utf-8

if int(input()) == 1:
 print 'Hello World'
else:
 A = int(input)
 B = int(input)
 C = A + B
 print C
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    ans += 1 / a[i]
print(1 / ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in n:
    ans += 1 / i
print(1 / ans)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a, b, c, d = map(int, input().split())
lc = int (c * d / gcd(c, d))
def num(x):
    return x - x // c - x // d + x // lc
print(int(num(b) - num(a - 1)))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
lc = int (c * d / math.gcd(c, d))
def num(x):
    return x - x // c - x // d + x // lc
print(int(num(b) - num(a - 1)))
Problem p02608 (python)

Fixed submission:
from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
    combinations_with_replacement,  # 重複あり組み合わせ
)

N = int(input())

ans = [0] * (10**5)

for i, j, k in product(list(range(1, 101)), repeat=3):
    tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
    ans[tmp] += 1

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

Buggy submission (verdict: Runtime Error):
from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
    combinations_with_replacement,  # 重複あり組み合わせ
)

N = int(input())

ans = [0] * (10**9)

for i, j, k in product(list(range(1, 101)), repeat=3):
    tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
    ans[tmp] += 1

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

Buggy submission (verdict: Runtime Error):
from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
    combinations_with_replacement,  # 重複あり組み合わせ
)

N = int(input())

ans = [0] * (10**9)

for i, j, k in product(range(1, 101), repeat=3):
    tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
    ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
maxi = 10**6+1
dp = [0] * maxi

for i in range(N):
    tmp = A[i]
    if dp[tmp] != 0:
        dp[tmp] = 2
        continue
    else:
        for j in range(tmp, maxi, tmp):
            dp[j] += 1

ans = 0
for i in range(N):
    tmp = A[i]
    if dp[tmp] == 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
maxi = 2*(10**5)+1
dp = [0] * maxi

for i in range(N):
    tmp = A[i]
    if dp[tmp] != 0:
        dp[tmp] = 2
        continue
    else:
        for j in range(tmp, maxi, tmp):
            dp[j] += 1

ans = 0
for i in range(N):
    tmp = A[i]
    if dp[tmp] == 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A = sorted(A, key=lambda x: x[0])
maxi = 2*(10**5)+1
dp = [0] * maxi

for i in range(N):
    tmp = A[i]
    if dp[tmp] != 0:
        dp[tmp] = 2
        continue
    else:
        for j in range(tmp, maxi, tmp):
            dp[j] += 1

ans = 0
for i in range(N):
    tmp = A[i]
    if dp[tmp] == 1:
        ans += 1

print(ans)
Problem p02647 (python)

Fixed submission:
import numpy as np
from numba import jit
N, K = map(int, input().split())
A = np.array(list(map(int, input().split())), dtype=np.int64)

# 高速化
@jit
def imo(a, n):
    imos = np.zeros(n+1, dtype=np.int64)
    for i in range(n):
        imos[max(0, i-a[i])] += 1
        imos[min(n, i+a[i])+1] -= 1

    # 累計和はnumpyの方が高速
    immo = np.zeros(n+1, dtype=np.int64)
    immo = np.cumsum(imos)

    return immo[:n]


for _ in range(min(K, 41)):
    A = imo(A, N)

print(*A)

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import jit
N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))

@jit   # 高速化
def imo(a, n):
    imos = np.zeros(n+1)
    for i in range(n):
        imos[max(0, i-a[i])] += 1
        imos[min(n, i+a[i])+1] -= 1

    # 累計和はnumpyの方が高速
    immo = np.zeros(n+1)
    immo = np.cumsum(imos)

    return immo[:n]


for _ in range(min[K, 41]):
    A = imo(A, N)

print(*A)
Problem p02684 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N, K = map(int, input().split())
A = list(map(int, input().split()))

log = []
check = [False]*N

def func(x, iter):
    x = A[x-1]

    if iter+1 == K:
        return x
    if check[x-1]:
        ix = log.index(x)
        loop = log[ix:]
        tmp = (K-iter-1)%len(loop)
        return loop[tmp]
    else:
        log.append(x)
        check[x-1] = True
        iter += 1
        return func(x, iter)

print(func(1, 0))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

N, K = map(int, input().split())
A = list(map(int, input().split()))

log = []

def func(x, iter):
    x = A[x-1]

    if iter+1 == K:
        return x
    if x in log:
        tmp = K%(iter+1)
        return log[tmp]
    else:
        log.append(x)
        iter += 1
        return func(x, iter)

print(func(1, 0))
Problem p02732 (python)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
re = [0] * (n+1)

c = Counter(a)   # c: Counter({1: 3, 2: 2})など
for k, v in c.items():
    re[k] = v*(v-1) // 2

total = sum(re)
for i in a:
    print(total - re[i] + (c[i]-1)*(c[i]-2) // 2)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
re = [0] * (n-1)

c = Counter(a)   # c: Counter({1: 3, 2: 2})など
for k, v in c.items():
    re[k] = v*(v-1) // 2

total = sum(re)
for i in a:
    print(total - re[i] + (c[i]-1)*(c[i]-2) // 2)

Buggy submission (verdict: Runtime Error):
import math

dic = {}

def combinations_count(n, r):
    if n in dic:
        return dic[n]
    else:
        if r>n:
            re = 0
        if n==0 or n==1:
            re = 0
        if n==r:
            re = 1
        re = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
        dic[n] = re
        return re


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

num_list = [0] * n
com_list1 = [0] * n
com_list2 = [0] * n

for i in range(n):
    num_list[a[i]] += 1

for i in range(n):
    num = num_list[i]
    if num>=2:
        com_list1[i] = combinations_count(num, 2)

for i in range(n):
    num = num_list[i]-1
    if num>=2:
        com_list2[i] = combinations_count(num, 2)


total = sum(com_list1)

for i in range(n):
    num = a[i]
    print(total - com_list1[num] + com_list2[num])

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    if r>n:
        return 0
    if n==0 or n==1:
        return 0
    if n==r:
        return 1
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

num_list = [0] * n
com_list1 = [0] * n
com_list2 = [0] * n

for i in range(n):
    num_list[a[i]] += 1

for i in range(n):
    num = num_list[i]
    if num>=2:
        com_list1[i] = combinations_count(num, 2)

for i in range(n):
    num = num_list[i]-1
    if num>=2:
        com_list2[i] = combinations_count(num, 2)


total = sum(com_list1)

for i in range(n):
    num = a[i]
    print(total - com_list1[num] + com_list2[num])
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

p_mean = [(i+1)/2 for i in p]

p_ruikei = [0] * n
p_ruikei[0] =  p_mean[0]

for i in range(1, n):
    p_ruikei[i] = p_ruikei[i-1] + p_mean[i]

maxx = p_ruikei[k-1]
for i in range(1, n-k+1):
    mean = p_ruikei[i+k-1] - p_ruikei[i-1]

    if mean > maxx:
        maxx = mean

print(maxx)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p_mean = [(i+1)/2 for i in p]

p_ruikei = [0] * n
p_ruikei[0] =  p_mean[0]

for i in range(1, n):
    p_ruikei[i] = p_ruikei[i-1] + p_mean[i]

maxx = 0
for i in range(i-k+1):

    if i==0:
        mean = p_ruikei[i+k-1]
    else:
        mean = p_ruikei[i+k-1] - p_ruikei[i-1]

    if mean > maxx:
        maxx = mean

print(maxx)
Problem p03231 (python)

Fixed submission:
from math import gcd

N, M = map(int, input().split())
S = input()
T = input()

def lcm(m, n):
    return (m * n) // gcd(m, n)

lc = lcm(N, M)

ss = lc//N
tt = lc//M

for i in range(1, lc+1, ss*tt):
    s_tmp = (i - 1) // ss
    t_tmp = (i - 1) // tt

    if S[s_tmp] != T[t_tmp]:
        print(-1)
        exit()

print(lc)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

def lcm(m, n):
    return (m * n) // gcd(m, n)

def lcm_list(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N, M = map(int, input().split())
S = input()
T = input()

l = lcm(N, M)

if l==N or l==M or N[0]!=M[0]:
    print(-1)
else:
    print(l)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
flag = False

for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break

if flag:
    print(ans)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
flag = True

if len(s)==1:
    print(int(s))
    exit()

new = ''
for i in len(k):
    if s[i]!='1':
        flag = False
        new += i

if flag:
    print(1)
else:
    print(new[0])
Problem p03316 (python)

Fixed submission:
n = int(input())
n_origin = n

s = 0
keta = 10

while n >= 1:
    s += n%10
    n //= keta

if n_origin%s==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, n_origin, s, keta;
    cin >> n;
    n_origin = n;
    s = 0;
    keta = 10;

    while (n >= 1) {
        s += n%10;
        n /= keta;
    }

    if (n_origin%s == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
Problem p03319 (python)

Fixed submission:
n, k = map(int, input().split())

if (n-1)%(k-1)==0:
    print((n-1)//(k-1))
else:
    print((n-1)//(k-1)+1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input())

if (n-1)%(k-1)==0:
    print((n-1)//(k-1))
else:
    print((n-1)//(k-1)+1)
Problem p03361 (python)

Fixed submission:
H, W = map(int, input().split())
S = ['.' + input() + '.' for _ in range(H)]
S = ['.'*(W+2)] + S + ['.'*(W+2)]

ans = 'Yes'

for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i-1][j]!='#' and S[i][j-1]!='#' and S[i+1][j]!='#' and S[i][j+1]!='#':
                print('No')
                exit()

print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [['.']*(w+2)]
for _ in range(h):
    s.append(['.'] + list(input()) + ['.'])
s.append(['.']*(w+2))
ans = 'Yes'

for i in range(1, w):
    for j in range(1, h):
        if s[i][j] == '#':
            l = s[i][j-1]
            u = s[i-1][j]
            r = s[i][j+1]
            d = s[i+1][j]
            if l=='.' and u=='.' and r=='.' and d=='.':
                ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [['.']*(w+2)]
for _ in range(h):
    s.append(['.'] + list(input()) + ['.'])
s.append(['.']*(w+2))
ans = 'Yes'

for i in range(1, w+1):
    for j in range(1, h+1):
        if s[i][j] == '#':
            l = s[i][j-1]
            u = s[i-1][j]
            r = s[i][j+1]
            d = s[i+1][j]
            if l=='.' and u=='.' and r=='.' and d=='.':
                ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [['.']*(w+2)]
for _ in range(h):
    s.append(['.'] + list(input()) + ['.'])
s.append(['.']*(w+2))
ans = 'Yes'

for i in range(1, w+1):
    for j in range(1, h+1):
        if s[i][j] == '#':
            l = s[i][j-1]
            u = s[i-1][j]
            r = s[i][j+1]
            d = s[i+1][j]
            if l=='.' and u=='.' and r=='.' and d=='.':
                ans = 'No'

print(ans)
Problem p03543 (python)

Fixed submission:
n = input()

if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = input()
n = set(n[0], n[1], n[2], n[3])

if len(n)<=2:
    print('Yes')
else:
    print('No')
Problem p03612 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N):
    if i != N-1:
        if p[i] == i+1:
            p[i], p[i+1] = p[i+1], p[i]
            ans += 1
    else:
        if p[i] == i+1:
            p[i], p[i-1] = p[i-1], p[i]
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)
Problem p03625 (python)

Fixed submission:
from collections import Counter

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

c = Counter(a)  # リストの要素をカウント
cnt = [k for k, v in c.items() if v >= 2]

if len(cnt) < 2:
    print(0)
else:
    cnt = sorted(cnt, reverse=True)
    if c[cnt[0]] >= 4:
        print(cnt[0] * cnt[0])
    else:
        print(cnt[0] * cnt[1])

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

c = Counter(a)  # リストの要素をカウント
cnt = [k for k, v in c.imtes() if v >= 2]

if len(cnt) < 2:
    print(0)
else:
    cnt = sorted(cnt, reverse=True)
    if c[cnt[0]] >= 4:
        print(cnt[0] * cnt[0])
    else:
        print(cnt[0] * cnt[1])
Problem p03828 (python)

Fixed submission:
n = int(input())
mod = 10**9+7
s = [0] * (n+1)

for i in range(2, n+1):
    p = 2
    while i>1:
        while i%p==0:
            i //= p
            s[p] += 1
        p += 1

ans = 1
for i in s:
    ans *= i+1
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
mod = 10**9+7
s = [0] * (n+1)

for i in range(2, n+1):
    p = 2
    while i>1:
        while i%p==0:
            i //= p
            s[p] += 1
        p += 1

print(s)
ans = 1
for i in s:
    ans *= i+1
    ans %= mod

print(ans)
Problem p03854 (python)

Fixed submission:
S = input()
S = ''.join(list(reversed([c for c in S])))

while S:
    if S[:7] == 'remaerd':
        S = S[7:]
    elif S[:6] == 'resare':
        S = S[6:]
    elif S[:5] == 'maerd':
        S = S[5:]
    elif S[:5] == 'esare':
        S = S[5:]
    else:
        print('NO')
        exit()

print('YES')

Buggy submission (verdict: Runtime Error):
S = input()

while S:
    if S[:7] == 'dreamer' and S[7] != 'a':
        S = S[7:]
    elif S[:6] == 'eraser':
        S = S[6:]
    elif S[:5] == 'dream':
        S = S[5:]
    elif S[:5] == 'erase':
        S = S[5:]
    else:
        print('No')
        exit()

print('Yes')
Problem p02540 (python)

Fixed submission:
import sys
input = sys.stdin.readline

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

def main():
    n = int(input())
    xy = [list(map(int,input().split())) for i in range(n)]
    xy2 = [[x[0],x[1],i] for (i,x) in enumerate(xy)]
    xy2.sort()
    u = Unionfind(n)

    l = []
    for x,y,ind in xy2:
        M = y
        le = ind
        while l and xy[l[-1]][1] < y:
            v = l.pop()
            if M > xy[v][1]:
                M = xy[v][1]
                le = v
            u.union(ind,v)
        l.append(le)
    for i in range(n):
        print(u.size(i))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]


n = int(input())
xy = [[map(int,input().split()),i] for i in range(n)]
xy2 = sorted(xy)
u = Unionfind(n)

l = []
for x,y,ind in xy2:
    M = y
    le = ind
    while l and xy[l[-1]][1] < y:
        v = l.pop()
        if M > xy[v][1]:
            M = xy[v][1]
            le = v
        u.union(ind,v)
    l.append(le)
for i in range(n):
    print(u.size(i))
Problem p02603 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

count = [1000,0]
x = a[0]
for i in range(1,n):
    if a[i] > x:
        d = count[0]//x
        count = [count[0]-d*x, d+count[1]]
    else:
        count = [count[0]+count[1]*x,0]
    x = a[i]
if count[1]:
    count[0] += count[1]*x
print(count[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

dp = [[-1]*100000 for i in range(n+1)]

dp[0][0] = 1000

for i in range(n):
    for j in range(100000):
        if dp[i][j] >= 0:
            x = dp[i][j]
            c = x//a[i]
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
            dp[i+1][j+c] = max(dp[i+1][j+c],x-a[i]*c)
            dp[i+1][0] = max(dp[i+1][0],x+a[i]*j)
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

dp = [[-1]*1000 for i in range(n+1)]
dp[0][0] = 1000


for i in range(n):
    for j in range(1000):
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if dp[i+1][j] >= a[i]:
            dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j]-a[i])
        
    for j in range(999,0,-1):
        if dp[i+1][j] >= 0:
             dp[i+1][j-1] = max(dp[i+1][j-1],dp[i+1][j]+a[i])
print(max(dp[-1]))
Problem p02609 (python)

Fixed submission:
n = int(input())
x = list(input())
c1 = x.count("1")+1
c2 = c1-2

now1 = 0
now2 = 0

for i in range(n):
    if x[-1-i] == "1":
        now1 += pow(2,i,c1)
        if c2 != 0:
            now2 += pow(2,i,c2)
        
    now1 %= c1
    if c2 != 0:
        now2 %= c2

for i in range(n):
    if x[i] == "1":
        #print(n-1-i)
        if c2 == 0:
            print(0)
            continue
        now = (now2-pow(2,n-1-i,c2))%c2
        #print(i,now,c2)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
    else:
        #print(n-1-i)
        now = (now1+pow(2,n-1-i,c1))%c1
        #print(i,now,c1)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(input())
c1 = x.count("1")+1
c2 = c1-2

now1 = 0
now2 = 0

for i in range(n):
    if x[-1-i] == "1":
        now1 += pow(2,i,c1)
        now2 += pow(2,i,c2)
        
    now1 %= c1
    now2 %= c2

for i in range(n):
    if x[i] == "1":
        #print(n-1-i)
        now = (now2-pow(2,n-1-i,c2))%c2
        #print(i,now,c2)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
    else:
        #print(n-1-i)
        now = (now1+pow(2,n-1-i,c1))%c1
        #print(i,now,c1)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
Problem p02613 (python)

Fixed submission:
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s== "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)

Buggy submission (verdict: Runtime Error):
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    if input() == "AC":
        ac += 1
    elif input() == "WA":
        wa += 1
    elif input() == "TLE":
        tle += 1
    elif input() == "RE":
        re += 1

print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)