jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension [String] {
//    func joined() -> String {
//        return self.joinWithSeparator("")
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let N = readInt()!
let S = readLine()!.toArray()
let alphabet = "abcdefghijklmnopqrstuvwxyz".toArray()
var ans = [Int](repeating: 0, count: N-1)

for i in 1..<N {
    for c in alphabet {
        var left = false
        var right = false
        for j in 0..<i {
            if S[j] == c {
                left = true
            }
        }
        for j in 1..<N {
            if S[j] == c {
                right = true
            }
        }
        if left && right {
            ans[i-1] += 1
        }
    }
}

print(ans.max())
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension [String] {
//    func joined() -> String {
//        return self.joinWithSeparator("")
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let N = readInt()!
let S = readLine()!.toArray()
let alphabet = "abcdefghijklmnopqrstuvwxyz".toArray()
var ans = [Int](repeating: 0, count: N-1)

for i in 1..<N {
    var left = false
    var right = false
    for c in alphabet {
        for j in 0..<i {
            if S[j] == c {
                left = true
            }
        }
        for j in 1..<N {
            if S[j] == c {
                right = true
            }
        }
        if left && right {
            ans[i-1] += 1
        }
    }
}

print(ans.max())
//  [typescript]
import { ifError } from "assert";

const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1];}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const objvs =(a)=>{const b=[];for(const v in a){b.push(a[v])}return b};
const main=()=>{
  let n=tn()
  let s=ts().split('')
  let ans=0
  for(let i=1;i<n-1;i++){
    let t={}
    for(let j=0;j<i;j++){
      for(let k=i;k<n;k++){
        if(s[j]==s[k])t[s[j]]=true
      }
    }
    ans=max(Object.keys(t).length,ans)
  }
  to(ans)
}
main()
//  [typescript]
'use strict'

function main(input) {
  input = input.trim().split('\n')
  // .map(v => v.split(''))

  const n = Number(input[0])
  const str = input[1].split('')
  let max = 0
  for (let i = 1; i < n; i++) {
    const a = str.slice(0, i)
    const b = str.slice(i)
    const set = {}

    a.forEach(el => {
      set[el] = el
    })
    let tmp = 0
    Object.keys(set).forEach(el => {
      // console.log(el)
      if (b.find(v => v == el)) tmp++
    })
    max = Math.max(tmp, max)
  }
  console.log(max)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
import * as fs from 'fs';

const input = (fs.readFileSync('/dev/stdin', 'utf8') as string).split('\n');

const N = +input[0];
const S = input[1];

const ans = {
  x: 0,
  y: 0,
  index: -1,
};
let maxCnt = 0;
for (let i = 0; i < N; i++) {
  const set = new Set();
  let cnt = 0;
  const x = S.substr(0, i);
  const y = S.substr(i);
  for (const c of x) {
    set.add(c);
  }
  for (const c of y) {
    if (set.has(c)) {
      set.delete(c);
      cnt += 1;
    }
  }
  maxCnt = Math.max(maxCnt, cnt);
}
console.log(maxCnt);
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [n, s] = stdin.split('\n')

const getCount = (sSet, lSet) => {
  const lArr = [...lSet]

  return lArr.filter(v => sSet.has(v)).length
}

const ans = _ => {
  const strArr = s.split('')

  let count = 0
  for (let i = 1; i < n; i++) {
    const firstHalf = strArr.slice(0, i)
    const lastHalf = strArr.slice(i)

    const fSet = new Set(firstHalf)
    const lSet = new Set(lastHalf)

    let tmpCount = 0
    if (fSet.size < lSet.size) {
      tmpCount = getCount(fSet, lSet)
    } else {
      tmpCount = getCount(lSet, fSet)
    }

    count = Math.max(tmpCount, count)
  }

  console.log(count)
}

ans()
//  [typescript]
import * as fs from 'fs';

const input = (fs.readFileSync('/dev/stdin', 'utf8') as string).split('\n');

const N = +input[0];
const S = input[1];

const ans = {
  x: 0,
  y: 0,
  index: -1,
};
let maxCnt = 0;
for (let i = 0; i < N; i++) {
  const set = new Set();
  let cnt = 0;
  const x = S.substr(0, i);
  const y = S.substr(i);
  for (const c of x) {
    set.add(c);
  }
  for (const c of y) {
    if (set.has(c)) {
      cnt += 1;
    }
  }
  maxCnt = Math.max(maxCnt, cnt);
}
console.log(maxCnt);
//  [typescript]
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/* eslint-env es6, mocha, node */
/* eslint-extends: eslint:recommended */
'use strict';



// Import modules
import fs = require("fs");


// Read stdin
const data = fs.readFileSync("/dev/stdin", "utf-8").split("\n").filter((v) => !!v);

// Main
let result = 0;
for (let i = 1; i < data[0].length; ++i) {
    const left = Array.from(new Set(data[0].substring(0, i))).reduce((collection: {[index: string]: number}, char: string) => {
        collection[char] = 1;

        return collection;
    }, {});
    const max = Array.from(new Set(data[0].substring(i))).reduce((collection: number, char: string) => {
        if (char in left) {
            collection = collection + 1;
        }

        return collection;
    }, 0);

    result = (result > max) ? result : max;
}


// Output
console.log(result);



/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
//  [python]
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k]))
//  [python]
n,k=list(map(int, input().split()))
p=list(map(int, input().strip().split()))
new_p=sorted(p)
ans = 0
for num in range(k):
  ans+=new_p[num]
