akhauriyash/Code-Regression huggingface dataset:
s = gets.chomp
t = gets.chomp

done = []
s.size.times do |i|
  next if done.include?(t[i])
  origin = s[i]
  s.gsub!(t[i], "!")
  s.gsub!(origin, t[i])
  s.gsub!("!", origin)
  done << t[i]
end
puts s==t ? "Yes" : "No"

Measured memory_bytes: 12096
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Scanner;

 
/*
 * メモ
 * Scanner:nextは空白か改行までの単語
 * String[][] c = new String[h][w];
 * TemplateMain,"template_input.txt"
 * 0.5 == 1.0/2
 * Integer.valueOf(char)はダメ、(String)
 */
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		double r = sc.nextDouble();
		
		System.out.printf("%.6f %.6f", (Math.PI*r*r), (Math.PI*2*r));
	}
}


Measured memory_bytes: 28296
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll gcd(ll A, ll B) {
  if (A % B == 0) {
    return B;
  } else {
    return gcd(B, A % B);
  }
}

ll lcm(ll A, ll B) {
  return A / gcd(A, B) * B;
}

int main(void) {
  ll A, B;
  cin >> A >> B;

  cout << lcm(A, B) << endl;
  
  return 0;
}

Measured memory_bytes: 256
import re
snakeA = re.compile('>\'(=+)#\\1~$')
snakeB = re.compile('>\^(Q=)+~~$')
for i in xrange(input()):
    s = raw_input()
    if snakeA.match(s) is not None:
        print "A"
    elif snakeB.match(s) is not None:
        print "B"
    else:
        print "NA"

Measured memory_bytes: 4204
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n;
int A[100];
int main()
{
  cin >>n;
  for(int i = 0;i <n;i++){
    cin >>A[i];
  }
  for(int i = 0;i <n;i++){
    cout <<A[i];
    if(i !=n-1)
      cout <<" ";
  }
  cout <<endl;
  int i;
  int key;
  for(int j = 1;j <n;j++){
      key = A[j];
      i = j-1;
      while(i >= 0&&A[i]>key){
	A[i+1] =A[i];
	i--;
      }
      A[i+1] =key;
      for(int i = 0;i <n;i++){
	  cout <<A[i];
	if(i !=n-1)
	  cout <<" ";
      }
      cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t x;
  cin >> x;
  int64_t sav = 100;
  int ans = 0;

  while(sav < x){
    ans++;
    sav = sav * 1.01;
  }

  cout << ans << endl;
}



Measured memory_bytes: 3628
N=int(input())
S=input()

allblack=0
for i in range(N):
  if S[i]!='#':
    allblack+=1
    
answer=allblack
whitecount=allblack   
blackcount=0

for i in range(N):
  if S[i]=='.':
    whitecount-=1
  else:
    blackcount+=1
  tmp=blackcount+whitecount
  answer=min(answer,tmp)
  
print(answer)

Measured memory_bytes: 3500
use std::io::Read;
use std::f64::consts::PI;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: f64 = iterator.next().unwrap().parse().unwrap();
    let b: f64 = iterator.next().unwrap().parse().unwrap();
    let h: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    let minute: usize = h * 60 + m;
    let x_l: f64 = a * (1.0 / 2.0 * minute as f64 * PI / 180.0).sin();
    let y_l: f64 = - a * (1.0 / 2.0 * minute as f64 * PI / 180.0).cos();

    let x_s: f64 = b * (6.0 * m as f64 * PI / 180.0).sin();
    let y_s: f64 = - b * (6.0 * m as f64 * PI / 180.0).cos();

    let ans: f64 = ((x_l - x_s) * (x_l - x_s) + (y_l - y_s) * (y_l - y_s)).sqrt();
    return format!("{:.12}", ans);
}


