Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**7)

from collections import Counter

class Prime:
    def __init__(self, N):
        smallestPrime = [1] * (N + 1)
        primes = []

        for i in range(2, N + 1):
            if smallestPrime[i] != 1:
                continue
            primes.append(i)
            for p in range(i * 2, N + 1, i):
                if smallestPrime[p] == 1:
                    smallestPrime[p] = i

        self.smallestPrime = smallestPrime
        self.primes = primes

    def isPrime(self, n):
        return n > 1 and self.smallestPrime[n] == 1

    def factorization(self, n):
        ret = Counter()
        while (p := self.smallestPrime[n]) != 1:
            ret[p] += 1
            n //= p
        if n > 1:
            ret[n] += 1
        return ret

N = int(input())
A = list(map(int, input().split()))
prime = Prime(max(A) + 100)

def gcd(n, m):
    return n if m == 0 else gcd(m, n % m)

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1

def isPairwise(A):
    cnt = Counter()
    for a in A:
        for p in prime.factorization(a):
            if cnt[p] >= 1:
                return False
            cnt[p] += 1
    return True

if not isSetwise(A):
    print('not coprime')
elif isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')


### FIXED CODE ###

from math import gcd

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

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1
from collections import Counter

def createPrimeList(N):
    isPrime = [True] * (N + 1)
    isPrime[0] = False
    isPrime[1] = False
    smallestPrime = [1] * (N + 1)
    for i in range(2, N + 1):
        if not isPrime[i]:
            continue
        for p in range(i * 2, N, i):
            if isPrime[p]:
                smallestPrime[p] = i
            isPrime[p] = False
    return smallestPrime

from collections import Counter
smallestPrime = createPrimeList(max(A) + 10)
def primeFactorization(N):
    ret = Counter()
    while N > 1:
        p = smallestPrime[N]
        if p == 1:
            ret[N] += 1
            break
        ret[p] += 1
        N //= p
    return ret

def isPairwise(A):
    P = Counter()
    for a in A:
        for p in primeFactorization(a):
            if P[p] >= 1:
                return False
            P[p] += 1
    return True

if not isSetwise(A):
    print('not coprime')
    exit()

if isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')
s=input()
n=len(s)
for i in range((n+1)//2):
    if s[2*i]=="L":
        print("No")
        exit()
for j in range(n//2):
    if s[2*i+1]=="R":
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

s=input()
n=len(s)
p=0
for i in range(n):
  if i%2==0:
    if s[i]=="L":
      p=1
  else:
    if s[i]=="R":
      p=1
if p==0:
  print("Yes")
else:
  print("No")
X, A = map(int, input().split())

if X < A:
  print(0)
else:
  pfint(10)

### FIXED CODE ###

X, A = map(int, input().split())

if X < A:
  print(0)
else:
  print(10)
import sys
from collections import defaultdict

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()


class UnionFind:
    def __init__(self, size):
        self.par = [i for i in range(size)]
        self.rk = [0] * size

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rk[x] < self.rk[y]:
            self.par[x] = y
        elif self.rk[x] > self.rk[y]:
            self.par[y] = x
        else:
            self.par[x] = y
            self.rk[y] += 1


N, M, K = map(int, input().split())
uf = UnionFind(N)
friend = defaultdict(set)
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    uf.unite(a, b)
    friend[a].add(b)
    friend[b].add(a)

block = defaultdict(set)
for _ in range(K):
    c, d = map(lambda x: int(x) - 1, input().split())
    block[c].add(d)
    block[d].add(c)

group = defaultdict(set)
for i in range(N):
    group[uf.find(i)].add(i)

ans = [0] * N
for people in group.values():
    for p in people:
        ans[p] = len(people) - 1 - sum(1 if i in people else 0 for i in friend[p]) - sum(1 if i in people else 0 for i in block[p])

print(' '.join(ans))




### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()


class UnionFind:
    def __init__(self, size):
        self.par = [i for i in range(size)]
        self.rk = [0] * size

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rk[x] < self.rk[y]:
            self.par[x] = y
        elif self.rk[x] > self.rk[y]:
            self.par[y] = x
        else:
            self.par[x] = y
            self.rk[y] += 1


N, M, K = map(int, input().split())
uf = UnionFind(N)
friend = defaultdict(set)
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    uf.unite(a, b)
    friend[a].add(b)
    friend[b].add(a)

block = defaultdict(set)
for _ in range(K):
    c, d = map(lambda x: int(x) - 1, input().split())
    block[c].add(d)
    block[d].add(c)

group = defaultdict(set)
for i in range(N):
    group[uf.find(i)].add(i)

ans = [0] * N
for people in group.values():
    for p in people:
        ans[p] = len(people) - 1 - sum(1 if i in people else 0 for i in friend[p]) - sum(1 if i in people else 0 for i in block[p])

print(' '.join(map(str, ans)))
import sys

MAX = 1000000


def digit_sum(n, b):
    if n == 0:
        return 0
    else:
        return digit_sum(n // b, b) + n % b


def main():
    n = int(input())
    s = int(input())

    if n < s:
        print(-1)
        sys.exit()

    ans = -1

    for b in range(2, min(n + 1, MAX) + 1):
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if not ans == -1:
        print(ans)
        sys.exit()

    if n + 1 <= MAX:
        print(-1)
        sys.exit()

    for p in reversed(range(MAX)):
        if (n - s) % p != 0:
            continue
        b = (n - s) // p + 1
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

MAX = 1000000


def digit_sum(n, b):
    if n == 0:
        return 0
    else:
        return digit_sum(n // b, b) + n % b


def main():
    n = int(input())
    s = int(input())

    if n < s:
        print(-1)
        sys.exit()

    ans = -1

    for b in range(2, min(n + 1, MAX) + 1):
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if ans != -1:
        print(ans)
        sys.exit()

    if n + 1 <= MAX:
        print(-1)
        sys.exit()

    for p in reversed(range(1, MAX)):
        if (n - s) % p != 0:
            continue
        b = (n - s) // p + 1
        if b < 2:
            continue
        sm = digit_sum(n, b)
        if sm == s:
            ans = b
            break

    if ans != -1:
        print(ans)
        sys.exit()

    if n == s:
        print(n+1)
        sys.exit()

    print(-1)


if __name__ == '__main__':
    main()
s = input()
flag = 1
for i in range(1, n):
    if s[i - 1] == s[i]:
        flag = 0
if flag:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
flag = 1
n = len(s)
for i in range(1, n):
    if s[i - 1] == s[i]:
        flag = 0
if flag:
    print('Good')
else:
    print('Bad')
from collections import deque
N = int(input())
A = deque(sorted([int(input()) for i in range(N)]))

X = deque([A.popleft()])
ans = 0
for i in range(N - 1):
    # Aのどちらから取り出してXのどちらに入れるか
    left_left = abs(X[0] - A[0])
    left_right = abs(X[-1] - A[0])
    right_left = abs(X[0] - A[-1])
    right_right = abs(X[-1] - A[-1])

    if left_left >= max(left_right, right_left, right_right):
        ans += left_left
        X.appendleft(A.popleft())

    elif left_right >= max(left_left, right_left, right_right):
        ans += left_right
        X.append(A.popleft())

    elif right_left >= max(left_left, left_right, right_right):
        ans += right_left
        X.appendleft(A.pop())

    else:
        ans += right_right
        X.appendleft(A.pop())

print(ans)


### FIXED CODE ###

from itertools import combinations
N = int(input())


# kC2を満たすもののみ構築可能
creatable = []
for n in range(1, N + 1):
    num = n * (n + 1) // 2
    if num > N:
        break
    creatable.append(num)


# 構築不可能
if N not in creatable:
    print('No')
    exit()


# 部分集合の数
K = creatable.index(N) + 2
ans = [[] for i in range(K)]
for n, (c1, c2) in enumerate(combinations(range(K), 2), start=1):
    ans[c1].append(n)
    ans[c2].append(n)


# 出力
print('Yes')
print(K)
for a in ans:
    print(len(a), ' '.join(map(str, a)))
N = int(input())
k = 1
n = 0
while n < N:
    n += k
    k += 1
if n!=N:
    print('No')
    exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k-1):
    for j in range(i+1,k):
        ans[i].append(v)
        ans[j].append(v)
        v += 1
for row in ans:
    print(len(row),*row)


### FIXED CODE ###

a = input()
if len(a) == 2:
  print(a)
else:
  print(a[::-1])
a=input()
print(a**3)


### FIXED CODE ###

a=input()
print a**3
import sys
input = sys.stdin.readline

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

XOR=0
for a in A:
    XOR^=a

for i in range(N):
    A[i] &=~XOR
    
USED=[0]*60

for bi in range(60,-1,-1):
    for i in range(N):
        if USED[i]==0 and A[i] & (1<<bi)!=0:
            USED[i]=1
            useind=i
            break
    else:
        continue

    for i in range(N):
        if i==useind:
            continue
        if A[i] & (1<<bi)!=0:
            A[i]^=A[useind]
            print(A[i],A[useind])
            
ANS=0
for a in A:
    ANS^=a

print(2*ANS+XOR)


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

XOR=0
for a in A:
    XOR^=a

for i in range(N):
    A[i] &=~XOR
    
USED=[0]*N

for bi in range(60,-1,-1):
    for i in range(N):
        if USED[i]==0 and A[i] & (1<<bi)!=0:
            USED[i]=1
            useind=i
            break
    else:
        continue

    for i in range(N):
        if i==useind:
            continue
        if A[i] & (1<<bi)!=0:
            A[i]^=A[useind]
            
ANS=0
for a in A:
    ANS^=a

print(2*ANS+XOR)
from collections import Counter
N = int(input())
A = []
for i in range(N):
  A.append(input())
C= Counter(A)
B = 0
for v in c.values():
  B = max(B,v)
ans = []
for k, v in c.items():
  if v == B:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

### FIXED CODE ###

from collections import Counter
N = int(input())
A = []
for i in range(N):
  A.append(input())
C= Counter(A)
B = 0
for v in C.values():
  B = max(B,v)
ans = []
for k, v in C.items():
  if v == B:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')
I=lambda:[int(i)for i in input().split()]
n,m=I()
P=I()
D={i:-1 for i in range(n)}
def U(x):
  if D[x]<0:
    D[x]=U(D[x])
  return D[x]
for _ in [0]*m:
  x,y=I()
  if D[U(x-1)]>D[U(y-1)]:
  	D[U(x-1)]=U(y-1)
  elif D[U(x-1)]<D[U(y-1)]:
    D[U(y-1)]=U(x-1)
  else:
    D[U(x-1)]-=1
    D[U(y-1)]=U(x-1)
print(sum(U(i)==U(p-1)for i,p in enumerate(P)))





### FIXED CODE ###

from collections import defaultdict
import sys
sdin = sys.stdin.readline

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
        else:
            self.par[ry] = rx
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)

    

        
N, M = map(int, sdin().split())
P = list(map(int, sdin().split()))
XY = []
for i in range(M):
    XY.append(list(map(int, sdin().split())))


root_node = defaultdict(list)

uf = UnionFind(N)
for x,y in XY:
    x -= 1
    y -= 1
    uf.unite(x,y)

for i in range(N):
    uf.find(i)
    
par = uf.par

for i,root in enumerate(par):
    root_node[root].append(i)
    
ans = 0
for node_list in root_node.values():
    num_list = []
    for i in node_list:
        num_list.append(P[i]-1)
    
    ans += len(set(node_list)&set(num_list))
            
print(ans)
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    tree[a-1].append((b-1, c))
    tree[b-1].append((a-1, c))
Q, K = map(int, input().split())

dist = [-1] * N
def dfs(v, total_cost):
    # v：頂点, total_cost：今までかかったコストの合計
    dist[v] = total_cost
    for v_next, cost in tree[v]:
        if dist[v_next] >= 0:
            continue
            # v_nextが訪問済みならスキップ
        dfs(v_next, total_cost+cost)

dfs(K-1, 0)

for i in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1] + dist[y-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    tree[a-1].append([b-1, c])
    tree[b-1].append([a-1, c])
Q, K = map(int, input().split())

dist = [-1] * N
def dfs(v, total_cost):
    # v：頂点, total_cost：今までかかったコストの合計
    dist[v] = total_cost
    for v_next, cost in tree[v]:
        if dist[v_next] >= 0:
            continue
            # v_nextが訪問済みならスキップ
        dfs(v_next, total_cost+cost)

dfs(K-1, 0)

for i in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1] + dist[y-1])
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]].sum()
#print(sb, sC)
print(sb+sC)

