akhauriyash/Code-Regression huggingface dataset:
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD (int)(1e9+7)
#define INF (int)(1e9)
#define LLINF (int)(4e18)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

// comb (前計算O(NlogMOD) クエリO(1))
const int MAX_N = 2000;
ll FACT[MAX_N + 1], IFACT[MAX_N + 1];

//powMod
ll powMod(ll k, ll n, ll mod) {
    ll x = 1;
    while (n > 0) {
        if (n & 1) {
            x = x * k % mod;
        }
        k = k * k % mod;
        n >>= 1;
    }
    return x;
}

ll comb(ll n, ll r) {
    if (n < 0 || r < 0 || r > n)return 0;
    if (r > n / 2) r = n - r;
    return FACT[n] * IFACT[n - r] % MOD * IFACT[r] % MOD;
}

int main() {
    int N, K; input(N,K);
    FACT[0] = 1;
    IFACT[0] = 1;
    for (int i = 1; i <= MAX_N; i++) {
        FACT[i] = FACT[i - 1] * i % MOD;
        IFACT[i] = powMod(FACT[i], MOD - 2, MOD);
    }
    FOR(i, 1, K + 1) {
        cout << (comb(K - 1, i - 1) % MOD) * comb(N - K + 1, i) % MOD << endl;
    }
    getchar(); getchar();
}

Measured memory_bytes: 384
n,m,c = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
as = n.times.map{ gets.split.map(&:to_i) }
ans = 0
as.each do |a|
  ans += 1 if a.zip(bs).map{|a,b| a*b }.inject(:+) + c > 0
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cmath>
using namespace std;


int main() {
  int N;
  cin >> N;

  assert(1 <= N && N <= 10000);

  cout << ceil(float(N) / 1000) * 1000 - N << endl;
  return 0;
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
  if(s[0] == 'o') ans++;
  if(s[1] == 'o') ans++;
  if(s[2] == 'o') ans++;
  //else anss = "NO";

  cout << 700 + 100*ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    set<int> s;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        s.insert(a);
    }
    if(s.size()==n){
        cout<<"YES\n";
    }else{
        cout<<"NO\n";
    }
    return(0);
}

Measured memory_bytes: 12936
use std::io::{self, BufRead};

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let xs: Vec<usize> = lines.next().unwrap().unwrap().split(' ').map(|x| x.parse().unwrap()).collect();
  let (n, m) = (xs[0], xs[1]);
  let mut cs = vec![None; n];
  for _ in 0..m {
    let xs: Vec<usize> = lines.next().unwrap().unwrap().split(' ').map(|x| x.parse().unwrap()).collect();
    let (s, c) = (xs[0] - 1, xs[1]);
    if s == 0 && c == 0 && n > 1 {
      println!("-1");
      return;
    }
    match cs[s] {
      None => cs[s] = Some(c),
      Some(d) => if c != d {
        println!("-1");
        return;
      },
    };
  }
  let mut ans = 0;
  for i in 0..n {
    match cs[i] {
      None    => ans = ans * 10 + (if i == 0 && n > 1 { 1 } else { 0 }),
      Some(c) => ans = ans * 10 + c,
    };
  }
  println!("{}", ans);
}

Measured memory_bytes: 4352
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
const int maxn=1e5;
int n,m,a,b,ans;
int fac[maxn*2+8],fact[maxn*2+8];

int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int C(int n,int m){return 1ll*fac[n]*fact[m]%mod*fact[n-m]%mod;}
int power(int a,int k)
{
    int sum=1;
    for (;k;k>>=1,a=1ll*a*a%mod)
	if (k&1)
	    sum=1ll*sum*a%mod;
    return sum;
}

int main()
{
    n=read(),m=read(),a=read(),b=read();
    fact[0]=fac[0]=1;
    for (int i=1;i<=n+m;i++) fac[i]=1ll*fac[i-1]*i%mod;
    fact[n+m]=power(fac[n+m],mod-2);
    for (int i=n+m-1;i;i--) fact[i]=1ll*fact[i+1]*(i+1)%mod;
    for (int i=1;i<=n-a;i++) ans=(ans+1ll*C(i-1+b-1,i-1)*C(n+m-i-b-1,n-i)%mod)%mod;
    printf("%d\n",ans);
    return 0;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int a, b, c, d; cin >> a >> b >> c >> d;
  cout<<min(a,b)+min(c,d)<<endl;
  

    return 0;
}


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

const int N = 310;
const int M = N * N;
const int moder = 998244353;

int dp[N][M];
int dp1[M];

int powermod(int a, int exp){
    int ret = 1;
    for ( ; exp > 0; exp >>= 1){
        if (exp & 1){
            ret = 1ll * ret * a % moder;
        }
        a = 1ll * a * a % moder;
    }
    return ret;
}