Measured memory_bytes: 2916
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=1e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n,a[N];
bool solve() {
    int cnt0=0,cnt1=0;
    for(int i=1;i<=n;i++) (a[i]&1)?cnt1++:cnt0++;
    if(cnt0&1) return 1;
    else if(cnt1>1) return 0;
    else {
        for(int i=1;i<=n;i++)
            if(a[i]&1) {
                if(a[i]==1) return 0;
                else a[i]--;
            }
        int gg=0;
        for(int i=1;i<=n;i++) gg=__gcd(gg,a[i]);
        for(int i=1;i<=n;i++) a[i]/=gg;
        return !solve();
    }
}
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi();
    puts(solve()?"First":"Second");
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, 0, h) cin >> s[i];
    vector<vector<int> > ans(h, vector<int>(w, -1));
    int cnt = 0;
    rep(i, 0, h){
        int now = -1;
        rep(j, 0, w){
            if(s[i][j] == '#'){
                cnt++;
                now = cnt;
            }
            ans[i][j] = now;
        }
    }
    for(int i = 0; i < h; i++){
        if(i){
            if(ans[i][w - 1] == -1){
                for(int j = 0; j < w; j++){
                    ans[i][j] = ans[i - 1][j];
                }
            }
        }
        if(ans[i][w - 1] != -1){
            for(int j = w - 2; j >= 0; j--){
                if(ans[i][j] == -1){
                    ans[i][j] = ans[i][j + 1];
                }
            }
        }
    }
    for(int i = h - 2; i >= 0; i--){
        if(ans[i][0] == -1){
            for(int j = 0; j < w; j++){
                ans[i][j] = ans[i + 1][j];
            }
        }
    }
    rep(i, 0, h){
        for(int ii = 0; ii < ans[i].size(); ii++){
            if(ii) cout << ' ';
            cout << ans[i][ii];
        }
        cout << endl;
    }
}

Measured memory_bytes: 1664
#include <stdio.h>

long long gcm_f(long long a,long long b)
{
 if(b==0)
 {
   return a;
 }
  else
  {
  return gcm_f(b,a%b);
  } 
}