### FIXED CODE ###

import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]-1].sum()
#print(sb, sC)
print(sb+sC)
N = int(input())
S = str(input())

count = 0
for i in range(N):
  if i == "ABC":
    count += 1
print("%d"%(count)    

### FIXED CODE ###

n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i:i+3] == 'ABC':
    ans += 1
print(ans)
N=int(input())
A=sorted([int(input()) for _ in range(N)])

tot=sum(A)
if tot%10!=0:
    print(tot)
    sys.exit()
else:
    for i in range(N):
        if A[i]%10!=0:
            print(tot-A[i])
            sys.exit()
print(0)



### FIXED CODE ###

import sys
N=int(input())
A=sorted([int(input()) for _ in range(N)])

tot=sum(A)
if tot%10 != 0:
    print(tot)
    sys.exit()
else:
    for i in range(N):
        if A[i]%10 != 0:
            print(tot-A[i])
            sys.exit()
print(0)
w,a,b=map(int,input().split())
print(min(abs(a+w-B),abs(b+w-a)))

### FIXED CODE ###

W, a, b = map(int, input().split())
r = min(a,b)
l = max(a,b)
print(0 if (r+W)>=l else l-(r+W))
atcoder-tools: The pre-rendered templates are not found.#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()
def main():
    import sys
    input = sys.stdin.readline
    
    R,C,N = map(int,input().split())
    P = []
    X = {0,R}
    Y = {0,C}
    M = 0
    for i in range(N):
        x1,y1,x2,y2 = map(int,input().split())
        if (x1 in X or y1 in Y) and  (x2 in X or y2 in Y):
            if y1==0:
                L1 = x1
            elif x1==R:
                L1 = R+y1
            elif y1==C:
                L1 = 2*R + C - x1
            else:
                L1 = 2*(R+C) - y1
            
            if y2==0:
                L2 = x2
            elif x2==R:
                L2 = R+y2
            elif y2==C:
                L2 = 2*R + C - x2
            else:
                L2 = 2*(R+C) - y2
                
            P.append([min(L1,L2), max(L1,L2)])
    print("AAA")
    P = sorted(P, key = lambda a:a[0])
    M = len(P)
    
    flag = 0
    Q = []
    for i in range(M):
        x1,x2 = P[i]
        if Q == []:
            Q.append([x1,x2])
        else:
            while Q[-1][1] < x1 and Q!=[]:
                Q.pop()
            if Q==[]:
                Q.append([x1,x2])
            else:
                y1,y2 = Q[-1]
                if y2 < x2:
                    flag = 1
                    break
                else:
                    Q.append([x1,x2])
    if flag == 1:
        print("NO")
    else:
        print("YES")
    
