Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# 素数列挙 (エラトステネスの篩)
def primes_create(n):
    p = [True]*(n+1)
    p[0] = p[1] = False
    i = 2
    while i*i <= n:
        if p[i]:
            for j in range(i<<1, n+1, i): p[j] = False
        i += 1
    return p

P = primes_create(3163)
P_list = []
for i in range(len(P)):
    if P[i]: P_list.append(i)

# 素数と個数を求める
def factorize(n):
    res = []
    if n < 2: return res
    for i in range(2, n):
        if i*i > n: break
        if n%i: continue
        c = 0
        while n%i == 0: n //= i; c += 1
        res += [[i, c]]
    if n != 1: res += [[n, 1]]
    return res

def factorize_2(n):
    res = []
    if n < 2: return res
    for i in P_list:
        if i*i > n: break
        if n%i: continue
        c = 0
        while n%i == 0: n //= i; c += 1
        res += [[i, c]]
    if n != 1: res += [[n, 1]]
    return res

n = int(input())

s = 0
for i in range(1, n+1):
    cc = 1
    for p,c in factorize_2(i):
        cc *= (c + 1)
    s += i * cc
print(s)


Fixed submission:
n = int(input())
s = 0
for m in range(1, n+1):
    k = n // m
    s += k * (k+1) * m // 2
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
# 約数の個数を出力
def divisor_counter(n):
    # if n < 1: return -1
    if n < 1: return 0
    if n == 1: return 1
    count = 0
    for i in range(1, n):
        if i*i > n: break
        if n % i == 0:
            count += 1 if n == i*i else 2
    return count

n = int(input())

s = 0
for i in range(1, n+1):
    s += i*divisor_counter(i)
print(s)


Fixed submission:
n = int(input())
s = 0
for m in range(1, n+1):
    k = n // m
    s += k * (k+1) * m // 2
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
P = [*map(int, input().split())]
# print(n,k)
# print(P)

ans = 1000000000
for i in range(1<<n):
    # print(bin(i))
    v = []
    for j in range(n):
        if i>>j & 1:
          v.append(P[j])
        if len(v) == k: break
    # print(v)
    if len(v) == k:
        ans = min(ans, sum(v))
print(ans)


Fixed submission:
n,k = map(int, input().split())
P = [*map(int, input().split())]

P.sort()

ans = 0
for i in range(k):
    ans += P[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()

# nCr(n, r, m)
mod = 1000000007
n = len(s) + k

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+1):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

i25, i26 = [1], [1]
for _ in range(k+1):
    i25.append(i25[-1] * 25 % mod)
    i26.append(i26[-1] * 26 % mod)

n = len(s)
ans = 0
for i in range(k+1):
    ans += i25[i] * i26[k-i] * nCr(i+n-1, n-1, mod)
    ans %= mod
print(ans)


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

# nCr(n, r, m)
mod = 1000000007
n = len(s) + k

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+1):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

# a^n mod m
def modpow(a, n, m):
    x = 1
    while n > 0:
        if n & 1: x *= a
        a *= a; a %= m
        n >>= 1
    return x

n = len(s)
ans = 0
for i in range(k+1):
    a = modpow(25, i, mod)
    b = modpow(26, k-i, mod)
    c = nCr(n-1+i, n-1, mod)
    ans += a * b * c
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()

# nCr(n, r, m)
mod = 1000000007
n = len(s) + k

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+1):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

# a^n mod m
def modpow(a, n, m):
    x = 1
    while n > 0:
        if n & 1: x *= a
        a *= a; a %= m
        n >>= 1
    return x

n = len(s)
ans = 0
for i in range(k+1):
    a = modpow(25, i, mod)
    b = modpow(26, k-i, mod)
    c = nCr(n-1+i, n-1, mod)
    ans += a * b * c
    ans %= mod
print(ans)


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

# nCr(n, r, m)
mod = 1000000007
n = len(s) + k

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+1):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

# a^n mod m
def modpow(a, n, m):
    x = 1
    while n > 0:
        if n & 1: x *= a
        a *= a; a %= m
        n >>= 1
    return x

n = len(s)
ans = 0
for i in range(k+1):
    a = modpow(25, i, mod)
    b = modpow(26, k-i, mod)
    c = nCr(n-1+i, n-1, mod)
    ans += a * b * c
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [*map(int,input().split())]
# print(n,A)
ans = 1
for a in A:
    ans *=a
if ans > 10**18: ans = -1
print(ans)