int main()
{
  int n;
  long long gcm;
  long long ans=0;
  
  scanf("%d",&n);
  
  int i,j,k;
  
  for(i=1;i<=n;i++)
  {
    for(j=1;j<=n;j++)
    {
      for(k=1;k<=n;k++)
      {
        gcm=gcm_f(i,j);
        gcm=gcm_f(gcm,k);
        ans+=gcm;
      }
    }
  }
  
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 200100

ll n,k;
ll a[MAX],f[MAX];
ll d[MAX];

bool check(ll t){
	ll count = 0;
	For(i,0,n){
		if(d[i]<=t) continue;

		ll x = (d[i]-t)/(f[i]);
		vector<ll> current;
		if(x-1>=0)
			current.pb(x-1);
		if(x>=0)
			current.pb(x);
		if(x+1>=0)
			current.pb(x+1);

		for(ll x:current) if(d[i]-x*f[i]<=t){
			count+=x;
			break;
		}
		if(count>k) return 0;
	}
	return 1;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin>>n>>k;
	For(i,0,n) cin>>a[i];
	sort(a,a+n,greater<ll>());
	For(i,0,n) cin>>f[i];
	sort(f,f+n);
	For(i,0,n){
		d[i] = a[i]*f[i];
	}

	ll start = 0 , end = 1e18;
	ll ans = end;
	while(start<=end){
		ll mid = (start+end)/2;
		if(check(mid)){
			ans = min(ans,mid);
			end = mid-1;
		}else{
			start = mid+1;
		}
	}

	cout<<ans<<endl;





























	
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <cstring>

using namespace std;

typedef long long ll;

bool is_ACGT(char c){
    if(c=='A'||c=='C'||c=='G'||c=='T'){
        return true;
    }
    return false;
}


int main(){
    char S[11];
    scanf("%s",S);
    int max=0;
    int count=0;
    
    int len=strlen(S);

    
    for(int i=0;i!=len;++i){
        if(is_ACGT(S[i])){
            ++count;
            //cout<<S[i]<<endl;
        }else{
           
            count=0;
        }
         max=(max>count)?max:count;
        
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
//  Atcoder  beginner round 175B - Making Triangle

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 100000 + 5;

int l[2000];

void solve() {
    int n, cnt = 0;
    cin >> n;
    for (int x = 0; x < n; x++) {
        cin >> l[x];
    }
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
            for (int k = j + 1; k < n; k++)
                if(l[i] != l[j] && l[i] != l[k] && l[j] != l[k] && max(max(l[i], l[j]), l[k]) < l[i] + l[j] + l[k] - max(max(l[i], l[j]), l[k]))
                    cnt++;
    cout << cnt << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];

  int ans = INF;

  FOR(X,-100,101) {
    int res = 0;
    rep(i,n) {
      res += (a[i]-X)*(a[i]-X);
    }
    ans = min(ans,res);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a[] = new int[n];
        List<Pair> pairs = new ArrayList<Pair>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            pairs.add(new Pair(i + 1, a[i]));
        }
        Collections.sort(pairs);
        int ans[][] = new int[h][w];
        int i = 0;
        int j = 0;
        int dir = 1; // 1は右に進む // 2は左に進む
        while (true) {
            if (pairs.size() == 0) {
                break;
            }
            Pair p = pairs.get(0);
            pairs.remove(0);
            for (int k = 0; k < p.count; k++) {
                ans[i][j] = p.color;
                if (dir == 1) {
                    j++;
                    if (j == w) {
                        i++;
                        j = w - 1;
                        dir = 2;
                    }
                } else if (dir == 2) {
                    j--;
                    if (j == -1) {
                        i++;
                        j = 0;
                        dir = 1;
                    }
                }

            }

        }
        for (int k = 0; k < h; k++) {
            for (int l = 0; l < w; l++) {
                System.out.print(ans[k][l]);
                if (l != w - 1)
                    System.out.print(" ");
            }
            System.out.println("");
        }
        sc.close();
    }
}

class Pair implements Comparable<Pair> {
    int color;
    int count;

    Pair(int color, int count) {
        this.color = color;
        this.count = count;
    }

    @Override
    public int compareTo(Pair other) {
        if (this.count < other.count) {
            return -1;
        } else if (this.count > other.count) {
            return 1;
        } else {
            if (this.color < other.color) {
                return -1;
            } else {
                return 1;
            }

        }
    }
}


Measured memory_bytes: 32576
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

const ll INF = 1e9+7;

// 各桁の和
template<typename T>
T digit(T num){
  T sum = 0;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

int main(){
  int N,Q;cin>>N>>Q;
  string s;cin>>s;
  vector<int> AC(N,0);
  
  for(int i = 1;i < N;++i){
    AC[i] = AC[i-1];
    if(s[i - 1] == 'A' && s[i] == 'C')++AC[i];
  }
  
  rep(i,Q){
    int r,l;cin>>r>>l;
    print(AC[l-1] - AC[r-1])
  }
  
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<"L"<<__LINE__ <<" : "<<#x<<" = "<<(x)<<endl
// #define gcd __gcd
// for c++14
inline int ones(unsigned x){int r=0;while(x!=0) r++,x=x&(x-1);return r;}

using vi=vector<int>;
using pii=pair<int,int>;
using vii=vector<pii>;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
const int inf=0x3f3f3f3f;
const int nmax=100;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin.exceptions(cin.failbit);
    //Solution
    long r,d,x;
    cin>>r>>d>>x;
    for(int i=1;i<=10;i++){
      x=r*x-d;
      cout<<x<<endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep3(i, a, n) for(int i = (int)(a); i < (int)(n); i++)
#define ll long long

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }





int main() {
  ll N; // 変数の宣言
  cin >> N; // 標準入力
  vector<ll> A(N);
  ll sum =0;
  ll mod =1000000007;
  rep(i,N){
    cin >> A.at(i);
    sum += A[i];
    sum %=mod;
  }
  ll ans =0;

  rep(i,N){
    sum -=A[i];
    if(sum<0)
      sum = sum + mod;

    ans = ans + A[i]*sum;
    ans %= mod;
  }
 
  cout << setprecision(12) << ans << endl; // 標準出力
}



Measured memory_bytes: 4824
#include<stdio.h>
int main(){

   int A,B;

   scanf("%d%d",&A,&B);

   if(A==1)A=14;
   if(B==1)B=14;

   if(A < B){
      printf("Bob\n");
   }else if(A == B){
      printf("Draw\n");
   }else{
      printf("Alice\n");
   }

   return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, K; cin >> N >> K;
    vec a(N); readv(a);

    vec ans;
    int l = -1;
    REP(i, K + 1){
        int m = INF, i0 = -1;
        REP(j, N) if(j != l){
            if(a[j] < m){
                m = a[j];
                i0 = j;
            }
        }
        if(m == 0){
            cout << -1 << endl;
            return 0;
        }else{
            REP(j, N) if(j != l){
                a[j]--;
                if(j != i0) ans.push_back(j);
            }
            ans.push_back(i0);
            l = i0;
        }
    }
    cout << ans.size() << endl;
    REP(i, ans.size()) cout << ans[i] + 1 << " ";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

void Main()
{
  int X,Y;
  cin >> X >> Y;
  rep(x,101){
    rep(y,101){
      if (x+y == X and 2*x+y*4==Y) {cout << "Yes" << endl; return;}
    }
  }
  cout << "No" << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		for(int j=i+1;j<s.size();j++){
			if(s[i]==s[j]){
				cout<<"no"<<endl;
				return 0;
			}
		}
	}
	cout<<"yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

template <class T> inline T square(T x) {
  T result;
  result = x * x;
  return result;
};

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  auto start = chrono::steady_clock::now();
#endif

int s,w;
  cin >> s>>w;

if(w >=s){
	print("unsafe");
}else{
	print("safe");
}

#ifdef LOCAL
  auto end = chrono::steady_clock::now();
  auto diff = end - start;

  cout << "Duration: " << chrono::duration<double, milli>(diff).count() << " ms"
       << '\n';
#endif

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;

int main() {
  int n; cin >> n;
  deque<int> b;

  for(int i = 0; i < n; i++){
    int tmp; cin >> tmp;
    if(i % 2 == 0){
      b.push_back(tmp);
    }else{
      b.push_front(tmp);
    }
  }
  if(n % 2 != 0){
    reverse(b.begin(), b.end());
  }

  for(int x: b){
    cout << x << " ";
  }

}


Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;
ll const MAX = 200005;
ll const INF = 100000000000000000;
ll tree[3][MAX * 4];
ll x[MAX];
ll n_;
ll lazy = 0;

void init(ll n) {
	n_ = 1;
	while (n_ <= n) {
		n_ <<= 1;
	}
	REP(i, 1, n_*2) {
		tree[1][i] = tree[2][i] = INF;
	}
}

void update(ll i, ll x, ll n) {
	ll now = n_ + n;
	tree[i][now] = x;
	while (now > 1) {
		now /= 2;
		tree[i][now] = min(tree[i][now * 2], tree[i][now * 2 + 1]);
	}
}

ll query_o(ll i, ll a, ll b, ll k, ll l, ll r) {
	if (a <= l && r <= b) {
		return tree[i][k];
	}
	else if (r <= a || b <= l) {
		return INF;
	}
	else {
		ll ans1 = query_o(i, a, b, k * 2, l, (l + r) / 2);
		ll ans2 = query_o(i, a, b, k * 2 + 1, (l + r) / 2, r);
		return min(ans1, ans2);
	}
}

ll query(ll i, ll a, ll b) {
	return query_o(i, a, b, 1, 0, n_);
}

int main() {
	ll n, q, a, b;
	cin >> n >> q >> a >> b;
	REP(i, 1, q) {
		cin >> x[i];
	}
	x[0] = a;
	init(n);
	update(1, -b, b);
	update(2, b, b);
	REP(i, 0, q-1) {		
		ll t;
		ll s = abs(x[i + 1] - x[i]);
		t = min(query(1, 1, x[i + 1]) + x[i + 1], query(2, x[i + 1], n + 1) - x[i + 1]) + lazy;
		update(1, t - lazy - s - x[i], x[i]);
		update(2, t - lazy - s + x[i], x[i]);
		lazy += s;
	}
	ll ans = INF;
	REP(i, 1, n) {
		ans = min(ans, tree[1][n_ + i] + i);
	}
	cout << ans+lazy << endl;
}

Measured memory_bytes: 14080
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll a, b;
  cin >> a >> b;
  if(min(a, b) >= 2) print((a*b+1)/2);
  else print(1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
const int MAX = 100005;
int n = MAX;
vector<vector<pp>> tree(n);
vector<int> color(n,0);

void dfs(int i,int before,int cost){
  if( cost == 1) color[i] = 1;
  for(auto j : tree[i]){
    if(j.first == before) continue;
    dfs(j.first,i,(cost+j.second)%2);
  }
}

int main() {
  cin >> n;
  rep(i,n-1){
    int a,b,c;
    cin >> a >> b >> c;
    --a; --b;
    tree[a].push_back(make_pair(b,c));
    tree[b].push_back(make_pair(a,c));
  }
  
  dfs(0,-1,0);
  
  rep(i,n) cout << color[i] << endl;
}

  

Measured memory_bytes: 8448
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;
int counts = 1,maxn = -INF;
int head[MAXN];
struct node{
	int to;
	int next;
	int color;
}edge[MAXN];

void addedge(int a,int b)
{	
	edge[counts].to = b;
	edge[counts].color = 0;
	edge[counts].next = head[a];
	head[a] = counts++;
}

void dfs(int u,int c)
{
	int tmp = 1;
	for(int i = head[u];i != 0;i = edge[i].next){
		int v = edge[i].to;
		if(tmp == c)
			tmp++;
		edge[i].color = tmp;
		maxn = max(maxn,tmp);
		dfs(v,tmp);
		tmp++;
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i < n - 1;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		addedge(a,b);
	}
	dfs(1,0);
	printf("%d\n",maxn);
	for(int i = 1;i < counts;i++){
		printf("%d\n",edge[i].color);
	}
	return 0;
}


Measured memory_bytes: 3968
//https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_d
#include<bits/stdc++.h>
using namespace std;

#define ll long long

const int N = 1e6 + 3;
int m;
pair<int, ll> a[N];

void init() {
	scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf("%d %lld", &a[i].first, &a[i].second);
	}
}

pair<int, ll> combine(pair<int, ll> p1, pair<int, ll> p2) {
	auto tmp = p1;
	tmp.first += p2.first;
	tmp.second += p2.second + 1;
	if (tmp.first > 9) {
		tmp.first -= 9;
		tmp.second++;
	}
	return tmp;
}

pair<int, ll> get(pair<int, ll> p) {
	//cerr << p.first << " " << p.second << "\n";
	int num = p.first;
	ll cnt = p.second;
	ll steps = 0;
	vector<int> v;
	while (cnt > 1) {
		steps += cnt / 2;	
		if (cnt % 2) {
			v.push_back(num);
		}
		cnt /= 2;
		num *= 2;
		if (num > 9) {
			num -= 9;
			steps += cnt;
		}
	}
	pair<int, ll> ret = {num, steps};
	while (v.size()) {
		ret = combine(ret, {v.back(), 0});
		v.pop_back();
	}
	return ret;
}

void solve() {
	auto ans = get(a[0]);
	for (int i = 1; i < m; i++) {
		//cerr << ans.first << " " << ans.second << "\n";
		ans = combine(ans, get(a[i]));
	}
	//cerr << ans.first << " " << ans.second << "\n";
	printf("%lld\n", ans.second);
}

int main() {
	init();
	solve();
	return 0;
}

Measured memory_bytes: 4352
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (i == 0) {
				count++;
				continue;
			}
			if (arr[i - 1] != arr[i]) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 22612
// g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef pair<int, int> p;
typedef long long ll;

const int mod = 1000000007;
const int inf = 1000000007;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 3; i++) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
int main(){
  int i,j,max=0,min=1e9,c;
  char s[100010];
  scanf("%s",s);
  for(i=0;i<26;i++){
    max=0;
    c=0;
    for(j=0;s[j];j++){
      if(s[j]=='a'+i){
	if(max<c)max=c;
	c=0;
      }
      else c++;
    }//printf("%c:%d\n",i+'a',max);
    if(max<c)max=c;
    if(min>max)min=max;
  }
  printf("%d\n",min);
  return 0;
}   


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
vector<vector<int>> B(0, vector<int>());


void dfs(vector<int> A, int n, int m, int i=1) {
  if (A.size() == n) {
    B.push_back(A);
    return ;
  }
  if (i>m) return ;

  dfs(A, n, m, i+1);
  A.push_back(i);
  dfs(A, n, m, i);

  return ;
}

int main() {
  int n,m,q; cin >> n >> m >> q;
  vector<int> A;
  vector<int> a(q);
  vector<int> b(q);
  vector<int> c(q);
  vector<int> d(q);
  rep(i,q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--; b[i]--; //c[i]--; d[i]--;
  }
  
  dfs(A, n, m, 1);
  int ans=0;

  rep(i, B.size()) {
    int sum = 0;
    rep(j,q) {
      if (B[i][b[j]] - B[i][a[j]] == c[j]) sum += d[j];
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 9872
#include <bits/stdc++.h>
using namespace std;

int main() {
	int A,B,C;
  	cin>>A>>B>>C;
  	int kotae;
  	int sound = B;

	for(int i=0;i<C;i++){

        if(sound>=A){
          kotae++;
          }
      	else{
      		break;
        }
      
    	sound -= A ;
                    
    }
      cout<<kotae<<endl;
          
}
  

Measured memory_bytes: 256
// finish date: 2018/05/20

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];
    if (A[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    FOR(i, 1, N) {
        if (A[i] != 0 && A[i] != 1 && A[i] - A[i - 1] > 1) {
            cout << -1 << endl;
            return 0;
        }
    }

    ll cost = 0;
    FOR(i, 1, N) {
        if (A[i] == 0) continue;
        if (A[i] == 1) cost++;
        else {
            if (A[i - 1] + 1 == A[i]) {
                cost++;
            } else {
                cost += A[i];
            }
        }
    }
    cout << cost << endl;

    return 0;
}




Measured memory_bytes: 1152
/*
      author : nishi5451
      created: 12.08.2020 14:46:35
*/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;


int main(){
    int l,r,d;
    cin >> l >> r >> d;
    int ans=0;
    for(int i=l; i<=r; i++){
        if(i%d==0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<string>
#include<cstdlib>
//#define MAX 500010
//#define NIL -1
using namespace std;

struct Node {
	int key;

	Node *r, *l, *p;
};

Node *root, *NIL;


void insert(int ke) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));

	z->key = ke;
	z->l = NIL;
	z->r = NIL;

	while (x != NIL) {
		y = x;

		if (z->key < x->key) {
			x = x->l;
		}
		else {
			x = x->r;
		}
	}


	z->p = y;

	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->l = z;
		}
		else {
			y->r = z;
		}
	}
}


void inorder(Node* u) {
	if (u == NIL) {
		return;
	}

	inorder(u->l);
	printf(" %d", u->key);
	inorder(u->r);
}


void preorder(Node* u) {//先行順巡回
	if (u == NIL) {
		return;
	}
	printf(" %d", u->key);
	preorder(u->l);
	preorder(u->r);
}


int main() {
	int n, i, x;
	string com;

	//scanf_s("%d", &n);
	scanf("%d", &n);
	//cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> com;

		if (com == "insert") {
			//scanf_s("%d", &x);
			scanf("%d", &x);
			//cin >> x;
			insert(x);
		}
		else if (com == "print") {
			inorder(root);
			//cout << endl;
			printf("\n");
			preorder(root);
			//cout << endl;
			printf("\n");
		}

	}

	return 0;
}








Measured memory_bytes: 26728
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  string v;
  cin >> v;
  int sum = 0;
  for(int i=0; i<n-1; i++){
    if (v[i] != v[i+1]){
      sum  += 1;
    }
  }
  
  cout << sum+1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    vector<int> a(N+1);
    a[0] = 0;
    char tmp;
    for (int i = 1; i < N+1; i++)
    {
        cin >> tmp;
        if(tmp == '#'){
            a[i] = a[i-1] + 1;
        }
        else{
            a[i] = a[i-1];
        }
    }
    int ans = 1000000;
    for (int k = 0; k < N+1; k++)
    {
        ans = min(ans, N-k-a[N]+2*a[k]);
    }
    printf("%d\n", ans);


}


Measured memory_bytes: 1024
import java.util.*;

 
class Main {
 
    private static Scanner sc = new Scanner(System.in);
 
    public static void main(String[] args) {
        String s = sc.next();
        String s1 = sc.next();

        int n = Integer.parseInt(s);
        int l = Integer.parseInt(s1);
        //char[] code = s.toCharArray();
        int ans =0;
        //System.out.println((s + s).contains(s2) ? "Yes" : "No");
        int[] apple = new int[n+1];
        int sum = 0;
        int min = 100000;
        int min2 = 100000;
        for(int i = 1; i < n+1; i++){
            apple[i]= l+i-1;
            sum += apple[i];
            //System.out.print(apple[i]+ " ");

            if(Math.abs(apple[i])<min){
                min2 = apple[i];            
                min = Math.min(Math.abs(apple[i]),min);
            }
        }
        //System.out.println(min2);
        ans = sum - min2;




        System.out.println(ans);

    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int N;
vector<vector<pair<int, ll>>> tree;
int color[100005];

void dfs(int v, int from, ll dist) {
	color[v] = dist % 2;
	for (auto p : tree[v]) {
		if (p.first == from) continue;
		dfs(p.first, v, dist + p.second);
	}
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> N;
    tree.assign(N + 3, vector<pair<int, ll>>());
    REP(i, N - 1) {
    	ll x, y, w;
    	cin >> x >> y >> w;
    	tree[x].push_back({y, w});
    	tree[y].push_back({x, w});
    }
    dfs(1, 0, 0);
    FOR(i, 1, N) {
    	cout << color[i] << "\n";
    }
    

}


Measured memory_bytes: 9728
#include <iostream>

using namespace std;

int gcd(int a, int b){
	int t;
	while(b!=0){
		t = b;
		b = a%b;
		a = t;
	}
	return a;
}

int main(){
	int k;
	cin >> k;
	long sum = 0;
	for(int i = 1; i <=k; i++){
		for(int j = 1; j <=k; j++){
			for(int l = 1; l <=k; l++){
				sum += gcd(gcd(i,j),l);		
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3632
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 10**9
idx = 0
for i in range(N):
  temp = T - H[i]*0.006
  diff = abs(A - temp)
  if diff < ans:
    ans = diff
    idx = i + 1
print(idx)
               

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
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; }
ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int B[1000001];

int main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    rep(i,N) {
        if(B[A[i]] <= 1) {
            for(int p = 1; A[i]*p <= 1000000; p++) {
                B[A[i]*p]++;
            }
        }
    }
    int ans = 0;
    rep(i,N) if(B[A[i]] <= 1) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7920
#include <bits/stdc++.h>

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	string s;
	cin>> s;
	string s1 , s2;
	rep(i,8){
		int j = 7 - i ;
		//sのはじめのi文字と、後ろのj文字を見る
		s1 = s.substr(0,i);
		s2 = s.substr(s.size()-j,j);
		if(s1+s2=="keyence"){
			cout << "YES"<<endl;
			return 0;
		}
	}
	cout <<"NO"<<endl;
}


Measured memory_bytes: 256
#   In this template you are not required to write code in main

import sys
inf = float("inf")
#sys.setrecursionlimit(1000000)


# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
# mod,MOD=1000000007,998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

#from cmath import sqrt
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi,gcd
from bisect import bisect_left,bisect_right
#import numpy as np


def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n=int(input())
Arr=[]
for i in range(n):
    Arr.append(int(input()))
mydict=dict()
for i in Arr:
    mydict[i]=mydict.get(i,0)+1
maxi=max(Arr)
occurence=mydict[maxi]
if occurence>1:
    for i in range(n):
        print(maxi)
    exit()
second_maxi=-1
for i in Arr:
    if i>second_maxi and i<maxi:
        second_maxi=i
for i in range(n):
    if Arr[i]!=maxi:
        print(maxi)
    else:
        print(second_maxi)

Measured memory_bytes: 20260
#include <stdio.h>
#include <string.h>

int main(void){
    int turn;
    int p1 = 0, p2 = 0;
    char ward1[100], ward2[100];
    
    scanf("%d\n", &turn);
    for(int i = 0; i < turn; i++)
    {
        scanf("%s %s\n", ward1, ward2);
        int cmp = strcmp(ward1, ward2);
        if (cmp > 0)
            p1 += 3;
        else if (cmp == 0) {
            p1 += 1;
            p2 += 1;
        }
        else if (cmp < 0)
            p2 += 3;
    }
    printf("%d %d\n", p1, p2);
    
    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int T;
  cin >> T;
  rep(_,T){
    int n,m,a,b;
    cin >> n >> m >> a >> b;
    cout << floor_sum(n,m,a,b) << endl;
  }

  return 0;
}

Measured memory_bytes: 3672
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

int main() {
  	string A, B;
    cin >> A >> B;
    
    sort (A.begin(),A.end());
    sort (B.begin(),B.end());
    reverse (B.begin(),B.end());
    
    if (A<B) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3600
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    Cins(S);
    if(N%2!=0){
        cout << "No" << nn;
        return 0;
    }
    bool sameString = true;
    rep(i,S.length()/2){
        if(S[i]!=S[i+S.length()/2]) sameString = false;
    }
    if(sameString) cout << "Yes" << nn;
    else cout << "No" << nn;
    return 0;
}

Measured memory_bytes: 256