jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
function Main(s){
  s = s.split("\n");
  var n = +s[0];
  s = s[1];
  var ans = 0;
  var m = 0;
  var x = "";
  var f = 1;
  for(var i = 1; i < n; i++){
    for(var j = 0; j < i; j++){
      for(var k = 0; k < x.length; k++){
        if(x[k] === s[j])f = 0;
      }
      if(f)
      for(var k = i; k < n; k++){
        if(s[j] === s[k]){
          x += s[j];
          m++;
          break;
        }
      }
      f = 1;
    }
    ans = Math.max(ans, m);
    m = 0;
    x = "";
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8").trim());
//  [go]
// きりみんちゃんの配信からきました
// こういう問題苦手（実装がめんどくさい）
// だるいので愚直でいいや
package main

import "fmt"

var n int
var s string

func main() {
	alphabets := []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
	fmt.Scan(&n, &s)
	ans := 0
	// 区切る場所で区切って左右のアルファベットの登場するか否かを数えて比較して両方にあったらインクリメントしてansと比較
	// あーだるい。。
	for i := 1; i < n-1; i++ {
		pre, epi := make(map[string]bool), make(map[string]bool)

		for j := 0; j < i; j++ {
			t := string([]rune(s)[j])
			if _, ok := pre[t]; !ok {
				pre[t] = true
			}
		}
		for j := i; j < n; j++ {
			t := string([]rune(s)[j])
			if _, ok := epi[t]; !ok {
				epi[t] = true
			}
		}
		tmp := 0
		for _, a := range alphabets {
			if pre[a] && epi[a] {
				tmp += 1
			}
		}
		ans = max(ans, tmp)
	}
	fmt.Println(ans)
}

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

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

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

//
// func nextInt() int {
// 	l := nextLine()
// 	i, e := strconv.Atoi(l)
// 	if e != nil {
// 		panic(e)
// 	}
// 	return i
// }

func main() {
	//sc.Split(bufio.ScanWords)
	_, S := nextLine(), nextLine()

	fmt.Printf("%d\n", ABC098B(S))
}

// ABC098B ...
func ABC098B(S string) (res int) {
	for i := 1; i < len(S)-1; i++ {
		chars, checked, cnt := map[string]bool{}, map[string]bool{}, 0
		for j := 0; j < len(S); j++ {
			c := string(S[j])
			if j < i {
				chars[c] = true
			} else {
				_, exists := chars[c]
				_, isChecked := checked[c]
				if exists && !isChecked {
					cnt++
				}
				checked[c] = true
			}
		}

		if res < cnt {
			res = cnt
		}
	}

	return
}
//  [ruby]
n = gets.chomp.to_i
s = gets.chomp
ans = 0
0.upto(n) do |i|
  count = 0
  as = []
  0.upto(i) do |j|
    if !as.include?(s.split("").at(j)) then
      as.push(s.split("").at(j))
    end
  end
  bs = []
  (i+1).upto(n) do |j|
    if !bs.include?(s.split("").at(j)) then
      bs.push(s.split("").at(j))
    end
  end
  as.each do |char|
    if bs.include?(char) then
      count += 1
    end
  end
  if ans < count then
    ans = count
  end
end
puts ans
//  [ruby]
def charSort(chr)
  retStr = ""
  chr.each_char { |c|
    if retStr.empty? then
      retStr = c
      next
    end
    for i in 0..(retStr.length - 1) do
      if retStr[i] > c then
        if i == 0 then
          retStr = c + retStr
        else
          retStr = retStr[0..(i-1)] + c + retStr[i..-1]
        end
        break
      else 
        if (i == retStr.length - 1) then
          retStr += c
        end
      end
    end
  }
  return retStr
end

N = STDIN.gets
S = STDIN.gets.chomp
count = 0

for i in 0..(S.length - 1) do
  tmpCount = 0
  a = charSort(S[0..i]).squeeze
  b = charSort(S[i+1..-1]).squeeze
  a.each_char { |ac|
    b.each_char { |bc|
      if ac == bc then
        tmpCount += 1
      end
    }
  }
  tmpCount
  if count < tmpCount then
    count = tmpCount
  end
end

p count
//  [ruby]
n = gets.to_s.to_i
s = gets.chomp

def left(s, i, c)
  i.times do |j|
    return true if s[j] == c
  end
  false
end

def right(s, i, c)
  i.upto(s.size - 1) do |j|
    return true if s[j] == c
  end
  false
end

ans = 0
n.times do |i|
  cnt = 0
  (?a..?z).to_a.each do |c|
    cnt += 1 if right(s,i,c) && left(s,i,c)
  end
  ans = cnt if ans < cnt
end

puts ans
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        s: Chars,
    }

    let mut ans = 0;
    for cut in 1..n {
        let mut alpha_front: Vec<usize> = vec![0;30];
        let mut alpha_back: Vec<usize> = vec![0;30];
        let mut cnt = 0;
        for i in 0..cut {
            alpha_front[(s[i] as usize) - ('a' as usize)] += 1;
        }
        for i in cut..n {
            alpha_back[(s[i] as usize) - ('a' as usize)] += 1;
        }
        for i in 0..30 {
            if alpha_front[i]!=0 && alpha_back[i]!=0 {
                cnt += 1;
            }
        }
        debug!(alpha_front);
        ans = max(ans, cnt);

    }
    println!("{}", ans);
}
//  [rust]
use proconio::marker::{Chars};
use proconio::input;
use std::collections::HashSet;