int main(){
    int n;
    scanf("%d", &n);
    dp[0][0] = dp1[0] = 1;
    int sum = 0;
    for (int i = 0; i < n; ++ i){
        int a;
        scanf("%d", &a);
        sum += a;
        for (int j = 0; j + a < M; ++ j){
            dp[i + 1][j + a] = dp[i][j];
        }
        for (int j = 0; j < M; ++ j){
            dp[i + 1][j] = (dp[i + 1][j] + 2ll * dp[i][j]) % moder;
        }
        for (int j = M; j >= 0; -- j){
            if (j + a < M){
                dp1[j + a] += dp1[j];
                dp1[j + a] -= dp1[j + a] >= moder ? moder : 0;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < M; ++ i){
        if (i * 2 >= sum){
            ans = (ans + 3ll * dp[n][i]) % moder;
        }
    }
    if (sum % 2 == 0){
        ans = (ans - 3ll * dp1[sum >> 1]) % moder;
        ans += ans < 0 ? moder : 0;
    }
    ans = (powermod(3, n) - ans) % moder;
    ans += ans < 0 ? moder : 0;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 114560
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;
typedef long long ll;
int num = 0;

void pretty_print(vector<int> &A) {
  cout << A[0];
  rep (i, A.size()-1) cout << ' ' << A[i+1];
  cout << endl;
}

void sort(vector<int> &A) {
  rep (i, A.size()) {
    for (int j = A.size() - 1; j > i; j--) {
      if (A[j] < A[j-1]) {
        swap(A[j], A[j-1]);
        num++;
      }
    }
  }
}

int main() {
  int N;
  cin >> N;

  vector<int> A(N);
  rep (i, N) cin >> A[i];
  sort(A);

  pretty_print(A);
  cout << num << endl;
}

Measured memory_bytes: 1196
#include<iostream>
#include<iomanip>
#include<stdio.h>

using namespace std;

int main()
{
    int i,j,k,n,m,l;
    cin >> n >> m >> l;
    int A[n][m];
    int B[m][l];
    long int C[n][l];
    long int sum=0;
    for(i = 0;i < n;i++){
        for(j = 0;j < m;j++){
            cin >> A[i][j];
        }
    }
    for(i = 0;i < m;i++){
        for(j = 0;j < l;j++){
            cin >> B[i][j];
        }
    }
    for(i = 0;i < n;i++){
        for(j = 0;j < l;j++){
            sum = 0;
            for(k = 0; k < m;k++){
                sum += A[i][k] * B[k][j];
            }
            C[i][j] = sum;
        }
    }
    for(i = 0;i < n;i++){
        for(j = 0;j < l;j++){
            if(j) cout << " ";
            cout << C[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3248
#include <iostream>
#include <algorithm>
using namespace std;

int n;
int a[2002];
int dp[2002][2];

int dfs(int id, int p) {
	int i;
	
	if (dp[id][p] != -1) return dp[id][p];
	
	int ret;
	if (p) ret = 1145141919;
	else ret = -1145141919;
	
	for (i = id + 1; i < n + 2; i++) {
		int res = dfs(i, !p);
		if (p) ret = min(ret, res);
		else ret = max(ret, res);
	}
	if (p) ret = min(ret, abs(a[n + 1] - a[id - 1]));
	else ret = max(ret, abs(a[n + 1] - a[id - 1]));
	return dp[id][p] = ret;
}

int main() {
	int i;
	cin >> n;
	for (i = 0; i < n + 2; i++) { cin >> a[i]; dp[i][0] = dp[i][1] = -1; }
	cout << dfs(2, 0) << endl;
	return 0;
}

Measured memory_bytes: 888
/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 5010;

ll N, A, B;
ll dp1[maxn]; // B blocks starting and ending at b
ll dp2[maxn]; // complement strings ending at b
ll ps[maxn];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> N >> A >> B;
    if (A > B) swap(A, B);

    dp1[1] = 1;
    for (ll i = 2; i <= B; ++i) {
        dp1[i] = dp1[i - 1];
        for (ll j = A; i - 1 - j >= 1; ++j) Add(dp1[i], dp1[i - 1 - j]);
    }
    dp2[0] = 1;
    ps[1] = 1;
    for (ll i = 1; i <= N; ++i) {
        for (ll j = 1; j < min(B, i + 1); ++j) {
            if (i == j) {
                Add(dp2[i], dp1[j + 1]);
            } else {
                ll s = (ps[i - j] - ps[max(0, i - j - A + 1)] + MOD) % MOD;
                Add(dp2[i], 1LL * dp1[j] * s);
            }
        }
        ps[i + 1] = (ps[i] + dp2[i]) % MOD;
    }

    ll sum = 0;
    for (ll i = N; i > N - A; --i) Add(sum, dp2[i]);
    for (ll i = N - A; i - 1 > N - B; --i) {
        for (ll j = i; j - 1 > N - B; --j) {
            ll s = (ps[j - 1] - ps[max(0, j - A)] + MOD) % MOD;
            Add(sum, 1LL * dp1[i - j + 1] * s);
        }
    }

    ll all = 1;
    for (ll i = 1; i <= N; ++i) Add(all, all);

    ll ans = (all + MOD - sum) % MOD;
    cout << ans << '\n';

}


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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

signed main () {
  cin.tie(0);
  cout << setprecision(10);


  int n, x; cin >> n >> x;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  int ans = 0;
  int i = 0;
  while(x > 0) {
    if(x < a[i] || i == n) break;
    else {
      x -= a[i];
      ans++;
    }
    i++;
  }

  if(x != 0 && ans == n) ans--;

  cout << ans << endl;
  
}


Measured memory_bytes: 256
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        
        int N  = int.Parse(Console.ReadLine());
        int[] input2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int max = -10;
        int min = 1000000001;
        for(int i = 0; i < N; i++)//最大値
        {
            max = Math.Max(max, input2[i]);
        }
        
        for(int i = 0; i < N; i++)//最小値
        {
        　　min = Math.Min(min, input2[i]);
        }
        
        int answer = max - min;
        Console.WriteLine(answer);
       
        
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            String S = in.next();

            StringBuilder res = new StringBuilder();
            for (int i = 0; i < S.length(); i++) {
                int n = S.charAt(i) - 'A';
                char c = (char) ('A' + (n + N) % 26);
                res.append(c);
            }

            System.out.println(res.toString());
        }
    }
}


Measured memory_bytes: 27668
/* All rights reserved.
* Author : yeguosheng
* FileName:
* Date : 2019-09-20-19.30.31
* Description : 141b
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstring>
#define lop(i,s,e)  for(int i = s;i <= e;i++)
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define inf 0x7fffffff
#define ll long long
#define esp 1e-9
using namespace std;
string s1;
vector<char> v1;
vector<char> v2;

int main()
{
    bool flag = true;
    cin>>s1;

    lop(i,0,s1.size()-1)
    {
        if( (i + 1 ) & 1 )
            v1.push_back( s1[i] );
        else
            v2.push_back(s1[i]);
    }
    vector<char>::iterator it;
    vector<char>::iterator it2;
    for(it = v1.begin(); it!=v1.end(); it++)
    {
        if(*it == 'R'|| *it =='U'|| *it=='D')
            flag = true;
        else
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    for(it2 = v2.begin(); it2!=v2.end(); it2++)
    {
        if(*it2=='L'||*it2=='U'||*it2=='D')
            flag = true;
        else
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, m] <- getIntList
    
    acs <- VM.new n
    VM.set acs (0 :: Int)
    was <- VM.new n
    VM.set was (0 :: Int)
    
    forM_ [1..m] $ \_ -> do
        [p, s] <- words <$> getLine
        let i = read p - 1 :: Int
        ac <- VM.read acs i
        if s == "AC"
            then VM.write acs i 1
            else when (ac == 0) $ do
                wa <- VM.read was i
                VM.write was i (wa + 1)

    ans <- VM.new 2
    VM.set ans (0 :: Int)
    
    forM_ [0..(n - 1)] $ \i -> do
        ac <- VM.read acs i
        wa <- VM.read was i
        when (ac > 0) $ do
            a0 <- VM.read ans 0
            VM.write ans 0 (a0 + 1)
            a1 <- VM.read ans 1
            VM.write ans 1 (a1 + wa)

    a0 <- VM.read ans 0
    a1 <- VM.read ans 1
    
    putStrLn $ show a0 ++ " " ++ show a1


Measured memory_bytes: 2684
def dijekstra(start, nodes, value_as_dist)
  n = nodes.size
  dist = Array.new(n) { Float::INFINITY }
  is_fixed = Array.new(n) { false }
  queue = [*0...n]
  
  dist[start] = 0
  is_fixed[start] = true
  
  until queue.empty?
    queue.sort_by! { |i| dist[i] }
    
    tmp = queue.shift
    is_fixed[tmp] = true
    
    nodes[tmp].each do |from, to, cost, time|
      next if is_fixed[to]
      new_len = dist[from] + (value_as_dist == 0 ? cost : time)
      
      if new_len < dist[to]
        dist[to] = new_len
      end
    end
  end
  
  dist
end

while true
  n, m = gets.split.map(&:to_i)

  break if n + m == 0

  nodes = Array.new(m) { [] }
  memo = Array.new(m) { Array.new(2) }

  n.times do
    a, b, cost, time = gets.split.map(&:to_i)
    a -= 1
    b -= 1
    
    nodes[a] << [a, b, cost, time]
    nodes[b] << [b, a, cost, time]
  end
  
  gets.to_i.times do
    p_k, q_k, r_k = gets.split.map(&:to_i)
    p_k -= 1
    q_k -= 1

    memo[p_k][r_k] = dijekstra(p_k, nodes, r_k) if memo[p_k][r_k].nil?
    
    puts memo[p_k][r_k][q_k]
  end
end

Measured memory_bytes: 11300
#include <stdio.h>
char a[16];
int main(void)
{
    while (scanf("%s", a) != EOF) {
        int i, j;
        char res=0;
        for (i=0; i<3; ++i) {
            if (a[3*i] != 's' && a[3*i] == a[3*i+1] && a[3*i] == a[3*i+2]) {
                res=a[3*i];
                break;
            }
        }
        if (!res) for (i=0; i<3; ++i) {
            if (a[i] != 's' && a[i] == a[i+3] && a[i] == a[i+6]) {
                res=a[i];
                break;
            }
        }
        if (!res) {
            if (a[0] != 's' && a[0] == a[4] && a[0] == a[8]) {
                res=a[0];
            }
            else if (a[2] != 's' && a[2] == a[4] && a[2] == a[6]) {
                res=a[2];
            }
        }
        if (!res) res='d';
        printf("%c\n", res);
    }
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
bool student[31] = { false };
int main(){
	int n;
	for (int i = 0; i < 28; ++i){
		std::cin >> n;
		student[n] = true;
	}
	for (int i = 1; i < 31; ++i){
		if (!student[i])std::cout << i << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>
#include <math.h>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

int main(){
    int n;
    while(cin>>n){
        n=n%39;
        //cout<<n<<endl;
        if(n==0)cout<<"3C"<<39<<endl;
        else if(n<10)cout<<"3C0"<<n<<endl;
        else cout<<"3C"<<n<<endl;
    }
}

Measured memory_bytes: 1160
#include <stdio.h>

int getGCD(int a, int b) {
    if (b == 0) {
        return a;
    }
    
    return getGCD(b, a % b);
}

int main(void) {
    int N = 0, K = 0;
    int M = 0, G = 0;
    int i = 0;
    int arr[100000] = {0, };
    
    scanf("%d %d", &N, &K);
    
    for (i=0;i<N;i++) {
        scanf("%d", &arr[i]);
        if (M < arr[i]) {
            M = arr[i];
        }
    }
    
    G = arr[0];
    
    for (i=1;i<N;i++) {
        G = getGCD(G, arr[i]);
    }
    
    if (K <= M && K % G == 0) {
        printf("POSSIBLE\n");
    } else {
        printf("IMPOSSIBLE\n");
    }

    return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()

if S[2] == S[3] and S[4] == S[5]:
    Yes()
else:
    No()


Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;
typedef long long ll;

const int COST[10] = {6,2,5,5,4, 5,6,3,7,6};

int gcd(int a, int b) {
  return b == 0 ? a : gcd(b, a % b);
}

bool canUse[10];
vector<int> dsByCost;

bool cmp(int d1, int d2) {
  if(COST[d1] != COST[d2]) return COST[d1] < COST[d2];
  return d1 > d2;
}

struct K {
  int n, len;
};

int visited[10001][5001];
int counter;

bool isPossible(int n, int len) {
  if(n < 0 || len < 0) {
    return false;
  }
  ++counter;
  queue<K> q;
  q.push((K){n, len});
  visited[n][len] = counter;
  
  while(!q.empty()) {
    K cur = q.front(); q.pop();
    // cerr << cur.n << " " << cur.len << endl;
    int minCost = COST[dsByCost[0]] * cur.len;
    if(minCost > cur.n) {
      continue;
    }
    if(minCost == cur.n) {
      // cerr << "> " << cur.n << " " << cur.len << endl;
      return true;
    }
    for(int d : dsByCost) {
      K next = {cur.n-COST[d], cur.len-1};
      if(next.n >= 0 && next.len >= 0 && visited[next.n][next.len] != counter) {
        q.push(next);
        visited[next.n][next.len] = counter;
      }
    }
  }
  return false;
}

void go(int n) {
  // cerr << "go " << n << endl;
  // if(n == 0) {
  //   puts("");
  //   return;
  // }
  int minCost = COST[dsByCost[0]];
  int maxLen = n / minCost;
  if(n % minCost == 0) {
    REP(i, maxLen) {
      printf("%d", dsByCost[0]);
    }
    puts("");
    return;
  }
  for(int targetLen = maxLen; ; --targetLen) {
    for(int d = 9; d > 0; --d) {
      if(!canUse[d]) {
        continue;
      }
      if(isPossible(n-COST[d], targetLen-1)) {
        printf("%d", d);
        go(n-COST[d]);
        return;
      }
    }
  }
}

int main(void) {
  int n, m;
  cin >> n >> m;
  REP(i, m) {
    int d;
    cin >> d;
    canUse[d] = true;
    dsByCost.push_back(d);
  }
  sort(dsByCost.begin(), dsByCost.end(), cmp);
  // for(int d : dsByCost) {
  //   cerr << d << " ";
  // }
  // cerr << endl;
  go(n);
  
  return 0;
}


Measured memory_bytes: 193408
def even(n):
    return n//2

 
def odd(n):
    return 3*n + 1


s = int(input())
a = [s]
count = 1
while 1:
    if a[count-1] % 2 == 0:
        a.append(even(a[count-1]))
    else:
        a.append(odd(a[count-1]))
    count += 1
    if a[-1] in a[:-1]:
        print(count)
        quit() 


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>

using namespace std;
typedef long long ll;
///定義場所///
int i, j, k, l, m, n;
int N, M, K;
ll MOD = 1000000007;
int ans = 0;

//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<int ,int> firstElof, pair<int,int> secondElof)
{
	return firstElof.second > secondElof.second;
}
int Keta(ll F) {
	int keta = 1;
	while (F/10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
//////////////

int main()
{
	cin >> N >> M;
	vector<int> A(M);
	vector<int> judge(N+1);
	for (i = 0; i <= N; i++) {
		judge[i] = 1;
	}
	for (i = 0; i < M; i++) {
		cin >> A[i];
		judge[A[i]] = 0;
	}
	vector<ll> dp(N+1);
	dp[0] = 1;
	for (i = 1; i <= N; i++) {
		if (judge[i] == 0) {
			dp[i] = 0;
		}
		else if(i==1){
			dp[1] = 1;
		}
		else {
			dp[i] = (dp[i - 1] + dp[i - 2])%MOD;
		}
	}
	cout << dp[N];
}

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

using namespace std;

int main()
{
  int N, S[200000];

  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &S[i]);
  }

  for(int i = 1; i <= N; i++) {
    if(N % i == 0) {
      bool match = true;
      for(int j = i; j < N; j += i) {
        for(int k = 0; k < i; k++) match &= S[k] == S[j + k];
      }
      if(match) {
        cout << N / i << endl;
        return (0);
      }
    }
  }
}

Measured memory_bytes: 4020
#define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v){os << " [" << i++ << "]" << x; if (i % 10 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll N, M;
  std::cin >> N >> M;
  std::vector< std::pair<ll, ll> > vp(M);
  std::vector<ll> vc(N);
  for (ll i = 0; i < M; i++) {
    std::cin >> vp[i].first >> vp[i].second;
    vp[i].first--;
    vp[i].second--;
    vc[vp[i].first]++;
    vc[vp[i].second]++;
  }

  for (auto cnt : vc) {
    print(cnt);
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int x[8][3]={{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
int main(){
	char str[9];
	while(cin>>str){
		char win='d';
		for(int i=0;i<8;i++){
			if(str[x[i][0]]=='o' && str[x[i][1]]=='o' && str[x[i][2]]=='o') win='o';
			if(str[x[i][0]]=='x' && str[x[i][1]]=='x' && str[x[i][2]]=='x') win='x';
			if(win=='o' || win=='x') break;
		};
	cout << win << '\n' ;
	};
}

Measured memory_bytes: 1100
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  s:string;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Readln(s);
    s[6]:=' ';
    s[14]:=' ';
    Writeln(s);
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
double t[110] = {}, v[110] = {};
double min_val[50000];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    double t_sum = 0;
    rep(i,1,N+1){
        cin >> t[i];
        t_sum += t[i];
    }
    rep(i,1,N+1){
        cin >> v[i];
    }
    t[N+1] = 0;
    v[N+1] = 0;
    double ans = 0;
    // printa(t,N+2);
    // printa(v,N+2);
    rep(i,0,2 * t_sum + 1){
        double now_time = 0.5 * i;
        double val = INF;
        double tt = 0;
        rep(j,0,N+2){
            // print(tt);
            if(tt > now_time){
                val = min(val, v[j] + tt - now_time);
            }else if(tt + t[j] < now_time){
                val = min(val, v[j] + now_time - (tt + t[j]));
                // print(val);
            }else{
                val = min(val, v[j]);
            }
            tt += t[j];
            // print(tt);
        }
        // print(val);
        min_val[i] = max(val,0.0);
    }
    rep(i,1,2*t_sum + 1){
        ans += 0.25 * (min_val[i-1] + min_val[i]);
    }
    cout << setprecision(10) << ans << endl;


}


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

int main(){
  string a, b;
  cin >> a >> b;
  int s = a.size();
  int t = b.size();

  if (s - t == 0){
  for (int i = 0; i < s; i++){
     cout << a[i] << b[i];
  }
}
else{
  for (int i = 0; i < s-1; i++){
     cout << a[i] << b[i];
  }
     cout << a[s-1];
}
}

Measured memory_bytes: 3600
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int m, n;
	int i;
	queue <long long int>a;
	cin >> n;
	for (i = 1; i < 10; i++) {
		a.push(i);
	}
	for (i = 1; i < n; i++) {
		m = a.front() % 10;
		if (m != 0 && m != 9) {
			a.push((a.front() * 10) + m - 1);
			a.push((a.front() * 10) + m);
			a.push((a.front() * 10) + m + 1);
		}
		else if(m == 0) {
			a.push((a.front() * 10) + m);
			a.push((a.front() * 10) + m + 1);
		}
		else if (m == 9) {
			a.push((a.front() * 10) + m - 1);
			a.push((a.front() * 10) + m);
		}
		a.pop();
	}
	cout << a.front() << endl;
		return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

// Dual Segment Tree
template <class OM> struct DST {
    int n, lev;
    vector<OM> lz;
    virtual OM h(OM, OM) = 0;
    const OM e0;

    DST(int n_, const OM& e0) : e0(e0) {
        for (n = 1, lev = 0; n < n_; n <<= 1, ++lev);
        lz.assign(n << 1, e0);
    }

    inline void push(int k) {
        for (int i = lev; i > 0; --i) {
            int j = k >> i;
            if (lz[j] == e0) continue;
            lz[(j << 1) | 0] = h(lz[(j << 1) | 0], lz[j]);
            lz[(j << 1) | 1] = h(lz[(j << 1) | 1], lz[j]);
            lz[j] = e0;
        }
    }

    // [l, r)
    // l, r: 0-indexed
    void update(int l, int r, const OM& x) {
        push(l += n);
        push(r += n - 1);
		for (++r; l < r; l >>= 1, r >>= 1) {
            if (l & 1) lz[l] = h(lz[l], x), l++;
            if (r & 1) --r, lz[r] = h(lz[r], x);
		}
    }

    // k: 0-indexed
    OM query(int k) {
        push(k += n);
        return lz[k];
    }
};

// Range Update Query (RUQ)
template <class OM> struct RUQ : DST<OM> {
    RUQ(int n, OM e0 = numeric_limits<OM>::max()) : DST<OM>(n, e0) {}
    OM h(OM a, OM b) override { return b; }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin >> n >> q;
    RUQ<int> ruq(n, (1LL << 31) - 1);
    REP (i, q) {
        int c;
        cin >> c;
        if (c == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            ruq.update(s, t + 1, x);
        } else {
            int j;
            cin >> j;
            cout << ruq.query(j) << endl;
        }
    }
}


Measured memory_bytes: 4936
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;

int main() {
  int n;
  cin >> n;
  int x[110];
  int min = 10000000;

  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  for (int i = 0; i < 100; i++) {
    int tmp = 0;
    for (int j = 0; j < n; j++) {
      tmp += pow((x[j]-i), 2.0);
    }
    if (min > tmp) {
      min = tmp;
    }
  }

  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int x[] = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt() - (i + 1);
		}

		Arrays.sort(x);

		int d = x[n / 2];
		long sadness = 0;
		for (int i = 0; i < n; i++) {
			sadness += Math.abs(x[i] - d);
		}

		System.out.println(sadness);
	}

}


Measured memory_bytes: 64684
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

string EnqDeq_str(string s){
    char tmp;
    tmp = s[0];
    for(int i=0; i<s.size()-1; i++){
        s[i] = s[i+1];
    }
    s[s.size()-1] = tmp;
    return s;
}

string getSubStr(string s, int i, int j){
    vector<string> tmp(j-i+1);
    for(int h=0; h<j-i+1; h++){
        tmp[h] = s[i+h];
    }
    string subStr;
    for(int h=0; h<j-i+1; h++){
        subStr += tmp[h];
    }
    return subStr;
}

int main(){

    string s, p;
    cin >> s;
    cin >> p;

    for(int i=0; i<s.size(); i++){
        if(p==getSubStr(s,0,p.size()-1)){
            cout << "Yes" << endl;
            return 0;
        }
        s = EnqDeq_str(s);
    }

    cout << "No" << endl;

    return 0;
}



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

int main() {
  int n;
  int i = 1;
  int sum = 0;
  vector<int> vec(100005);
  vector<bool> jud(100005);
  
  cin >> n;
  rep(i, n)
    cin >> vec.at(i + 1);
  
  do{
    
    if(jud.at(i) == false){
      jud.at(i) = true;
      i = vec.at(i);
      sum++;
    }
    else{
      sum = -1;
      break;
    }
      
  } while(i != 2);
  
  cout << sum << endl;

}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int sort[100]={};
    int count=0,flag=0;
    
    for(int i=0;i<N;i++){
        cin>>sort[i];
    }

    int x=0;
    for(int i=N-1;i>0;i--){
        for(int j=0;j<i;j++){
            if(sort[j+1]<sort[j]){
                x=sort[j+1];
                sort[j+1]=sort[j];
                sort[j]=x;
                count++;
            }
            flag=1;
        }
    }
  
    for(int k=0;k<N-1;k++){
            cout<<sort[k]<<" ";
        }
    cout<<sort[N-1]<<endl;
    cout<<count<<endl;
        
    
    
    return 0;
}


Measured memory_bytes: 3080
#include <stdio.h>

int main(){
  int N,X,T;
  scanf("%d %d %d",&N,&X,&T);
  
  int C=0;
  while(N>0){
    N=N-X;
    C=C+1;
    }
  
  printf("%d\n",C*T);
  return 0;
}

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

using namespace std;

long long MOD=998244353, D[301][90001], D2[90001], S1, S2=0, Su=0;

long long Power(long long a, long long k)
{
    long long t=1, S=a, R=1;
    while (k > 1)
    {
        if (k % (2*t) != 0)
        {
            k -= t;
            R *= S;
            R %= MOD;
        }
        S *= S;
        S %= MOD;
        t *= 2;
    }
    return R;
}

int main()
{
    int n, a;
    cin >> n;
    S1 = Power(3, n);
    for (int i = 0; i <= 90000; i++)
    {
        D[0][i] = 0;
        D2[i] = 0;
    }
    D[0][0] = 1;
    D2[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        cin >> a;
        Su += a;
        for (int y = 90000; y >= 0; y--)
        {
            D[i][y] = 2*D[i-1][y];
            if (y-a >= 0)
            {
                D[i][y] += D[i-1][y-a];
                D2[y] += D2[y-a];
            }
            D[i][y] %= MOD;
            D2[y] %= MOD;
        }
    }
    for (int i = (Su+1)/2; i <= Su; i++)
    {
        S2 += D[n][i];
    }
    S1 -= 3*S2;
    if (Su % 2 == 0)
    {
        S1 += 3*D2[Su/2];
    }
    while (S1 < 0)
    {
        S1 += MOD;
    }
    S1 %= MOD;
    cout << S1;
    return 0;
}


Measured memory_bytes: 212608
#include <iostream>
#include <vector>
#include <algorithm>

class Grouping {
public:
	Grouping() {};

	int serch(int x) {
		std::vector<int>::iterator itr;
		itr = find(groupe1.begin(), groupe1.end(), x);
		if (itr != groupe1.end()) {
			return 1;
		}

		itr = find(groupe2.begin(), groupe2.end(), x);
		if (itr != groupe2.end()) {
			return 2;
		}

		return 3;
	}

private:
	std::vector<int> groupe1 = {1, 3, 5, 7, 8, 10, 12};
	std::vector<int> groupe2 = { 4, 6, 9, 11 };
};

int main() {
	Grouping g;
	int x, y;

	std::cin >> x >> y;

	if (g.serch(x) == g.serch(y)) {
		std::cout << "Yes" << std::endl;
	}
	else { std::cout << "No" << std::endl; }
}

Measured memory_bytes: 256
x1,y1,x2,y2 = map(int,input().split())

vx = x2-x1
vy = y2-y1

x3 = x2-vy
y3 = y2+vx

x4 = x3-vx
y4 = y3-vy

print(x3,y3,x4,y4)

Measured memory_bytes: 38512
import java.util.*;
public class Main {
	public static void main(String[] args){
      
		Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int x = sc.nextInt();
      
        int[] bound = new int[n];
        int[] d = new int[n+1];
      
        int count = 0;
      
        for(int cr=0; cr<n; cr++){
            bound[cr] = sc.nextInt();
        }
      
        d[0]= 0;
      
        for(int cr=1; cr<n+1; cr++){
            d[cr] = d[cr-1] + bound[cr-1];
        }
      
       for(int num:d){
         if(num <= x){
           count++;
         }
       }
       System.out.println(count);        
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main()
{
 
  int n;
  cin>>n;
  map<int,int>m;
  set<int>a;
  for(int i=0;i<n;i++)
  {
    int t;
    cin>>t;
    a.insert(t);
    m[t]++;
  }
  int count=0;
  set<int>::iterator it=a.end();
  it--;
  vector<int>b((*it)+1,1);
  for(auto x:a)
  {
    if(m[x]>1)
    {
      b[x]=0;
    }
    int i=2;
    while((x*i)<=*it)
    {
      assert(x*i<b.size());
      b[x*(i++)]=0;
    }
  }
  for(auto x:a)
  {
    if(b[x])
    {
      count++;
    }
  }

  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 25896
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; 
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'
 
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 
 
const int MXN = 2e5 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
 
int N;
ll DP[(1<<21) + 5][22];
bool adj[25][25], vis[(1<<21)+5][22];

ll dp(int women, int i){
    if (i > N && women + 1 == (1<<N)) return 1;
    if (vis[women][i]) return DP[women][i];
    vis[women][i] = 1;
    FOR(j,1,N+1){
        if (adj[i][j] && !(women & (1<<(j-1)))){
            DP[women][i] = (DP[women][i] + dp(women | (1<<(j-1)), i+1)) % INF;
        }
    }
    return DP[women][i];
}

int main(){ FAST
    //ifstream cin("/Users/konwoo/input.txt");
    //ofstream cout("/Users/konwoo/output.txt");

    cin >> N;
    FOR(i,1,N+1){
        FOR(j,1,N+1){
            cin >> adj[i][j];
        }
    }
    finish(dp(0,1))


 
 
 
 
 
 
 
 
 
 
 
 
 
 
    return 0;
}


Measured memory_bytes: 405760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void){
  int N, M;
  cin >> N >> M;
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> que;
  for(int i=0; i<N; i++){
    ll tmpA; int tmpB;
    cin >> tmpA >> tmpB;
    que.push(make_pair(tmpA, tmpB));
  }
  ll ans = 0;
  int m = M;
  while(1){
    auto tmp = que.top(); que.pop();
    int pc = min(tmp.second, m);
    ans += pc*tmp.first;
    m -= pc;
    if(m == 0) break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
K,N=map(int,input().split())
A=list(map(int,input().split()))
max_ans=0
for i in range(N):
    if i==N-1:
        ans=K-A[N-1]+A[0]
    else:
        ans=A[i+1]-A[i]
    if max_ans<ans:
        max_ans=ans
ans=K-max_ans
print(ans)

Measured memory_bytes: 26436
a=65280; b=61680; c=52428; d=43690; e=65535
from heapq import heappush, heappop
base = [a, b, c, d, e, 0]
Q = [(1, el) for el in base]
L = {el: 1 for el in base}
H = []
while Q:
    l, p = heappop(Q)
    if L[p] < l: continue
    if l+1 < L.get(p ^ e, 17):
        L[p ^ e] = l+1
        if l+1 < 16: heappush(Q, (l+1, p ^ e))
    if l+3 < 16:
        for q, r in H:
            if l+r+3 <= 16:
                if l+r+3 < L.get(p & q, 17):
                    L[p & q] = l+r+3
                    if l+r+3 < 16: heappush(Q, (l+r+3, p & q))
                if l+r+3 < L.get(p ^ q, 17):
                    L[p ^ q] = l+r+3
                    if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))
            else: break
    if l < 7: H.append((p, l))
print(*map(L.__getitem__, eval("e&%s"%",e&".join(open(0).read().replace(*"-~").replace(*"*&").replace(*"1e").split()[:-1]))),sep='\n')

Measured memory_bytes: 8532
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using i_i = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const ll mod = 1000000007LL;


int main() {
	int n;
	cin >> n;
	vector<ll> x(n);
	vector<ll> y(n);
	
	rep(i, n) {
		ll tx, ty;
		cin >> tx >> ty;

		x[i] = tx + ty;
		y[i] = tx - ty; 
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	ll dx = x[n - 1]- x[0]; 
	ll dy = y[n - 1]- y[0];

	cout << max(dx, dy) << endl; 




	return 0;
}


Measured memory_bytes: 5920
use std::cmp;
use std::collections::*;

pub struct Scanner {
    line: Vec<String>,
    idx: usize,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        return Scanner {
            line: vec![],
            idx: 0,
        };
    }
    fn next<T: std::str::FromStr>(&mut self) -> T {
        if self.idx == self.line.len() {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).ok();
            let a: Vec<&str> = buffer.trim().split(' ').collect();
            self.line = a.iter().map(|&s| String::from(s)).collect();
            self.idx = 0;
        }
        let ret: T = self.line[self.idx].parse::<T>().ok().expect("Parse error.");
        self.idx += 1;
        ret
    }
    fn next_string(&mut self) -> Vec<char> {
        let s: String = self.next();
        return s.chars().collect::<Vec<char>>();
    }
    fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut v: Vec<T> = Vec::with_capacity(n);
        for _i in 0..n {
            v.push(self.next());
        }
        v
    }
}


fn main(){
    let mut scan = Scanner::new();
    let a: u64 = scan.next();
    let b: u64 = scan.next();
    let n: u64 = scan.next();
    let x = cmp::min(n, b - 1);
    let ans = a*x/b - a*(x/b);
    println!("{}", ans);
}


Measured memory_bytes: 2120
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;


int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	vi h(n);
	for (int i = 0; i < n; i++)
		cin >> h[i];
	int mx = 0;
	int cur = 0;
	for (int i = 1; i < n; i++)
	{
		if (h[i] <= h[i - 1])
			cur++;
		else
			cur = 0;
		mx = max(cur, mx);
	}
	cout << mx;
	return 0;
}

Measured memory_bytes: 640