print(ans)
//  [python]
input_list = list(map(int, input().split()))
n, k = input_list
input_list = list(map(int, input().split()))
p_list = sorted(input_list)

print(sum(p_list[:k]))
//  [python]
N,K = map(int,input().split())

p=list(map(int,input().split()))

p.sort()
print(p)

sum = 0

for i in range(K):
    print(i)
    sum += p[i]
    
    
print(sum)
//  [python]
N,K = map(int,input().split())
fruit = [int(i) for i in input().split()]

fruit.sort()
price = 0
for i in range(N) :
    if i>2 :
        break
    price += fruit[i]
    
print(price)
//  [python]
N,K = map(int,input().split())
fruit = [int(i) for i in input().split()]

fruit.sort()
price = 0
for i in range(N) :
    if i>3 :
        break
    price += fruit[i]
    
print(price)
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] prices = new int[n];
    for(int i = 0; i < n; i++){
      prices[i] = sc.nextInt();
    }
    Arrays.sort(prices);
    int ans = 0;
    for(int i = 0; i < k; i++){
      ans += prices[i];
    }

    System.out.println(ans);
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}
//  [java]


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tokenizer = null;
    int totalCases, testNum;

    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    void solve() throws IOException {

    }

    void execute() throws IOException {
        int n = ni();
        int k = ni();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = ni();
        }
        Arrays.sort(arr);
        int res = 0;
        for (int i = 0; i < k; i++) {
            res += arr[i];
        }
        out.println(res);
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().execute();
    }

    void debug(Object... os) {
        System.out.println(Arrays.deepToString(os));
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String ns() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(br.readLine());
        }
        return tokenizer.nextToken();
    }

    String nline() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    boolean input() throws IOException {
        return true;
    }

}
//  [java]
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int K=sc.nextInt();
    int sum=0;
    int X[]=new int[N];
    Arrays.sort(X);
    for (int i=0; i<K; i++) {
    	sum += X[i];
    }
    System.out.println(sum);
  }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] A = new int[N];
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
        }
        int res;
        Arrays.sort(A);
        for(int i=0; i<K; i++){
            res += A[i];
        }
        System.out.println(res);
        }
    }