fn main() {
  input! {
    n: usize,
    s: Chars
  };
  
  let mut max: usize = 0;
  for i in 0..=n {
    
    let mut x: HashSet<char> = HashSet::new();
    for j in 0..i {
      x.insert(s[j]);
    }
    
    let mut y: HashSet<char> = HashSet::new();
    for j in i..n {
      y.insert(s[j]);
    }
    
    let intersection: HashSet<_> = x.intersection(&y).collect();
    let size = intersection.iter().count();
    if max < size {
      max = size;
    }
  }
  
  println!("{}", max);
}
//  [typescript]
import { readFileSync } from "fs";

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

const main = (input: string[][]) => {
  const N = Number(input[0][0]);
  const S = input[1][0];

  let answer = 0;

  for (let i = 2; i < N; i++) {
    const X = S.slice(0, i);
    const Y = S.slice(i);

    let count = 0;

    new Set(X.split("")).forEach((char) => {
      if (Y.includes(char)) {
        count += 1;
      }
    });

    answer = Math.max(count, answer);
  }

  return answer;
};

console.log(main(read()));
//  [typescript]
function Main(input: string) {
  const lines = input.split('\n');
  const params1 = lines[0].split(' ');
  const params2 = lines[1].split(' ');

  const n = parseInt(params1[0]);
  const s = params2[0];

  let cnt = 0;
  for (let i = 0; i < n; i++) {
    const s1 = s.slice(0, i);
    const s2 = s.slice(i);
    
    let set1 = new Set();
    s1.split('')
      .forEach(x => {
        set1.add(x)
      });
    let set2 = new Set();
    s2.split('').forEach(x => {
      set2.add(x)
    });

    let tmp = 0;
    set1.forEach(x => {
      if (set2.has(x)) tmp++;
    });

    cnt = Math.max(cnt, tmp);
  }
  
  console.log(cnt);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

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

const getCount = (ar1, ar2) => {
  const s1 = ar1.filter(e=>ar2.indexOf(e) > -1)
  const s2 = ar2.filter(e=>ar1.indexOf(e) > -1)

  const uniq = new Set([...s1], [...s2])

  return uniq.size
}

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)

    let tmpCount = getCount(firstHalf, lastHalf)

    count = Math.max(tmpCount, count)
  }

  console.log(count)
}

ans()
//  [python]
N,K = map(int, input().split())

plist =    [int(n) for n in input().split()]

import numpy as np

parray = np.array(plist)

sortp = np.sort(parray)

result = sortp[:K]

print(result.sum())
//  [python]
a = input().split(' ')
n, k = a
n, k = int(n), int(k)
ps = input().split(' ')
pf = []
for i in ps:
    t = int(i)
    pf.append(t)
pf = sorted(pf)
c = []
s = 0

for i in range(k):
    for j in range(n):
        if j in c:
            continue
        c.append(j)
        s += pf[j]
        break

print(s)
//  [python]
n, k = map(int, input().split())
p = list(map(int, input().split()))