Fixed submission:
n = int(input())
A = [*map(int,input().split())]
A.sort()
# print(n,A)
ans = 1
for a in A:
    if a == 0:
        ans = 0
        break
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# D - String Formation
s = [x for x in input()]
q = int(input())
odd = 0
for i in range(q):
    t,*fc = input().split()
    if t=='1': odd ^= 1 #t1
    else: #t2
        if odd ^ (int(fc[0])-1): s = s+[fc[1]]
        else: s = [fc[1]] + s
print(*s[::-1] if odd else s,sep='')

Fixed submission:
# D - String Formation
s = input()
q = int(input())
f = ''
b = ''
c = 0
for i in range(q):
    query = input().split()
    if query[0]=='1': c += 1 #t1
    else: #t2
        if c%2: #odd:reverse
            if query[1]=='1': #f1
                b += query[2]
            else: #f2
                f += query[2]
        else: #even
            if query[1]=='1': #f1
                f += query[2]
            else: #f2
                b += query[2]

if c%2: print(b[::-1] + s[::-1] + f) #odd
else: print(f[::-1] + s + b) #even

Buggy python submission (verdict: Time Limit Exceeded):
# D - String Formation
s = input()
q = int(input())

fb = ['','']
odd = 0
for i in range(q):
    t,*fc = input().split()
    if t=='1': odd ^= 1 #t1
    else: #t2
        fb[odd ^ (int(fc[0])-1)] += fc[1]
        # if odd: #odd:reverse
        #     if fc[0]=='1': fb[1] += fc[1] #f1
        #     else: fb[0] += fc[1] #f2
        # else: #even
        #     if fc[0]=='1': fb[0] += fc[1] #f1
        #     else: fb[1] += fc[1] #f2

if odd: print(fb[1][::-1] + s[::-1] + fb[0])
else: print(fb[0][::-1] + s + fb[1])


Fixed submission:
# D - String Formation
s = input()
q = int(input())
f = ''
b = ''
c = 0
for i in range(q):
    query = input().split()
    if query[0]=='1': c += 1 #t1
    else: #t2
        if c%2: #odd:reverse
            if query[1]=='1': #f1
                b += query[2]
            else: #f2
                f += query[2]
        else: #even
            if query[1]=='1': #f1
                f += query[2]
            else: #f2
                b += query[2]

if c%2: print(b[::-1] + s[::-1] + f) #odd
else: print(f[::-1] + s + b) #even
Buggy python submission (verdict: Runtime Error):
# D - Dice in Line
n,k = map(int,input().split())
p = [0]*k + [*map(int,input().split())]
ans = sum = 0
for i in range(n):
    sum += p[i+k] - p[i]
    ans = max(ans, sum)
print((ans+k)/2)

Fixed submission:
# D - Dice in Line
n,k = map(int,input().split())
p = [0]*k + list(map(int,input().split()))
ans = sum = 0
for i in range(n):
    sum += p[i+k] - p[i]
    ans = max(ans, sum)
print((ans+k)/2)
Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce

def lcm(a, b):return a//gcd(a,b)*b
def lcm_list(x): return reduce(lcm, x)
def gcd_list(x): return reduce(gcd, x)