//  [java]
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] y = new int[n];
        int ans=0;
        
        for(int i=0; i<n; i++){
            y[i] = sc.nextInt();
        }
        
        Arrays.sort(y);
        for(int i=0; i<3; i++){
            ans+=y[i];
        }
        
        System.out.println(ans);
   }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N, K; cin >> N >> K;
    vector<i64> P(N);
    REP(i, N) cin >> P[i];
    sort(P.begin(), P.end());
    i64 ans = 0;
    REP(i, K) ans += P[i];
    cout << ans << endl;

    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,f;
    cin>>n>>f;
    int ar[n];
    for(int i=0; i<n; i++)cin>>ar[i];
    sort(ar,ar+n);
    int s = 0;
    for(int i=0; i<f; i++)s+=ar[i];
    cout<<s;
}
//  [cpp]
#include <iostream>

using namespace std;
int p[10001],price,c;

int main()
{
    int n,k;
    cin>>n>>k;
    for (int i=0; i<n; i++) {
        cin >> price;
        p[price]++;
    }
    price=0;
    while (k!=0){
        price++;
        for (;p[price]!=0; p[price]--,c+=price,k--)
            if (k==0)
                break;
    }
    cout<<c;
    return 0;
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N, K, input;
  cin >> N >> K;
  vector<int> prices;
  for (int i = 0; i < N; ++i) {
  	cin >> input;
    prices.push_back(input);
  }
  sort(prices.begin(), prices.end());
  int cost = 0;
  for (int i = 0; i < K; ++i)
    cost += prices[i];
  cout << prices;
  return 0;
}
//  [cpp]
#include <algorithm>
#include <iostream>
#include <vector>
#include <string> 
#include <set>
typedef long long ll;
using namespace std;

int arr[1007];
int main() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    cout << arr[0] + arr[1] + arr[2] << endl;



    return 0;
}
//  [cpp]
#include <iostream>
#include<array>
using namespace std;

int main() {
    // Input
    int n, k, sum;
    cin >> n >> k;
    int p[n];
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }

    // Bubble sort
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n-1; j++) {
            if (p[j] > p[j+1]) {
                swap(p[j], p[j+1]);
            }
        }
    }

    // Output
    for(int i = 0; i < k; i++) {
        sum += p[i];
    }

    cout << sum << endl;
}
//  [c]
#include<stdio.h>

void selectionSort(int *, int);

int main()
{
  int n, k;
  scanf("%d %d", &n, &k);
  
  int p[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }
  
  selectionSort(p, n);
  
  int sum = 0;
  for (int i = 0; i < k; i++) {
    sum += p[i];
  }
  
  printf("%d\n", sum);
  
  return 0;
}

void selectionSort(int *p, int n)
{
  for (int i = 0; i < n; i++) {
    int minJ, minP = 1000;
    for (int j = i + 1; j < n; j++) {
      if (p[j] < minP) {
        minP = p[j];
        minJ = j;
      }
    }
    if (minP < p[i] ) {
      int tmpP = p[i];
      p[i] = minP;
      p[minJ] = tmpP;
    }
  }
}
//  [c]
#include <stdio.h>