q= sorted(p)

import numpy as np

r= np.cumsum(q)

print(r[k-1])
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String input = stdIn.nextLine();
        int n = Integer.parseInt(input.split(" ")[0]);
        int k = Integer.parseInt(input.split(" ")[1]);

        String P = stdIn.nextLine();
        int[] p = new int[n];
        for(int i = 0 ; i < n ; i++){
            p[i] = Integer.parseInt(P.split(" ")[i]);
        }
        Arrays.sort(p);
        int ans = 0;
        for(int i = 0 ; i < k ; i++){
            ans += p[i];
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    List<Integer> collect = list.stream().sorted().collect(Collectors.toList());
    int sum = 0;
    for (int i = 0; i < k; i++) {
      sum += collect.get(i);
    }
    System.out.println(sum);
  }
}
//  [java]
import java.util.*;
public class Main {
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int k = scan.nextInt();
	    ArrayList<Integer> list = new ArrayList<Integer>();
	    for(int i = 0; i < n; i++) {
	    	list.add(scan.nextInt());
	    }
	    int sum = 0;
	    for(int i= 0; i < k; i++) {
	    	Integer min = list.stream().mapToInt(v -> v).min().orElseThrow(NoSuchElementException::new);
	        list.remove(min);
	        sum += min;
	    }
	    System.out.println(sum);
	}
 
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  int K = 0;
  cin >> N >> K;
  vector<int> p(N + 1);
  for(int i = 0;i < N;i++){
    cin >> p.at(i);
  }
  for(int j = 0;j < N * N;j++){
    for(int i = 0;i < N;i++){
      if(p.at(i) > p.at(i + 1)){
        int a = p.at(i);
        p.at(i) = p.at(i + 1);
        p.at(i + 1) = a;
      }
    }
  }
  int sum = 0;
  for(int i = 0;i <= K;i++){
    sum += p.at(i);
  }
  cout << sum << endl;
}
//  [cpp]
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  int ans = 0;
  int MIN;
  rep(i, p.size()) {
    MIN = p[0];
    for (int j = 1; j < p.size(); ++j) MIN = min(MIN, p[j]);
    if (p[i] == MIN) {
      ans += p[i];
      p.erase(p.begin() + i);
      i = -1;
      if (p.size() == n - k) break;
    }
  }
  cout << ans << endl;

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

int main()
{
    int n,k,m;
    scanf("%d %d",&n,&k);
    int arr[k];
    
    for ( int i=0 ; i<k ; i++ ) {
        scanf("%d",arr+i);
    }
    
    for ( int i=0 ; i<(k-1) ; i++) {
        for ( int j=i+1 ; j<=(k-1) ; j++) {
            if ( arr[i] < arr[j]) {
                arr[i] = arr[i]^arr[j];
                arr[j] = arr[i]^arr[j];
                arr[i] = arr[i]^arr[j];
            }
        }
    }
    
    for ( int i=0 ; i<(n-k) ; i++ ) {
        scanf("%d",&m);
        if ( arr[0] > m)
            arr[0] = m;
        for ( int p=0 ; p<(k-1) ; p++) {
        for ( int q=p+1 ; q<=(k-1) ; q++) {
            if ( arr[p] < arr[q]) {
                arr[p] = arr[p]^arr[q];
                arr[q] = arr[p]^arr[q];
                arr[p] = arr[p]^arr[q];
            }
        }
    }
    }
    /*for( int i=0 ; i<k ; i++ ) {
        printf("%d\t",arr[i]);
    }*/
    m = 0;
    for (int i=0 ; i<k ; i++ ) {
        m += arr[i];
    }
    
    printf("%d",m);
    
    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>

int main(void){
  int n,k;
  scanf("%d %d",&n,&k);
  int p[n],i,j,tmp,total=0;
  
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  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;
      }
    }
  }
  for(i=0;i<k;i++){
    total += p[i];
  }
  printf("%d",total);
    
  return 0;
}
//  [c]
#include<stdio.h>