main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    
    R,C,N = map(int,input().split())
    P = []
    X = {0,R}
    Y = {0,C}
    M = 0
    for i in range(N):
        x1,y1,x2,y2 = map(int,input().split())
        if (x1 in X or y1 in Y) and  (x2 in X or y2 in Y):
            if y1==0:
                L1 = x1
            elif x1==R:
                L1 = R+y1
            elif y1==C:
                L1 = 2*R + C - x1
            else:
                L1 = 2*(R+C) - y1
            
            if y2==0:
                L2 = x2
            elif x2==R:
                L2 = R+y2
            elif y2==C:
                L2 = 2*R + C - x2
            else:
                L2 = 2*(R+C) - y2
                
            P.append([min(L1,L2), max(L1,L2)])
    P = sorted(P, key = lambda a:a[0])
    M = len(P)
    
    flag = 0
    Q = []
    for i in range(M):
        x1,x2 = P[i]
        if Q == []:
            Q.append([x1,x2])
        else:
            while Q!=[] and Q[-1][1] < x1:
                Q.pop()
            if Q==[]:
                Q.append([x1,x2])
            else:
                y1,y2 = Q[-1]
                if y2 < x2:
                    flag = 1
                    break
                else:
                    Q.append([x1,x2])
    if flag == 1:
        print("NO")
    else:
        print("YES")
    