n,m = map(int, input().split())
a = [*map(lambda x: int(x)//2 , input().split())]
l = lcm_list(a)
if l <= m:
    print((m//l+2-1)//2) # round up
else:
    print(0)


Fixed submission:
from fractions import gcd
from functools import reduce
def lcm(a, b):return a//gcd(a,b)*b

def f(x):
    c = 0
    while x%2==0:
        x //= 2
        c += 1
    return c

n,m = map(int, input().split())
a = list(map(lambda x:int(x)//2, input().split()))
t = f(a[0])
m >>= t
l = 1
for x in a:
    if f(x) != t:
        print(0)
        quit()
    x >>= t
    l = l // gcd(l,x) * x
    if l > m:
        print(0)
        quit()

print((m//l+2-1)//2) # round up
Buggy python submission (verdict: Runtime Error):
// D - Water Bottle
#include <bits/stdc++.h>
using namespace std;
using dbl = double;
#define PI (M_PI)
#define DEG(rad) ((rad)*180/PI)
#define EPS (0.000000001) // 誤差範囲

dbl f(dbl a, dbl b, dbl rad){//rad 傾けたとき a*a*b の容器にあふれずに入れられる水の量は？
	if(PI/2 - rad < EPS) return 0.0;//誤差範囲で90°といえるなら0を返す
	dbl c = tan(rad);//rad 傾けてみる
	//入れられる水の量: b/a(45°)以下？ yes:容器の体積-空き容量(横から見て、奥行き*△) no:奥行き*△
	return c<=b/a? a*a*b - a*(a*(a*c)/2): a*(b*(b/c)/2);
}

dbl solve(dbl a, dbl b, dbl x){
	dbl ok = PI/2;
	dbl ng = 0;
	dbl volume = 0;
	while(abs(x - volume) >= EPS){
		dbl mid = (ok+ng)/2;// mid: この角度でどれだけ水を入れられるか？
		volume = f(a,b,mid);
		if(volume <= x) ok = mid;// 角度を小さくして、もっと多く入るようにする
		else ng = mid;// 角度を大きくして、もっと少なく入るようにする
	}
	return ok;
}

int main(){
	dbl a,b,x; cin>>a>>b>>x;
	printf("%.10f\n", DEG(solve(a, b, x)));
}

Fixed submission:
# D - Water Bottle
from math import atan, degrees
a,b,x = map(float, input().split())
s = x/a
print( degrees( atan( b/(s/b*2) if s<a*b/2 else (b-s/a)*2/a ) ) )

Buggy python submission (verdict: Runtime Error):
// D - Water Bottle
#include <bits/stdc++.h>
using namespace std;
using dbl = double;

int main(){
	dbl a,b,x; cin>>a>>b>>x;
	dbl s = x/a;
	dbl h = b, w = a;
	if(s < a*b/2) w = s/b*2;
	else h = (b-s/a)*2;
	printf("%.10f\n", atan2(h, w)*180/M_PI);
}

Fixed submission:
# D - Water Bottle
from math import atan, degrees
a,b,x = map(float, input().split())
s = x/a
print( degrees( atan( b/(s/b*2) if s<a*b/2 else (b-s/a)*2/a ) ) )
Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [*map(int,input().split())]
ans = 0
for i in range(N-1):
    for j in range(i+1,N):
# for j in range(N):
#     for i in range(j):
        ans += D[i] * D[j]
print(ans)


Fixed submission:
N = int(input())
# D = [*map(int,input().split())]
D = [d for d in map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [*map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)


Fixed submission:
N = int(input())
# D = [*map(int,input().split())]
D = [d for d in map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for low in range(N-2):
    for mid in range(low+1,N-1):
        for hi in range(N-1,mid,-1):
            if L[hi] < L[low] + L[mid]:
                ans += (hi - mid)
                break
print(ans)

Fixed submission:
from itertools import *
N = int(input())
L = list(map(int,input().split()))
csum = list(0 for _ in range(2000+1))
for i in range(N): csum[L[i]] += 1
csum = list(accumulate(csum))
ans = 0
for ib in range(N):
    for ia in range(ib):
        a, b = L[ia], L[ib]
        minL, maxL = abs(a-b), a+b
        ans += csum[maxL-1] - csum[minL]
        if minL < a and a < maxL: ans -= 1
        if minL < b and b < maxL: ans -= 1
print(ans//3)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for low in range(N-2):
    for mid in range(low+1,N-1):
        for hi in range(mid+1,N):
            if L[hi] < L[low] + L[mid]: ans += 1
print(ans)

Fixed submission:
from itertools import *
N = int(input())
L = list(map(int,input().split()))
csum = list(0 for _ in range(2000+1))
for i in range(N): csum[L[i]] += 1
csum = list(accumulate(csum))
ans = 0
for ib in range(N):
    for ia in range(ib):
        a, b = L[ia], L[ib]
        minL, maxL = abs(a-b), a+b
        ans += csum[maxL-1] - csum[minL]
        if minL < a and a < maxL: ans -= 1
        if minL < b and b < maxL: ans -= 1
print(ans//3)
Buggy python submission (verdict: Runtime Error):
def opeCounter(S, K):
    T = S * K
    c = 0
    i = 1
    while i < len(T):
        if T[i-1] == T[i]:
            c += 1
            i += 1
        i += 1
    return c

def agc039a(S, K):
    s1 = opeCounter(S, 1)
    s2 = opeCounter(S, 2)
    s3 = opeCounter(S, 3)
    d1 = s2 - s1
    d2 = s3 - s2

    ans = 0
    if d1 == d2: ans = s1 + d1 * (K-1)
    else:
        if(k%2 != 0): ans = s1 + (d1+d2) * ((k+2-1)//2-1) ##(k/2):roundup
        else: ans = s2 + (d1+d2) * (k//2-1)
    return ans

S = input()
K = int(input())
print(agc039a(S, K))

Fixed submission:
def opeCounter(S, K):
    T = S * K
    c = 0
    i = 1
    while i < len(T):
        if T[i-1] == T[i]:
            c += 1
            i += 1
        i += 1
    return c

def agc039a(S, K):
    s1 = opeCounter(S, 1)
    s2 = opeCounter(S, 2)
    s3 = opeCounter(S, 3)
    d1 = s2 - s1
    d2 = s3 - s2

    ans = 0
    if d1 == d2: ans = s1 + d1 * (K-1)
    else:
        if(K%2 != 0): ans = s1 + (d1+d2) * ((K+2-1)//2-1) ##(k/2):roundup
        else: ans = s2 + (d1+d2) * (K//2-1)
    return ans

S = input()
K = int(input())
print(agc039a(S, K))

Buggy python submission (verdict: Runtime Error):
def opeCounter(S, K):
    T = S * K
    c = 0
    i = 1
    while i < len(T):
        if T[i-1] == T[i]:
            c += 1
            i += 1
        i += 1
    return c

def agc039a(S, K):
    s1 = opeCounter(S, 1)
    s2 = opeCounter(S, 2)
    s3 = opeCounter(S, 3)
    d1 = s2 - s1
    d2 = s3 - s2

    ans = 0
    if d1 == d2: ans = s1 + d1 * (K-1)
    else:
        if(k%2 != 0): ans = s1 + (d1+d2) * ((k+2-1)/2-1) ##(k/2):roundup
        else: ans = s2 + (d1+d2) * (k/2-1)
    return ans

S = input()
K = int(input())
print(agc039a(S, K))

Fixed submission:
def opeCounter(S, K):
    T = S * K
    c = 0
    i = 1
    while i < len(T):
        if T[i-1] == T[i]:
            c += 1
            i += 1
        i += 1
    return c

def agc039a(S, K):
    s1 = opeCounter(S, 1)
    s2 = opeCounter(S, 2)
    s3 = opeCounter(S, 3)
    d1 = s2 - s1
    d2 = s3 - s2

    ans = 0
    if d1 == d2: ans = s1 + d1 * (K-1)
    else:
        if(K%2 != 0): ans = s1 + (d1+d2) * ((K+2-1)//2-1) ##(k/2):roundup
        else: ans = s2 + (d1+d2) * (K//2-1)
    return ans

S = input()
K = int(input())
print(agc039a(S, K))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
# print(n)
# print(A)

B = [0]*n
for i in range(n):
    B[i] = A[i] - (i+1)

B.sort()
# print(B)
bmin = min(B)
bmax = max(B)
ans = 10**18
for b in range(bmin,bmax+1):
    ret = 0
    for bi in B:
        ret += abs(bi-b)
    ans = min(ans, ret)
print(ans)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
B = []
for i in range(n): B.append(A[i] - (i+1))
B.sort()
r = B[n//2] # median right
l = B[n//2] if n%2 else B[n//2-1] # median left
# print(n,A)
# print(B)
# print(l,r)
ans_l = 0
ans_r = 0
for bi in B:
    ans_l += abs(bi-l)
    ans_r += abs(bi-r)
print(min([ans_l, ans_r]))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)

# print(s,k,n)

ks = {}
m = {}
for i in range(n):
    if s[i] in m.keys():
        m[s[i]] += [i]
    else:
        m[s[i]] = [i]

# "spam".startswith("sp")

m = list(m.items())
# print(m)
m.sort()
# print(m)

# for ky,ixs in m.items():
for ky,ixs in m:
    c = set()
    for i in ixs:
        for j in range(len(s[i:])):
            c.add(s[i:i+j+1])
            # print(s[i:i+j+1])
    c = list(c)
    c.sort()
    # print(len(c),c)
    # print('---')
    for ans in c:
        k -= 1
        if k == 0:
            print(ans)
            exit()
print(s)


Fixed submission:
s = input()
k = int(input())
n = len(s)

# print('s',s,'k',k)
c = set()
for i in range(n):
    # print(s[i:i+5])
    t = s[i:i+5]
    for j in range(1,5+1):
        # print(t[:j])
        c.add(t[:j])

c = list(c)
c.sort()
# print(*c,sep='\n')
print(c[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)

c = set()
for i in range(n-1):
    for j in range(i+1, n+1):
        c.add(s[i:j])

if k <= len(c):
    c = list(c)
    c.sort()
    print(c[k-1])
else: print(s)






Fixed submission:
s = input()
k = int(input())
n = len(s)

# print('s',s,'k',k)
c = set()
for i in range(n):
    # print(s[i:i+5])
    t = s[i:i+5]
    for j in range(1,5+1):
        # print(t[:j])
        c.add(t[:j])

c = list(c)
c.sort()
# print(*c,sep='\n')
print(c[k-1])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
n = len(s)
# print(s,k,n)

c = set()
for i in range(n-1):
    for j in range(i+1, n+1):
        c.add(s[i:j])

c=list(c)
# print(c)
c.sort()
# print(c)

if len(c) > 0: print(c[k-1])
else: print(s)





Fixed submission:
s = input()
k = int(input())
n = len(s)

# print('s',s,'k',k)
c = set()
for i in range(n):
    # print(s[i:i+5])
    t = s[i:i+5]
    for j in range(1,5+1):
        # print(t[:j])
        c.add(t[:j])

c = list(c)
c.sort()
# print(*c,sep='\n')
print(c[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-


def factor_osa(A):
    Max = max(A) + 1
    IsPrime = [True] * Max
    MinFactor = [-1] * Max
    Primes = []
    prim = {}
    dica = {}
    mxa = 0
    IsPrime[0], IsPrime[1] = False, False
    MinFactor[0], MinFactor[1] = 0, 1
    for i in range(2, Max):
        if IsPrime[i]:
            MinFactor[i] = i
            Primes.append(i)
            for j in range(i*2, Max, i):
                IsPrime[j] = False
                if MinFactor[j] == -1:
                    MinFactor[j] = i
    ret = []
    for a in A:
        res = []
        while a != 1:
            prime = MinFactor[a]
            exp = 0
            while MinFactor[a] == prime:
                exp += 1
                a //= prime
            res.append((prime, exp))
            if not prime in dica:
                dica[prime] = 1
            else:
                dica[prime] += 1
            mxa = max(mxa, dica[prime])
        ret.append(res)
    return [ret, mxa]

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

aa = factor_osa(a)

from math import gcd        #for python3.8

def Gcd(lt):
    l = len(lt)
    ret = [1]*l
    ret[0] = lt[0]
    for i in range(1,l):
        ret[i] = gcd(ret[i-1], lt[i])
    return ret

if max(a) == 1:
    print('pairwise coprime')
    exit()

if aa[1] == 1:
    print('pairwise coprime')
elif Gcd(a)[-1]==1:
    print('setwise coprime')
else:
    print('not coprime')


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-


def factor_osa(A):
    Max = max(A) + 1
    IsPrime = [True] * Max
    MinFactor = [-1] * Max
    Primes = []
    prim = {}
    dica = {}
    mxa = 0
    IsPrime[0], IsPrime[1] = False, False
    MinFactor[0], MinFactor[1] = 0, 1
    for i in range(2, Max):
        if IsPrime[i]:
            MinFactor[i] = i
            Primes.append(i)
            for j in range(i*2, Max, i):
                IsPrime[j] = False
                if MinFactor[j] == -1:
                    MinFactor[j] = i
    ret = []
    for a in A:
        res = []
        while a != 1:
            prime = MinFactor[a]
            exp = 0
            while MinFactor[a] == prime:
                exp += 1
                a //= prime
            res.append((prime, exp))
            if not prime in dica:
                dica[prime] = 1
            else:
                dica[prime] += 1
            mxa = max(mxa, dica[prime])
        ret.append(res)
    return [ret, mxa]

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

aa = factor_osa(a)

from math import gcd        #for python3.8

def Gcd(lt):
    l = len(lt)
    ret = [1]*l
    ret[0] = lt[0]
    for i in range(1,l):
        ret[i] = gcd(ret[i-1], lt[i])
    return ret

if max(a) == 1:
    print('pairwise coprime')
    exit()

if aa[1] == 1:
    print('pairwise coprime')
elif Gcd(a)[-1]==1:
    print('setwise coprime')
else:
    print('not coprime')
Buggy python submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0:
    print(-1)
else:
    ret = len(str(k))-1
    x = int('7'*(len(str(k))-1))
    res = x%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7)%k
        ret += 1
    print(ret)


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7)%k
        ret += 1
    print(ret)


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
s = input()
def f(str):
    if str == '':
        return 0
    else:
        if str[0] == 'R':
            return f(str[1:])
        elif str[-1] == 'W':
            return f(str[:-1])
        else:
            ret = f(str[1:-1]) + 1
            ret = min(f(str[:-1]) + 1, ret)
            ret = min(f(str[1:]) + 1, ret)
            return ret

print(f(s))


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
s = input()
r = s.count('R')
print(s[:r].count('W'))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
A = list(map(int, input().split()))
Hk = 1
for i in range(K):
    Hk*=A[i]

for i in range(K,N):
    pv=Hk
    Hk=Hk*A[i]//A[i-K]
#    print(Hk)
    if Hk>pv:
        print('Yes')
    else:
        print('No')


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(K,N):
    if A[i]>A[i-K]:
        print('Yes')
    else:
        print('No')