int main(void){
    int x,y,k,n,a[1001];
    scanf("%d %d",&n,&k);
    for(x = 0;x < n;x++){
        scanf("%d",&a[x]);
    }
    int tmp,sum = 0;
    for(x = 0;x < n;x++){
        for(y = x + 1;y < n;y++){
            if(a[x] > a[y]){
                tmp = a[x];
                a[x] = a[y];
                a[y] = tmp;
            }
        }
    }
    for(x = 0;x < k;x++){
        sum += a[x];
    }
    printf("%d\n",sum);
    return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  'use strict'
  const setting = input.trim().split('\n')

  const fruits_sum = setting[0].split(' ')[0] - 0
  const buy_sum = setting[0].split(' ')[1] - 0

  const price_arr = setting[1].split(' ')

  price_arr.sort(function(a,b){
    if( parseInt(a) < parseInt(b) ) return -1;
    if( parseInt(a) > parseInt(b) ) return 1;
    return 0;
  });

  let answer = 0

  for (let i = 0; i < buy_sum; i++) {
    answer += parseInt(price_arr[i])
  }

  console.log(answer)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input){
  input = input.trim();
  input = input.split('\n');
  const [n, k] = input[0].split(' ').map(x=>Number(x));
  const p = input[1].split(' ').map(x=>Number(x)).sort((a,b) => a-b);
  
  console.log(p.filter((x,i)=> i < k).reduce((sum, x)=> sum + x, 0));
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split('\n');
    let first = input[0].trim().split(' ');
    let second = input[1].trim().split(' ');
    
    function compareFunc(a, b) {
          return a - b;
        }
         
    let numArr = second.map(Number).sort(compareFunc);
    
    let result = 0;
    
    for (let i = 0; i<first[1]; i++) {
        result = result + numArr[i];
    }
    console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"sort"
)

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

	for i := 0; i < k; i++ {
		sum += p[i]
	}
	fmt.Println(sum)
}
//  [go]
package main

import (
	"fmt"
)
// QuickSort is sort algorithm
func quickSort(values []int) (ret []int) {
	if len(values)<2 {
		return values
	}
	pivot := values[0]
	
	left := []int{}
	right := []int{}
	for _,v := range values[1:] {
		if v>pivot {
			right = append(right, v)
		} else {
			left = append(left, v)
		}
	}
	left = quickSort(left)
	right = quickSort(right)
	ret = append(left, pivot)
	ret = append(ret, right...)
	return 
}	

func main() {
	var n,k int
	fmt.Scan(&n,&k)
	p := make([]int, n)
	for i:=0;i<n;i++ {
		fmt.Scan(&p[i])
	}
	p = quickSort(p)
	sum := 0
	for i:=0;i<k;i++ {
		sum += p[i]
	}
	fmt.Println(sum)
}
//  [ruby]
N,K=gets.split.map(&:to_i)
P=gets.split.map(&:to_i)
dp=Array.new(N+1){1e9}
dp[0]=0
P.each do |i|
  (K-1).downto(0) do |j|
    dp[j+1]=[dp[j+1],dp[j]+i].min
  end
end
p dp[K]
//  [ruby]
n,k = gets.chomp.split(" ").map(&:to_i);
price = gets.chomp.split(" ").map(&:to_i);

price.length.times do |i|
    (price.length-(i+1)).times do |j|
        if price[j] > price[j+1]
            price[j],price[j+1] = price[j+1],price[j]
        end
    end
end

answer = 0

k.times do |i|
	answer += price[i]
end

puts answer
//  [ruby]
s = getter = -> {
   require 'stringio'
  _in = StringIO.new
  while l = gets
    _in << l
  end
  _in.string
}.call.split(/\R/)
n,l = s[0].split(/ /).map(&:to_i)
_p = s[1].split(/ /).map(&:to_i)

puts _p.min(l).sum
//  [swift]
import Foundation

func readInts() -> [Int]{
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nk = readInts()
    let k = nk[1]
    var ans = 0
    
    let value = readInts().sorted(by: <)
    for i in 0..<k {
        ans += value[i]
    }
    print(ans)
    
}
main()
//  [swift]
import Foundation

let inputs = readLine()!.split(separator: " ").map{ Int($0)! }
let n = inputs[0]
let k = inputs[1]

let p = readLine()!.split(separator: " ").map{ Int($0)! }