main()
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    while sum([True for i in a if i > 1]) > 1:
        min_mon = min(a)
        idx = a.index(min_mon)
        a = [mon if i == idx else mon % min_mon for i, mon in enumerate(a)]
    print(sum(a))


if __name__ == "__main__":
    solve()


### FIXED CODE ###

from functools import reduce
import math
import fractions


def solve():
    n = int(input())
    a = list(map(int, input().split()))
    return reduce(fractions.gcd, a)


if __name__ == "__main__":
    print(solve())
N,K = map(int,input().split())
int tmp = 0
 
while:
	tmp = N
	if(abs(tmp - K) < tmp):
      	tmp = abs(tmp - K)
   	else:
      	break
 	
print(tmp)

### FIXED CODE ###

import math

N,K = map(int,input().split())
tmp = N%K

while True:
  if abs(tmp - K) < tmp:
    tmp = abs(tmp - K)
  else:
    break
 	
print(tmp)
N=int(input())
A=[int(x)for x in input().split()]
B=[]
p = 10 ** 9 + 7
if N%2==0:
    B= sorted([2*i-1 for i in range(1,N//2+1)]*2)
    if sorted(A)==B:
        ans=(pow(2,N/2))%(10 ** 9 + 7)
    else:
        ans=0
else:
    B= [0]+sorted([2*i for i in range(1,N//2+1)]*2)
    if sorted(A)==B:
        ans=(pow(2,N/2))%(10 ** 9 + 7)
    else:
        ans=0
print(int(ans))
 


### FIXED CODE ###

mod = 10**9 + 7
n = int(input())
a = sorted(list(map(int,input().split())))
 
if n % 2 == 0:
  for i in range(n//2):
    if not a[2*i] == a[2*i+1] == 2*i+1:
      print(0)
      exit()
else:
  if a[0] != 0:
    print(0)
    exit()
  for i in range(n//2):
    if not a[2*i+1] == a[2*i+2] == 2*i+2:
      print(0)
      exit()
print(pow(2, n//2) % mod)
lst=input().split()
x=int(lst[0])



### FIXED CODE ###

lst=input().split()
lst=list(map(lambda i:float(i),lst))
x_1=lst[0]
x_2=lst[1]
y_1=lst[2]
y_2=lst[3]
dis=((x_1-y_1)**2+(x_2-y_2)**2)**(1/2)
print(dis)
n=int(input())
print((n*(n-1))/2)


### FIXED CODE ###

s,t=input(),input() 
print((s[0]==t[0])+(s[1]==t[1])+(s[2]==t[2]))
#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in ramge(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()

### FIXED CODE ###

#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in range(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()
5 2 3

### FIXED CODE ###

import sys
n, a, b = map(int, sys.stdin.readline().split())
c = b - a
if c % 2:
  d = min(a - 1, n - b)
  e = 1
  f = (b - a - 1) // 2
  print(d + e + f)
else:
  print(c // 2)
S, W = int(input())

if S < W:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

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

if S <= W:
    print("unsafe")
else:
    print("safe")
s = str(input())

if str.count(s[0]) == str.count(s[1]) == str.count(s[2]) == str.count(s[3]) == 2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

s = input()

s1 = s[0]
if s.count(s1) == 2:
    s = s.replace(s1, "")
    s2 = s[0]
    if s.count(s2) == 2:
        print('Yes')
    else:
        print('No')

else:
    print('No')
s=int(input())
li=[s]
for i in range(1000000):
  if s%2==0:
    s=s//2
  else:
    s=3*s+1
  if s in li:
    print(i+2)
    break
  li.append(s)


### FIXED CODE ###

ab,bc,ca=map(int,input().split())
print(ab*bc//2)