Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for x in range(1, 3501):
  for y in range(1, 3501):
    t = 4 * x * y - n * y - n * x
    if(t <= 0):
      continue
    if((n * x * y) % t == 0):
      print(x, y, (n * x * y) // t)
      exit(0)

Fixed submission:
n = int(input())
for x in range(1, 3501):
  for y in range(1, 3501):
    t = 4 * x * y - n * y - n * x
    if(t <= 0):
      continue
    if((n * x * y) % t == 0):
      print(x, y, (n * x * y) // t)
      exit(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mat = [list(map(int, input().split())) for _ in range(n)]
ans = 0
d = [[1] * n for _ in range(n)]
for i in range(n):
    for j, c2 in enumerate(row[i] for row in mat):
        for k, (c1, c3) in enumerate(zip(mat[j], mat[i])):
            if c1 > c2+c3:
                print(-1)
                exit(0)
            elif i != j and i != k and c1 == c2 + c3:
                d[j][k] = 0
for i in range(n):
    for j in range(n):
        if d[i][j]:
            ans += mat[i][j]
print(ans // 2)

Fixed submission:
n = int(input())
mat = [list(map(int, input().split())) for _ in range(n)]
ans = 0
d = [[1] * n for _ in range(n)]
for i in range(n):
    for j, c2 in enumerate(row[i] for row in mat):
        for k, (c1, c3) in enumerate(zip(mat[j], mat[i])):
            if c1 > c2+c3:
                print(-1)
                exit(0)
            elif i != j and i != k and c1 == c2 + c3:
                d[j][k] = 0
for i in range(n):
    for j in range(n):
        if d[i][j]:
            ans += mat[i][j]
print(ans // 2)
Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
c = [0] * 100000
n = int(input())
a = [int(input()) for i in range(n)]
s = set(a)
for i in s:
    if a.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter([input() for i in range(n)])
print(len([x for x in a.values() if x % 2 == 1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
a = [input() for i in range(n)]
t = list(set(a))
for i in t:
    if a.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter([input() for i in range(n)])
print(len([x for x in a.values() if x % 2 == 1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
a = []
for i in range(n):
    a.append(int(input()))
t = list(set(a))
for i in t:
    if a.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter([input() for i in range(n)])
print(len([x for x in a.values() if x % 2 == 1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
a = []
for i in range(n):
    a.append(int(input()))
t = list(set(a))
for i in t:
    if a.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter([input() for i in range(n)])
print(len([x for x in a.values() if x % 2 == 1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
a = []
for i in range(n):
    a.append(int(input()))
t = list(set(a))
for i in t:
    if a.count(i) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter([input() for i in range(n)])
print(len([x for x in a.values() if x % 2 == 1]))
Buggy python submission (verdict: Time Limit Exceeded):
input()
m = []
a = list(map(int, input().split()))
for x in range(min(a), max(a)+1):
    m.append(a.count(x - 1) + a.count(x) + a.count(x + 1))
print(max(m))

Fixed submission:
ans = 0
input()
a = list(map(int, input().split()))
c = [0] * (10 ** 5 + 1)
for i in a:
    c[i] += 1
for x in range(min(a), max(a)+1):
    m = c[x - 1] + c[x] + c[x + 1]
    ans = max(ans, m)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
input()
m = []
a = list(map(int, input().split()))
for x in a:
    m.append(a.count(x-1) + a.count(x) + a.count(x+1))
print(max(m))

Fixed submission:
ans = 0
input()
a = list(map(int, input().split()))
c = [0] * (10 ** 5 + 1)
for i in a:
    c[i] += 1
for x in range(min(a), max(a)+1):
    m = c[x - 1] + c[x] + c[x + 1]
    ans = max(ans, m)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
input()
m = []
a = list(map(int, input().split()))
for x in a:
    m.append(a.count(x-1) + a.count(x) + a.count(x+1))
print(max(m))

Fixed submission:
ans = 0
input()
a = list(map(int, input().split()))
c = [0] * (10 ** 5 + 1)
for i in a:
    c[i] += 1
for x in range(min(a), max(a)+1):
    m = c[x - 1] + c[x] + c[x + 1]
    ans = max(ans, m)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
input()
m = []
a = list(map(int, input().split()))
for x in range(min(a), max(a)+1):
    m.append(a.count(x - 1) + a.count(x) + a.count(x + 1))
print(max(m))

Fixed submission:
ans = 0
input()
a = list(map(int, input().split()))
c = [0] * (10 ** 5 + 1)
for i in a:
    c[i] += 1
for x in range(min(a), max(a)+1):
    m = c[x - 1] + c[x] + c[x + 1]
    ans = max(ans, m)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input.split())
if x-a>x-b:
  print('B')
else:
  print('A')

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
  print('B')
else:
  print('A')

Buggy python submission (verdict: Runtime Error):
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
i, c = 0, 0
m = list()
while i < len(a)-1:
    if a[i] == a[i+1]:
        m.append(a[i])
        i += 1
        c += 1
    i += 1
    if c == 2:
        break
if c == 2:
    print(m[0]*m[1])
else:
    print(0)

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
  print('B')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
i, c = 0, 0
m = list()
while i < n-1:
    if a[i] == a[i+1]:
        m.append(a[i])
        i += 1
        c += 1
    i += 1
    if c == 2:
        break
if c == 2:
    print(m[0]*m[1])
else:
    print(0)

Fixed submission:
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
i, c = 0, 0
m = list()
while i < len(a)-1:
    if a[i] == a[i+1]:
        m.append(a[i])
        i += 1
        c += 1
    i += 1
    if c == 2:
        break
if c == 2:
    print(m[0]*m[1])
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a = []
tmp = 0
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in range(len(a)):
    if a[i] == a[i+3] and tmp == 0:
        print(a[i]**2)
        exit()
    elif a[i] == a[i+1]:
        if tmp == 0:
            W = a[i]
            tmp = 1
            del a[i+1]
        else:
            H = a[i]
            break
print(W*H)

Fixed submission:
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
i, c = 0, 0
m = list()
while i < len(a)-1:
    if a[i] == a[i+1]:
        m.append(a[i])
        i += 1
        c += 1
    i += 1
    if c == 2:
        break
if c == 2:
    print(m[0]*m[1])
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
ans = float('inf')
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
    ans = min(ans, abs(sum(a[:i]) - sum(a[i:])))
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
c = [0] * (N + 1)
for i in range(N):
    c[i + 1] = c[i] + a[i]
ans = float('inf')
for n in c[1:-1]:
    ans = min(ans, abs(c[-1] - 2 * n))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
fac = [1] * (10 ** 5 + 10)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD


def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD


n = int(input())
a = list(map(int, input().split()))
d = [-1] * n
for i, x in enumerate(a):
    if d[x - 1] != -1:
        p = d[x - 1]
        q = i
    else:
        d[x - 1] = i
print(n)
for k in range(2, n + 2):
    ans = 0
    ans += comb(n - 1, k - 2)
    ans += comb(n - 1, k - 1) * 2 - comb(p + n - q, k - 1)
    ans += comb(n - 1, k)
    print(ans % MOD)


Fixed submission:
MOD = 10 ** 9 + 7
fac = [1] * (10 ** 5 + 10)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD


def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD


n = int(input())
a = list(map(int, input().split()))
d = [-1] * n
for i, x in enumerate(a):
    if d[x - 1] != -1:
        p = d[x - 1]
        q = i
    else:
        d[x - 1] = i
print(n)
for k in range(2, n + 2):
    ans = 0
    ans += comb(n - 1, k - 2)
    ans += comb(n - 1, k - 1) * 2 - comb(p + n - q, k - 1)
    ans += comb(n - 1, k)
    print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for _ in range(N)]
i = 0
ans = 0
while (1):
    i = a[i] - 1
    ans += 1
    if i == 0:
        print(-1)
        break
    elif i == 1:
        print(ans)
        break


Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]
i = 1
ans = 0
for j in range(N):
    i = a[i - 1]
    ans += 1
    if i == 2:
        print(ans)
        exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
r, c, n = map(int, input().split())
l = []
for i in range(n):
    x1, y1, x2, y2 = map(int, input().split())
    if (x1 == 0 or x1 == r or y1 == 0 or y1 == c) and (x2 == 0 or x2 == r or y2 == 0 or y2 == c):
        if x1 == 0:
            l.append((y1, i))
        elif y1 == c:
            l.append((c + x1, i))
        elif x1 == r:
            l.append((c * 2 + r - y1, i))
        else:
            l.append((r * 2 + c * 2 - x1, i))
        if x2 == 0:
            l.append((y2, i))
        elif y2 == c:
            l.append((c + x2, i))
        elif x2 == r:
            l.append((c * 2 + r - y2, i))
        else:
            l.append((r * 2 + c * 2 - x2, i))
l.sort()
s = [l[0][1]]
for x, i in l[1:]:
    s.append(0)
    s.append(i)
r = [0] * len(s)
i, j = 0, 0
while i < len(s):
    while i - j >= 0 and i + j < len(s) and s[i - j] == s[i + j]:
        j += 1
    r[i] = j
    k = 1
    while i - k >= 0 and k + r[i - k] < j:
        r[i + k] = r[i - k]
        k += 1
    i += k
    j -= k
for i in range(1, len(s), 2):
    p = r[i]
    if i == p - 1:
        m = (len(s) - p * 2) // 2
        if m == -1 or (m > 0 and r[-m] == m):
            print('YES')
            exit(1)
print('NO')


Fixed submission:
r, c, n = map(int, input().split())
l = []
for i in range(n):
    x1, y1, x2, y2 = map(int, input().split())
    if (x1 == 0 or x1 == r or y1 == 0 or y1 == c) and (x2 == 0 or x2 == r or y2 == 0 or y2 == c):
        if x1 == 0:
            l.append((y1, i))
        elif y1 == c:
            l.append((c + x1, i))
        elif x1 == r:
            l.append((c * 2 + r - y1, i))
        else:
            l.append((r * 2 + c * 2 - x1, i))
        if x2 == 0:
            l.append((y2, i))
        elif y2 == c:
            l.append((c + x2, i))
        elif x2 == r:
            l.append((c * 2 + r - y2, i))
        else:
            l.append((r * 2 + c * 2 - x2, i))
l.sort()
s = []
d = [False] * n
for x, i in l:
    if d[i]:
        if s[-1] != i:
            print('NO')
            exit(0)
        s.pop()
    else:
        s.append(i)
        d[i] = True
print('YES')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0
xm = float('inf')
for i in range(n):
    if s[i] == '(':
        x += 1
    elif s[i] == ')':
        x -= 1
        xm = min(xm, x)
print('(' * -xm + s + ')' * (x - xm))

Fixed submission:
n = int(input())
s = input()
x = 0
y = 0
for i in range(n):
    if s[i] == '(':
        x += 1
    elif s[i] == ')':
        x -= 1
    if x < 0:
        y += 1
        x += 1
print('(' * y + s + ')' * x)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
if a + b < 10:
  print(a + b)
else:
  print('error')

Fixed submission:
a, b = map(int,input().split())
if a + b < 10:
  print(a + b)
else:
  print('error')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from copy import deepcopy
n = int(input())
a = list(map(int, input().split()))
c = [0] * n
for i in range(n):
    c[i] = c[i - 1] + a[i]
c = np.array(c)
ans1, ans2 = 0, 0
tmp = deepcopy(c)
for i in range(n):
    t = tmp[i]
    if i % 2 == 0 and tmp[i] >= 0:
        tmp -= t + 1
        ans1 += t + 1
    elif i % 2 == 1 and tmp[i] <= 0:
        tmp += -t + 1
        ans1 += -t + 1
tmp = deepcopy(c)
for i in range(n):
    t = tmp[i]
    if i % 2 == 1 and tmp[i] >= 0:
        tmp -= t + 1
        ans2 += t + 1
    elif i % 2 == 0 and tmp[i] <= 0:
        tmp += -t + 1
        ans2 += -t + 1
print(min(ans1, ans2))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [a[0]]
for i in range(1, n):
    s.append(s[i-1]+a[i])
ans1, ans2 = 0, 0
for i in range(n):
    if s[i]*((-1)**i) <= 0:
        ans1 += abs(s[i]-(-1)**i)
        s[i] = (-1)**i
    if i+1 <= n-1:
        s[i+1] = s[i]+a[i+1]
s = [a[0]]
for i in range(1, n):
    s.append(s[i-1]+a[i])
for i in range(n):
    if s[i]*((-1)**(i+1)) <= 0:
        ans2 += abs(s[i]-(-1)**(i+1))
        s[i] = (-1)**(i+1)
    if i+1 <= n-1:
        s[i+1] = s[i]+a[i+1]
print(min(ans1, ans2))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from copy import deepcopy
n = int(input())
a = list(map(int, input().split()))
c = [0] * n
for i in range(n):
    c[i] = c[i - 1] + a[i]
c = np.array(c)
ans1, ans2 = 0, 0
tmp = deepcopy(c)
for i in range(n):
    t = tmp[i]
    if i % 2 == 0 and tmp[i] >= 0:
        tmp[i:] -= t + 1
        ans1 += t + 1
    elif i % 2 == 1 and tmp[i] <= 0:
        tmp[i:] += -t + 1
        ans1 += -t + 1
tmp = deepcopy(c)
for i in range(n):
    t = tmp[i]
    if i % 2 == 1 and tmp[i] >= 0:
        tmp[i:] -= t + 1
        ans2 += t + 1
    elif i % 2 == 0 and tmp[i] <= 0:
        tmp[i:] += -t + 1
        ans2 += -t + 1
print(min(ans1, ans2))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [a[0]]
for i in range(1, n):
    s.append(s[i-1]+a[i])
ans1, ans2 = 0, 0
for i in range(n):
    if s[i]*((-1)**i) <= 0:
        ans1 += abs(s[i]-(-1)**i)
        s[i] = (-1)**i
    if i+1 <= n-1:
        s[i+1] = s[i]+a[i+1]
s = [a[0]]
for i in range(1, n):
    s.append(s[i-1]+a[i])
for i in range(n):
    if s[i]*((-1)**(i+1)) <= 0:
        ans2 += abs(s[i]-(-1)**(i+1))
        s[i] = (-1)**(i+1)
    if i+1 <= n-1:
        s[i+1] = s[i]+a[i+1]
print(min(ans1, ans2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s = [input()for _ in range(n)]
t = input()
s += t
a = s.copy()
z = s.copy()
for i in range(n):
  a[i] = a[i].replace('?', 'a')
  z[i] = z[i].replace('?', 'z')
a.sort()
z.sort()
idx1 = z.index(t)
idx2 = a.index(t)
print(' '.join(map(str,range(idx1 + 1, idx2 + 2))))

Fixed submission:
n=int(input())
s = [input()for _ in range(n)]
t = input()
s += [t]
a = s.copy()
z = s.copy()
for i in range(n):
  a[i] = a[i].replace('?', 'a')
  z[i] = z[i].replace('?', 'z')
a.sort(reverse=True)
z.sort()
idx1 = z.index(t)
idx2 = n - a.index(t)
print(' '.join(map(str,range(idx1 + 1, idx2 + 2))))
Buggy python submission (verdict: Runtime Error):
n=int(input());print(800*x-x//15*200)

Fixed submission:
x=int(input());print(800*x-x//15*200)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
t = n * (n + 1) // 2
s = sum(a)
if s % t:
    print('NO')
else:
    c = s // t
    b = [0] * n
    for i in range(n):
        b[i] = a[i] - a[i - 1] - c
    for i in range(n):
        if b[i] % n or k < 0:
            print('NO')
            break
    else:
        print('YES')


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
if (2 * s) % (n * (n + 1)) != 0:
    print('NO')
else:
    t = (2 * s) // (n * (n + 1))
    for i in range(n - 1):
        k = a[i - 1] - a[i] + t
        if k % n or k < 0:
            print('NO')
            break
    else:
        print('YES')
Buggy python submission (verdict: Runtime Error):
s=input()
for i in len(s):
  if s[i] == 'A':
    a=i
    break
for i in len(s):
  if s[i] == 'Z':
    z=i
print(z-a+1)

Fixed submission:
s=input()
a=s.find('A')
z=s[::-1].find('Z')
print(len(s)-z-a)
Buggy python submission (verdict: Runtime Error):
a,b,c=[input() for _ in range(3)]
s=3*c
print(a,b,s-a-b)
print(2*s-2*a-b-2*c,c,2*a+b+c-s)
print(a+b+2*c-s,s-b-c,s-a-c)

Fixed submission:
a,b,c=[int(input()) for _ in range(3)]
s=3*c
print(a,b,s-a-b)
print(2*s-2*a-b-2*c,c,2*a+b+c-s)
print(a+b+2*c-s,s-b-c,s-a-c)
Buggy python submission (verdict: Runtime Error):
from fraction import gcd
a,b,c,d=map(int,input().split())
if abs(c-a)==0 or abs(d-b)==0:
  print(0)
else:
  x,y=abs(c-a),abs(d-b)
  g=gcd(x,y)
  print(x+y-g)

Fixed submission:
from fractions import gcd
a,b,c,d=map(int,input().split())
if abs(c-a)==0 or abs(d-b)==0:
  print(0)
else:
  x,y=abs(c-a),abs(d-b)
  g=gcd(x,y)
  print(x+y-g)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
a = [0]*n
b = [0]*n
for i in range(n):
  a[i] = 10 ** 5 * (i + 1) + p
  b[i] = 10 ** 5 * (n - i)
print(' '.join(map(str,a)))
print(' '.join(map(str,b)))

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
a = [0]*n
b = [0]*n
for i in range(n):
  a[p[i] - 1] += i
  a[i] += n * (i + 1)
  b[i] = n * (n - i)
print(' '.join(map(str,a)))
print(' '.join(map(str,b)))
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a.copy()
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)

Fixed submission:
n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a[:]
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a.copy()
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)

Fixed submission:
n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a[:]
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input())for _ in range(n)]
o = a[::2]
e = a[1::2]
o.sort()
e.sort()
l = [0] * n
for i in range(n):
  if i % 2 == 0:
    l[i] = o[i // 2]
  else:
    l[i] = e[(i - 1) // 2]
ans = 0
for _ in range(n):
  for i in range(n - 1):
    if l[i] > l[i + 1]:
      ans += 1
      l[i], l[i + 1] = l[i + 1], l[i]
print(ans)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
d = [{x: 0 for x in a} for _ in range(2)]
b = sorted(a)
for i in range(n):
    if i % 2:
        d[0][a[i]] += 1
        d[1][b[i]] += 1
t1 = 0
t2 = 0
for v1, v2 in zip(d[0].values(), d[1].values()):
    if v1 > v2:
        t1 += v1 - v2
print(t1)
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
l.sort()
ans = NO
if l == [5, 5, 7]:
  ans = YES
print(ans)

Fixed submission:
l = list(map(int, input().split()))
l.sort()
ans = 'NO'
if l == [5, 5, 7]:
  ans = 'YES'
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    s = str(input())

    if s[len(s) - 1] == 's':

    	print(s + "es")    else:

    	print(s + 's')

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)

Fixed submission:
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    s = str(input())

    if s[len(s) - 1] == 's':

    	print(s + "es")
    else:

    	print(s + 's')

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)
Buggy python submission (verdict: Runtime Error):
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    n = int(input())

    cnt=0

    for i in range(n):

    	a,b = map(int,input().split())    	if a==b:

        cnt += 1

        if cnt == 3:

    		print("Yes")

    		exit()

    	else:

    		cnt=0

    print("No")

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)

Fixed submission:
import math
from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

def solve(case_no):
    n = int(input())
    cnt=0
    for i in range(n):
    	a,b = map(int,input().split())
    	if a==b:
    		cnt += 1
    		if cnt == 3:
    			print("Yes")
    			exit()
    	else:
    		cnt=0
    print("No")
    	

t = 1
# t = int(input())
for i in range(1, t + 1):
    solve(i)
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        num = int(input())
        lst = list(map(int, input().split()))
        point = lst[-1]
        ans = 0
        for n in lst[-1::-1]:
            point = min(point, n)
            ans += point
        ans lst[0]
        print(ans)
    except:
        break

Fixed submission:
while True:
    try:
        num = int(input())
        lst = list(map(int, input().split()))
        ans = 0
        ans += lst[-1] + lst[0]
        if num == 2:
            print(ans)
            continue
        for i in range(1, num-1):
            ans += min(lst[i], lst[i-1])
        print(ans)
    except:
        break
Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(ans)

Fixed submission:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)+1):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(defolt)

Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
        defolt = min(defolt,ans)
print(ans)

Fixed submission:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)+1):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(defolt)

Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
        ans = min(defolt,ans)
print(ans)

Fixed submission:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)+1):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(defolt)