print(p.sorted().prefix(k).reduce(0, +))
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let line = readInts()
    let k = line[1]
    let ps = readInts().sorted(by: <)
    
    var ans = 0
    for i in 0..<k {
        ans += ps[i]
    }
    
    print(ans)
}

main()
//  [typescript]
// B - Mix Juice
import { readFileSync } from 'fs';
const input = readFileSync('/dev/stdin', 'utf8');

const [NK, P] = input.split('\n');
const [N, K] = NK.split(' ').map((s) => parseInt(s));
const p = P.split(' ').map((s) => parseInt(s));

const sortedP = p.sort((a, b) => a - b);

let anser = 0;

for (let index = 0; index < K; index++) {
  anser += sortedP[index];
}

console.log(anser);
//  [typescript]
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'
 
let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
 
reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let [n, k] = lines[0].split(' ').map( _ => parseInt(_))
    let p = lines[1].split(' ').map( _ => parseInt(_))

    p.sort((a:number, b:number) => a - b)
    let ans = 0
    for(let i = 0; i < k; i++) {
        ans += p[i]
    }

    console.log(ans)
});
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let N = parseInt(xs[0].split(' ')[0]);
   let K = parseInt(xs[0].split(' ')[1]);
   let p = xs[1].split(' ');
   const compare = (a, b)=>{ 
   return a - b;
   }
   p.sort(compare);
   let num = 0
   for(let i=0; i<K; i++){
     num += parseInt(p[i]);
   }
   console.log(num);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [python]
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    s,w = inpm()
    if s <= w:
        print('unsafe')
    else:
        print('safe')
    
if __name__ == "__main__":
    main()
//  [python]
from pip._vendor.distlib.compat import raw_input

s, w = map(int, raw_input().split())
if w >= s:
    print("unsafe")
else:
    print("safe")
//  [python]
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

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


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    s,w = map(int,input().strip().split())
    if w>=s:
        print("unsafe")
    else:
        print("safe")


if __name__ == '__main__':
    main()
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        
        int s = sn.nextInt();
        int w = sn.nextInt();
        
        if(s <= w) {
            System.out.print("unsafe");
            return;
        }
        
        System.out.print("safe");
    }
}
//  [java]
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        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.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int w = sc.nextInt();
        System.out.println(s<=w?"unsafe":"safe");
    }
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll S;
    cin >> S;
    ll W;
    cin >> W;
    for(ll i=0;i<6000000000;i++){
        swap(S,W)
    ;}
    if(S<=W)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll S;
    cin >> S;
    ll W;
    cin >> W;
    for(ll i=0;i<1000000000;i++){
        swap(S,W)
    ;}
    if(S<=W)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}
//  [cpp]

#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n>>x;
	if(n > x) {
		cout<<"safe";
	}
	else cout<<"unsafe";
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
    int S, W;

    scanf("%d %d",&S, &W);

    if(S<=W) {
        printf("unsafe\n");
    } else {
        printf("safe\n");
    }

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