int main(void){
 
    int entry_sell,entry_buy;
    int entry_tanka[1000];
    int i,j,min,sum,index;
    
    //入力
    scanf("%d",&entry_sell);
    scanf("%d",&entry_buy);
    
    for(i=0; i<entry_sell; i++){
        scanf("%d",&entry_tanka[i]);
    }
    
    sum=0;
    for(i=0;i<entry_buy; i++){
        
        //最小単価を探す
        min=entry_tanka[0];
        index=0;
        for(j=1; j<entry_sell;j++){
            if(entry_tanka[j]<min){
                min = entry_tanka[j];
                index=j;
            }
        }
        //tanka[index]が最小なので買う
        sum = sum+min;
        for(j=index; j<entry_sell; j++){
            entry_tanka[j]=entry_tanka[j+1];
        }
        entry_tanka[entry_sell]='\0';
        entry_sell--;
    }
    
    printf("%d\n",sum);
    
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int compare_ints(const void* a, const void* b)
{
    int arg1 = *(const int*)a;
    int arg2 = *(const int*)b;
 
    if (arg1 < arg2) return -1;
    if (arg1 > arg2) return 1;
    return 0;
}

int	main(void)
{
  	int	n;
  	int k;
  	int	p[1001];
  	int	i;
  	int	sum;
  
  	scanf("%d %d\n", &n, &k);
  	for(i=0;i<n;i++)
    {
      	scanf("%d", &p[i]);
    }
  
  	qsort(p, n, sizeof(int), compare_ints);
  
  	sum = 0;
  	for(i=0; i<k; i++)
    {
      	sum += p[i];
    }
  	printf("%d", sum);
  	return (0);
}
//  [c]
#include<stdio.h>

int main(void){
  int n,k;
  scanf("%d %d",&n,&k);
  int p[n];
  for(int i=0;i<n;i++){
  scanf("%d",&p[i]);
  }
  int tmp;
  for (i=0; i<n; ++i) {
    for (j=i+1; j<n; ++j) {
      if (p[i] > p[j]) {
        tmp =  p[i];
        p[i] = p[j];
        p[j] = tmp;
      }
    }
  }
  int c=0;
  
  for(int i=0;i<k;i++){
    c+=p[i];
  }
  printf("%d\n",c);
return 0;
}
//  [c]
#include<stdio.h>
int main(void)
{
	int n,p[1001],k,i,j,x,b;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
	scanf("%d",&p[i]);
	}
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(p[i]>p[j]){
				x=p[i];
				p[i]=p[j];
				p[j]=x;
			}
		}
	}
	for(i=0;i<k;i++){
		b+=p[i];
	}
	printf("%d\n",b);
	return 0;
}
//  [javascript]
"use strict";

function main(input) {
  input = input.trim().split("\n");
  const line_one = input[0].split(" ");
  const line_two = input[1].split(" ");

  for (const i in line_two) {
    line_two[i] = parseInt(line_two[i]);
  }

  let ans = 0;
  line_two.sort(f);
  for (let i = 0; i < line_one[1]; i++) {
    ans = ans + line_two[i];
  }
  console.log(ans);
}
var f = function (a, b) {
  return a - b;
};

main(require("fs").readFileSync("/dev/stdin", "utf-8"));
//  [javascript]
function Main(input) {
  var s = input.split('\n')[0].split(" ")[1];
  var p = input.split('\n')[1].split(" ").map(el => parseInt(el)).sort(
    function(a,b){return a<b?-1:a>b?1:0;
  });
  console.log(p.slice(0,s).reduce((sum,cV)=>sum+cV))
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  const [n, k] = input[0].trim().split(" ").map(i => parseInt(i));
  const p = input[1].trim().split(" ").map(i => parseInt(i)).sort(function(a, b) {return a - b;});

  const sum  = function(arr) {
    return arr.reduce(function(prev,current,i,arr) {return (i<k)?(prev+current):(prev)});
  };
  console.log(sum(p));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
//  [javascript]
"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const [n, k] = spi[0].split(' ').map(e => parseInt(e));
    const p = spi[1].split(' ').map(e => parseInt(e));

    p.sort(function(a, b){
        return a - b;
    });

    let ans = 0;
    for (let i = 0; i < k; i++) {
        console.log(p[i]);
        ans += p[i];
    }

    console.log(ans);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	input = input.split("\n");
	let n = input[0].split(" ")[0];
	let k = input[0].split(" ")[1];
	let arr = input[1].split(" ").map(el => parseInt(el));
	arr.sort();
  	let ans = 0;
	for(let i=0;i<min(arr.length,k);i++)
		ans+=arr[i];
  	
  	console.log(ans);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	input = input.split("\n");
	let n = input[0].split(" ")[0];
	let k = input[0].split(" ")[1];
	let arr = input[1].split(" ").map(el => parseInt(el));
	arr.sort();
  	let ans = 0;
	for(let i=0;i<arr.length;i++)
		ans+=arr[i];
  	
  	console.log(ans);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	N, K := ReadInt(), ReadInt()
	p := ReadInts(N)
	sort.Ints(p)
	ans := 0
	for i := 0; i < K; i++ {
		ans += p[i]
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n, k int
	con.Scan(&n, &k)
	p := make([]int, n)
	for i := 0; i < n; i++ {
		con.Scan(&p[i])
	}
	sort.Ints(p)
	s := 0
	for i := 0; i < k; i++ {
		s += p[i]
	}
	con.Println(s)
	return nil
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var p = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
	}
	sort.Ints(p)
	sum := 0
	for i := 0; i < k; i++ {
		sum += p[i]
	}
	println(sum)
}
//  [go]
package main

import (
  "fmt"
  "sort"
)

func main(){
  var K, N int
  p:=[100]int{}
  fmt.Scan(&K)
  fmt.Scan(&N)
  for i:=0;i<N;i++{
    fmt.Scan(&p[i])
  }
  sort.Slice(p, func(i, j int) bool { return p[i] < p[j] })
  sum:=0
  for j:=0,j<K;j++ {
    sum+=p[j]
  }
  fmt.Println(sum)
 
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	p := make([]int, n)
	for i := range p {
		fmt.Scan(&p[i])
	}

	sort.Ints(p

	var sum int
	for i := 0; i < k; i++ {
		sum += p[i]
	}

	fmt.Println(sum)
}
//  [ruby]
n, k = gets.chomp.split(" ").map(&:to_i)
P = gets.chomp.split(" ").map(&:to_i)

P.sort!
puts P[0,k].sum
//  [ruby]
n, k = gets.split(" ").map(&:to_i)
p = gets.split(" ").map(&:to_i).sort
puts p[0..k-1].sum
//  [ruby]
N, K = gets.split.map(&:to_i)
P = gets.split.map(&:to_i)
puts P.sort[0,K].sum
//  [ruby]
a,b=gets.chomp.split(" ").map(&:to_i)
c=gets.chomp.split(" ").map(&:to_i).sort
all=0
3.times do |i|
all+=c[i]
end
p all
//  [ruby]
N, K = gets.split.map(&:to_i)
fruits = gets.split.map {|p| p.to_i }.sort
puts fruits[0..K].inject(0){|result, sum| result + sum }
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        mut p: [i32; n],
    }

    p.sort();
    let ans: i32 = p.iter().take(k).sum();

    println!("{}", ans);
}
//  [rust]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

// fn minus(a: Vec<isize>, b:Vec<isize>) -> Vec<isize> {
//     let mut z = vec![0,0,0];
//     for (i, (aval, bval)) in a.iter().zip(&b).enumerate() {
//         z[i] = aval - bval;
//     }
//     z
// }

fn main() {
    input! {
        // s: char
      n: usize,
      k: usize,
      p: [usize; n]
    }
    let mut p2 = p;
    let mut count = 0;
    p2.sort();
    for (idx, i) in p2.iter().enumerate(){
        if idx == k{
            break;
        }
        count += i;
    }
    println!("{}", count)
}
//  [rust]
use proconio::input;
use itertools::Itertools;

fn main() {
    input!{n: u16, k:  usize};
    input!(ps: [u16; n]);
    let res = ps.into_iter()
                .sorted()
                .take(k)
                .sum::<u16>();
    print!("{}", res);
}
//  [rust]
use text_io::*;fn main(){let n=read!();let k=read!();let mut v=Vec::new();for i in 0..n{let c=read!();v.push(c);}v.sort();let mut a=0;for i in 0..k{a+=v[i];}println!("{}",a)}
//  [rust]
use proconio::{fastout, input};
#[fastout]
fn main() {
  input! {N:u16,K:usize,mut p:[u16;N]}
  p.sort();
  println!("{}",p[0..K].iter().sum::<u16>());
}
//  [swift]
let input = readLine()!.split(separator: " ").map { Int($0)! }
let N = input[0]
let K = input[1]