int main(){

    int S,N;

    scanf("%d %d",&S,&N);
    if(S>N){
        printf("safe");
    }
    else{
        printf("unsafe");
    }


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

int main(){

 int S,W;
 scanf("%d %d",&S,&W);

 if(W>=S){
    printf("unsafe");
 }else{
    printf("safe");
 }













return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	const S = parseInt(input[0], 10);
  const W = parseInt(input[1], 10);

  const ret = (S <= W)? 'unsafe' : 'safe';
  console.log(ret);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = (input) => {
  const args = input.split(' ');
  const s = parseInt(args[0], 10);
  const w = parseInt(args[1], 10);

  if (s > w) {
      console.log('safe');
  } else {
      console.log('unsafe');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
Main=(s=>{s=s.split(" "),console.log(+s[0]<=+s[1]?"unsafe":"safe")}); Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
package main

import (
	"fmt"
)

func main() {
	var s, w int

	_, _ = fmt.Scanf("%d %d", &s, &w)

	fmt.Println(answer164A(s, w))

}

func answer164A(s int, w int) string {
	if s <= w {
		return "unsafe"
	}
	return "safe"
}
//  [go]
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	s, w := scanInt(), scanInt()

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

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextInt(scanner)
	w := getNextInt(scanner)
	if s > w {
		fmt.Fprintln(writer, "safe")
		return
	}
	fmt.Fprintln(writer, "unsafe")
}
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
s,w = gets.chomp.split.map(&:to_i)

if s <= w
  puts 'unsafe'
else
  puts 'safe'
end
//  [ruby]
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

s,w = inp
puts (s <=w)? "unsafe" : "safe"
//  [ruby]
require 'pp'

s, w = gets.split.map(&:to_i)
if w >= s
    puts "unsafe"
else
    puts "safe"
end
//  [swift]
import Foundation

let input = readLine()!.split(separator: " ").map({ Int($0)! })
let s = input[0]
let w = input[1]

print(s > w ? "safe" : "unsafe")
//  [swift]
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let sw = readInts()
    
    print(sw[0] <= sw[1] ? "unsafe": "safe")
}
main()
//  [swift]
import Foundation
let input = readLine()!.split(separator: " ").map({ Int($0)! })
print(input[0] > input[1] ? "safe" : "unsafe")
//  [typescript]
import { readFileSync } from "fs";

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

const main = (input: string[][]) => {
  const [S, W] = input[0].map(Number);

  return S > W ? "safe" : "unsafe";
};

console.log(main(read()));
//  [typescript]
const isSafeForSheeps = (sheeps: number, wolves: number): string => {
  return sheeps <= wolves ? 'unsafe' : 'safe';
}

const main = (standardInput) => {
  const lengthList: string[] = standardInput.split(' ');
  const sheeps = Number.parseInt(lengthList[0]);
  const wolves = Number.parseInt(lengthList[1]);
  
  console.log(isSafeForSheeps(sheeps, wolves));
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
//  [python]
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()
ok=False
for i in range(1,6):
    ok  |= S == 'hi' * i
if ok:
    print('Yes')
else:
    print('No')
//  [python]
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

s=input()
if len(s)%2==1:
    print("No")
    quit()

for i in range(len(s)//2):
    if s[i*2]=="h" and s[i*2+1]=="i":
        continue
    else:
        print("No")
        quit()

print("Yes")
//  [python]
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline--------------------------------------------
    s = input()
    s = s.replace("hi","")
    print("No" if s else "Yes")
#endline===============================================
if __name__ == "__main__":
    main()
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 *
 */
public class Main implements Runnable { //クラス名はMain1

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMain1 sc = new FastScannerMain1(System.in);

		try {
			String S = sc.nextLine().trim();
			boolean a = false;

			S = S.replace("hi", "");

			if (S.length() == 0) {
				a = true;
			}

			if (a) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

//高速なScanner
class FastScannerMain1 {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMain1(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}
//  [java]
import static java.util.stream.IntStream.range;
import java.util.*;

public class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		String t=s.next();
		System.out.println(t.length()%2==0&&range(0,t.length()).allMatch(i->t.charAt(i)==(i%2==0?'h':'i'))
				?"Yes":"No");
	}
}
//  [cpp]
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(5e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class AHitachiString {
public:
	void solve(std::istream& in, std::ostream& out) {
	    string s;
	    in >> s;

	    if(s.length()%2 != 0){
            ans(false, out);
            return;
	    }

	    bool flg = true;
	    for(int i=0; i<s.length()-1; i+=2){
            if(s[i] != 'h' || s[i+1] != 'i'){
                flg = false;
                break;
            }
	    }

	    ans(flg, out);
	}
};


int main() {
	AHitachiString solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}
//  [cpp]
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    string s;
    cin >> s;

    rep(i, s.size()){
        if(i == s.size() - 1){
            cout << "No" << endl;
            return 0;
        }
        if(s[i] == 'h' && s[i + 1] == 'i'){
            i++;
        } else { 
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}
//  [c]
main(){system("egrep -q '^(hi)*$' && echo Yes || echo No");}
//  [c]
#include<stdio.h>
#include<string.h>

int main() {
	char s[11];
	scanf("%s", s);
	int flag = 0;
	for (int i = 0; i < strlen(s); i++) {
		if (strlen(s) %2== 1) { printf("No"); return 0; }
		if (i % 2 == 0) {
			if (s[i] != 'h') {
				printf("No");
				return 0;
			}
		}
		else if (s[i] != 'i') {
			printf("No");
			return 0;
		}
	}
	printf("Yes");

	return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main()
{
    char x[11];
    int count=0,i;
    scanf("%s",&x);
    int len=strlen(x);
    if(len%2==1) printf("No\n");
    else
    {
        for(i=0; i<len; i++)
        {
            if(i%2==0 && x[i]!='h')
            {
                count=1;
                break;
            }

            else if(i%2==1 && x[i]!='i')
            {
                count=1;
                break;

            }

        }
        if(count==0)
            printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0];
    
    console.log(S.split("hi").join("").length === 0 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = nextCharArray();
  if(s.length % 2 == 1){
     myout("No");
    return;
  }
  for(var i = 0; i < s.length; i++){
    if(i % 2 == 0){
       if(s[i] != "h"){
          myout("No");
      	return;
       }
    }else{
      if(s[i] != "i"){
          myout("No");
      	return;
       } 
    }
  }
  myout("Yes");
}
//  [javascript]
function Main(input) {
	input = input.split("");
	var flag = true;
	if(input.length%2==1) flag = false;
	for(var i=0;i<input.length/2;i++){
		if(input[i*2]=="h"&&input[i*2+1]=="i"){
			
		}else{
			flag = false;
		}
		if(!flag){
			break;
		}
	}
if(flag){
	console.log("Yes")
}else{
	console.log("No")
}
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	if err := io.writer.Flush(); err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	io := NewIo()
	defer io.Flush()
	N := io.Next()
	a := strings.Replace(N, "hi", "", -1)
	if a == "" {
		io.PrintLn("Yes")
		return
	}
	io.PrintLn("No")
}
//  [go]
package main

import "fmt"

func main() {
	// Code for A - Hitachi String
	var S string
	fmt.Scanf("%s", &S)

	if len(S)%2 != 0 {
		fmt.Println("No")
	} else {
		var ans string
		for i := 0; i < len(S); i++ {
			if i%2 == 0 {
				ans += "h"
			} else {
				ans += "i"
			}
		}

		if S == ans {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}
//  [go]
package main
 
import (
  "fmt"
  "strings"
)
 
func main() {
  var s string
  fmt.Scanf("%s", &s)
  
  ans := "No"
  if strings.Replace(s, "hi", "", -1) == "" {
    ans = "Yes"
  }
  fmt.Printf("%s\n", ans)
}
//  [ruby]
puts`dd`[/^(hi)*$/]?:Yes: :No
//  [ruby]
s = gets.chomp

x = s.length / 2
if s == 'hi' * x
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @s = gets.chomp
  end

  def solve
    s.match(/^(hi)+$/)
  end

  def show(ans)
    puts ans ? "Yes" : "No"
  end
end

Problem.new.instance_eval do
  show(solve)
end
//  [rust]
use proconio::input;
use proconio::marker::Bytes;


fn main() {
    input!{
        s:Bytes
    }

    let b = s.iter().enumerate().all(
        |(i,&x)| if i%2==0 {x==b'h'} else {x==b'i'}
    );

    if s.len()%2==0 && b {
        println!("Yes");
    }
    else {
        println!("No");
    }
    
    
}
//  [rust]
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:String,
    }
    let a=a.chars().collect_vec();
    if a.len()%2==1 {println!("No");exit(0)}
    for i in 0..a.len() {
        if i%2==0&&a[i]!='h'{println!("No");exit(0)}
        else if i%2==1&&a[i]!='i'{println!("No");exit(0)}
    }
    println!("Yes")
}
//  [typescript]
import * as fs from 'fs';

namespace AtCoder.hitachi2020 {

    export class Program {
        /**
         * in
         * hihi
         * out
         * Yes
         */
        static main(inp: string): void {

            if (inp.length %2 ===1) {
                console.log('No');
                return;
            }


            for (let i = 0; i < inp.length; i++) {
                if (i % 2 === 0) {
                    // h
                    if (inp[i] !== 'h') {
                        console.log('No');
                        return;
                    }
                } else {
                    // i
                    if (inp[i] !== 'i') {
                        console.log('No');
                        return;
                    }
                }


            }

            console.log('Yes');
        }
    }
}

AtCoder.hitachi2020.Program.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
function Main(input) {
    const lines = input.split("\n");
    console.log(/^(hi)+$/.test(lines[0]) ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));