let p = readLine()!.split(separator: " ").map { Int($0)! }
print(p.sorted().prefix(K).reduce(0, +))
//  [swift]
import Foundation
var o = 0
let arr=readLine()!.split{$0==" "}.map{Int(String($0))!}
let n=arr[0]
let a=arr[1]
var arr2=readLine()!.split{$0==" "}.map{Int(String($0))!}
arr2.sort()
for i in 0..<a {
   o += arr2[i]
}
print(o)
//  [swift]
import Foundation

var type: Int = Int(readLine()!)!
var min: Int = Int(readLine()!)!
var priceList: [Int] = []
var price = 0
var count = 0

while (count < type) {
    priceList.append(Int(readLine()!)!)
    count += 1
}

priceList.sort {$0 < $1}
for i in 0 ... min - 1 {
    price += priceList[i]
}

print(price)
//  [swift]
import Foundation

var type: Int = Int(readLine()!)!
var min: Int = Int(readLine()!)!
var priceList: [Int] = []
var price = 0

for _ in 0 ..< type {
    priceList.append(Int(readLine()!)!)
}

priceList.sort {$0 < $1}
for j in 0 ... min - 1 {
    price += priceList[j]
}

print(price)
//  [swift]
import Foundation

var type: Int = Int(readLine()!)!
var min: Int = Int(readLine()!)!
var priceList: [Int] = []
var price = 0

for i in 0 ..< type {
    priceList.append(Int(readLine()!)!)
}

priceList.sort {$0 < $1}
for j in 0 ... min - 1 {
    price += priceList[j]
}

print(price)
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, K] = input[0].map(Number);
  const prices = input[1].map(Number).sort((a, b) => a - b);

  const buy = prices.slice(0, K);

  return buy.reduce((result, cur) => {
    return result + cur;
  }, 0);
};

console.log(main(read()));
//  [typescript]
import * as fs from "fs";

// inputで受け取り配列化する
const input = fs.readFileSync("/dev/stdin", "utf8").split("\n");

const [N, K] = input[0].split(" ");

const prices = input[1].split(" ").map(Number);

prices.sort((a, b) => a - b);

let sum = 0;

for (let index = 0; index < Number(K); index++) {
  sum += prices[index];
}

console.log(sum);
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n, k]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const p: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    return `${p.slice(0, n).sort((a, b) => a - b).slice(0, k).reduce((acc, a) => acc + a, 0)}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
const main = (input: string) => {
    const inputs: string[] = input.split('\n');
    const [N, K] = inputs[0].split(' ').map(x => parseInt(x));
    const fruits = inputs[1].split(' ').map(x => parseInt(x));

    fruits.sort((a, b) => (
        a - b
    ));
    console.log(fruits[0] + fruits[1] + fruits[2]);
};
// 標準入力
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import * as fs from 'fs';
 
const input = fs.readFileSync("/dev/stdin", "utf8");
 
const [, kindsToBuy, ...prices] = input.split(/\s/g).map(i => parseInt(i, 10));
const lowestPrices = prices.sort((a, b) => a >= b ? 1 : -1).slice(0, kindsToBuy);
const totalPrice = lowestPrices.reduce((acc, crr) => acc+crr, 0);
console.log(totalPrice);
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8");

const [, kindsToBuy, ...prices] = input.split(/\s/g).map(i => parseInt(i, 10));
const lowestPrices = prices.slice().sort((a, b) => a >= b ? 1 : -1).slice(0, kindsToBuy);
const totalPrice = lowestPrices.reduce((acc, crr) => acc+crr, 0);
console.log(totalPrice);
//  [python]
s,w = map(int,input().split())

if s <= w:
    print('unsafe')
else:
    print('safe')
//  [python]
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

s, w =ISI()
if s>w:
	print("safe")
else:
	print("unsafe")
//  [python]
s, w = map(int, input().split())
if s > w:
    print('safe')
else:
    print('unsafe')
//  [python]
s = int(input())
w = int(input())
if(w >= s):
    print("unsafe")
else:
    print("safe")
//  [python]
import Control.Monad

main = do
    xs <- (map read . words) <$> getLine :: IO [Int]
    let s = xs !! 0
        w = xs !! 1
    if s <= w then putStrLn "unsafe"
              else putStrLn "safe"
//  [java]
//package beginner164.a;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(long testNumber, InputReader in, PrintWriter out) {
            int sheep = in.nextInt();
            int wolves = in.nextInt();
            if (wolves >= sheep) {
                out.println("unsafe");
            } else {
                out.println("safe");
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author EDGE
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASheepAndWolves solver = new ASheepAndWolves();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASheepAndWolves {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            out.println(in.nextInt() > in.nextInt() ? "safe" : "unsafe");
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
//  [java]
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a<b){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
        
   }
}
//  [java]
package saichan;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int S = sc.nextInt();
int W = sc.nextInt();
//コンソールに入力した数字を受け取る
if(S>W) {
	System.out.println("safe");
}else {
	System.out.println("unsafe");
}
}
}
//  [java]
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    ArrayList<String>ans  = new ArrayList<>();

    for(int i=0; i<n; i++) {
    	String s = sc.next();
    	if(!ans.contains(s)){		
    	      ans.add(s);
    	}
    }
    	System.out.println(ans.size());
      }
}
//  [cpp]
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <string>

int main() {
  int s, w;
  scanf("%d %d", &s, &w);

  if (s <= w) {
    puts("unsafe");
  } else {
    puts("safe");
  }
}
//  [cpp]
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(b>=a)	
		puts("unsafe");
	else
		puts("safe");
}
//  [cpp]
#include<cstdio>

int main()
{
	int s,w;
	scanf("%d %d",&s,&w);
	if ( w>=s )
	printf("unsafe\n");
	else
	printf("safe\n");
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    set<string>s;
 for(int i=0;i<n;i++)
 {
 string t;
 cin>>t;
 s.insert(t);
 }
 cout<<s.size()<<endl;
 return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,w;
    cin>>s,w;
    if(w>=s)
    cout<<"unsafe"<<endl;
    else
    cout<<"safe"<<endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,w;
    cin>>s,w;
    if(s>=w)
    cout<<"unsafe"<<endl;
    else
    cout<<"safe"<<endl;
    return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int s, w;
    scanf("%d %d", &s, &w);

    if (s > w)
        printf("safe\n");
    else
    {
        printf("unsafe\n");
    }

    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
	int S, W;
	scanf("%d %d", &S, &W);
	
	if(S>W) printf("safe");
	else printf("unsafe");
	
	return 0;
	
}
//  [c]
#include <stdio.h>
int main(void){
    int s,w;
    scanf("%d %d",&s,&w);
    if(w>=s)
        printf("unsafe");
    else
        printf("safe");
}
//  [c]
#include<stdio.h>
int main()
{ int s,w;
 scanf("%d %d", &s, &w);
if (s>0 && w>0 && s<=w)
 {printf ("Unsafe");}
else if (s>0 && w>0 && s>w)
{printf("Safe");}
 else
    {printf("Wrong input");}
 }
//  [c]
#include<stdio.h>
int main()
{ int s,w;
 scanf("%d %d", &s, &w);
if (s<=w)
 {printf ("Unsafe")};
else
{printf("Safe")};}
//  [c]
#include<stdio.h>
int main()
{ int s,w;
 scanf("%d %d", &s, &w);
if (s<=w)
 {printf ("Unsafe");}
else
{printf("Safe");}
}
//  [javascript]
"use strict";
const main = arg => {
  const input = arg.trim().split('\n');
  const arr = input[0].split(" ").map(Number);
	
  if(arr[0] <= arr[1]){
    console.log("unsafe");
  }else{
    console.log("safe");
  }
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {

	input = input.split(" ");
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
if (a>b){
	console.log( 'safe')
} else {
    console.log(  'unsafe')
}

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    var S = input.split(' ')[0];
    var W = input.split(' ')[1];
    if (S-W<=0) {
        console.log("unsafe");
    } else {
        console.log("safe");
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  const tmp = input.trim().split(' ')
  const s = parseInt(tmp[0], 10)
  const w = parseInt(tmp[1], 10)

  if (w > s) {
    console.log('unsafe')
  } else {
    console.log('safe')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
function Main(input) {
  const lines = input.split(' ');
  let sh = lines[0];
  let wol = lines[1];
  if ( sh > wol ) {
    console.log("safe");
  } else {
    console.log("unsafe");
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  const lines = input.split(' ');
  let sh = lines[0];
  let wol = lines[1];
  if ( sh > wol ) {
    console.log("safe");
  } else {
    console.log("unsafe");
  }
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc.Split(bufio.ScanWords)
	var S, W int
	nextInt(&S, &W)
	if W >= S {
		fmt.Printf("unsafe")
	} else {
		fmt.Printf("safe")
	}
}

const MAX_INT int = 1_000_000_000

var sc = bufio.NewScanner(os.Stdin)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)

func nextLine() string {
	buffer := make([]byte, 0)
	for true {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func nextInt(A ...*int) {
	L := strings.Split(nextLine(), " ")
	for i, a := range A {
		*a, _ = strconv.Atoi(L[i])
	}
}
func nextInts(A *[]int) {
	L := strings.Split(nextLine(), " ")
	(*A) = make([]int, len(L))
	for i, l := range L {
		(*A)[i], _ = strconv.Atoi(l)
	}
}

func nextInt64(A ...*int64) {
	L := strings.Split(nextLine(), " ")
	for i, a := range A {
		*a, _ = strconv.ParseInt(L[i], 0, 64)
	}
}

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const mod = 998244353
const facNum = 300001
const INF = 1001001001

func main() {
	sc := newScanner(os.Stdin)
	S,W := sc.i(), sc.i()
	if W >=S {
		fmt.Println("unsafe")
		
	}else {
		fmt.Println("safe")
	}
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}
//  [go]
package main

import "fmt"

func main() {
	var s, w int
	fmt.Scan(&s, &w)

	if s <= w {
		fmt.Println("unsafe")
	} else {
		fmt.Println("safe")
	}
}
//  [go]
package main

import "fmt"

func main(){
	var S, W int;
	fmt.Scan(&S, &W);

	if S < W {
		fmt.Println("unsafe");
	}else {
		fmt.Println("safe");
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var S int
	var W int
	fmt.Scan(&S)
	fmt.Scan(&W)

	if S > W {
		fmt.Println("unsafe")
	} else {
		fmt.Println("safe")
	}
}
//  [go]
package main
import "fmt"
func main() {
	var S int
    var W int
	fmt.Scan(&S,&W)
  
  if S<W {
    fmt.Println("safe")
  }else{
    fmt.Println("unsafe")
  }

}
//  [ruby]
a,b = gets.split.map(&:to_i)
if a<=b then
  puts "unsafe"
else
  puts "safe"
end
//  [ruby]
s,w = gets.split.map(&:to_i)
if s > w
  puts 'safe'
else
  puts 'unsafe'
end
//  [ruby]
s,w=gets.split.map(&:to_i)
puts w >= s ? 'unsafe' : 'safe'
//  [ruby]
s, w = gets.split.map(&:to_i)
puts w>=s ? : "unsafe" : "safe"
//  [ruby]
sw = gets.split(" ")
sw = sw.map { |a|
    a.to_i
}

puts(sw)
if sw[0] <= sw[1]
    puts("unsafe")
else
    puts("safe")
end
//  [ruby]
s = gets.to_i
w = gets.to_i
puts s <= w ? "unsafe" : "safe"
//  [rust]
use proconio::input;

fn main() {
    input! {
        s: u32,
        w: u32,
    }
    if s <= w {
        println!("unsafe");
    } else {
        println!("safe");
    }
}