akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  for (int i = 0; i < 10000; i++) {
    int x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    }
    cout << min(x,y) << " " << max(x,y) << endl;
  }
}


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}

int64_t dp[3001][3001];

int main(){
    int N, M;
    string S;
    int L[3001], R[3001], sum[3001];

    cin >> N >> M >> S;
    for(int i=0; i<M; i++){
        cin >> L[i] >> R[i];
        L[i]--; R[i]--;
    }
    for(int i=0; i<N; i++){
        sum[i] = i>0 ? sum[i-1] : 0;
        if(S[i] == '1') sum[i]++;
    }

    dp[0][0] = 1;
    int pt = 0, right = 0;
    for(int i=0; i<N; i++){
        while(pt<M && L[pt] <= i){
            right = max(right, R[pt]);
            pt++;
        }
        right = max(right, i);

        int mn = max(0, sum[right] - (right-i));
        int mx = sum[right];
        for(int j=mn; j<=mx; j++){
            add(dp[i+1][j], dp[i][j]);
            if(j>0) add(dp[i+1][j], dp[i][j-1]);
        }
    }

    cout << dp[N][sum[N-1]] << endl;
    return 0;
}

Measured memory_bytes: 68352
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S; cin >> S;
  vector<string> strs = {"dream", "dreamer", "erase", "eraser"};
  vector<bool> dp(100010, 0);
  dp.at(0) = 1;
  for(int i = 0; i < S.size(); i++) {
    if(!dp.at(i)) continue;
    for(string s : strs) {
      if(S.substr(i, s.size()) == s) {
        dp.at(i + s.size()) = 1;
      }
    }
  }
  cout << (dp.at(S.size()) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 2005;

vector<int> a[11];
vector<int> b[11];
int dp[11][MAX_N];
int n,K;

int main()
{
	int x,y;
	scanf("%d%d",&n,&K);
	rep(i,n){
		scanf("%d%d",&x,&y);
		a[y-1].push_back(x);
	}
	rep(i,10){
		sort(a[i].begin(),a[i].end(),greater<int>());
	}
	rep(i,10){
		int suma = 0;
		rep(j,a[i].size()){
			suma += a[i][j] + 2*j;
			b[i].push_back(suma);
		}
	}
	rep(j,K+1){
		dp[0][j] = 0;
	}
	rep(i,10){
		rep(j,K+1){
			dp[i+1][j] = dp[i][j];
			for(int k=1;k<=min((int)b[i].size(),j);k++){
				dp[i+1][j] = max(max(dp[i+1][j],dp[i][j]),dp[i][j-k]+b[i][k-1]);
			}
		}
	}
	printf("%d\n",dp[10][K]);
	return 0;
}

Measured memory_bytes: 3384
s = input()

n=len(s)
if n%2==0:
  s_left = s[:n//2]
  s_right = s[n//2:]
else:
  s_left = s[:n//2]
  s_right = s[n//2+1:]
  
s_right = s_right[::-1]
  
count=0
for r,l in zip(s_left, s_right):
  if r!=l:
    count+=1
print(count)

Measured memory_bytes: 3064
n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n)]
rank = [0 for x in range(n)]

def root(x):
	tmp = par[x]
	if tmp == x:
		return x
	else:
		a = root(tmp)
		par[x] = a
		return a

def merge(x, y):
	x = root(x)
	y = root(y)
	if x == y:
		return
	else:
		if rank[x] > rank[y]:
			par[y] = x
			rank[y] += rank[x]
		else:
			par[x] = y
			rank[x] += rank[y]
		return

for i in range(m):
	x, y = map(int, input().split())
	merge(x-1, y-1)

ans = 0

for i in range(n):
	if p[i]-1 == i:
		ans += 1
	elif root(p[i]-1) == root(i):
		ans += 1

print(ans)

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

using namespace std;

#define int long long
#define MOD 1000000007

#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int k, x;

signed main()
{
    cin >> k >> x;

    int c = (k - 1) * 2;

    rep(i, c + 1)
    {
        cout << x - (k - 1) + i << " ";
    }

    cout << endl;

    return 0;
}


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

bool prime[100000+10];

void sieve()
{
    memset(prime, true, sizeof(prime));
    prime[0] = false;
    prime[1] = false;
    for(int i=2; i<=100010/i; i++)
    {
        if(prime[i]==true)
        {
            for(int j = i*2; j<100010; j+=i)
            {
                prime[j] = false;
            }
        }
    }
}

int main()
{
    sieve();
    int n;
    cin >> n;
    while(prime[n]==false){
        n++;
    }
    cout << n << endl;
    return 0;
}


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;

int main(){
  int n,ans;
  cin >> n;
  int t = n / 100;
  if(t * 111 < n) ans = (t + 1) * 111;
  else ans = t * 111;
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
int main()
{
  int n;
  std::cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, px, py, r;
    std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double c = 2.0 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
    px = ((y3 - y1) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (y1 - y2) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    py = ((x1 - x3) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (x2 - x1) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    r = sqrt(pow(x1 - px, 2) + pow(y1 - py, 2));
    std::cout << std::fixed << std::setprecision(3) << px << " " <<
      py << " " << r << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1292
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		if(n % 2 == 0) {
			System.out.println(n/2);
		}
		else {
			System.out.println((n+1)/2);
		}
	}

}


Measured memory_bytes: 23892
#include<stdio.h>
#include<stdlib.h>

int head=0,tail,n;
typedef struct{
  char name[100];
  int time;
}Process;

Process Q[1000000];

Process dequeue(){
  tail++;  
  return Q[tail-1];
}

void enqueue(Process x){
  Q[head]=x;
  head++;
}


main(){
  int q,i,total=0;
  Process x;
  scanf("%d %d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s %d",x.name,&x.time);
    enqueue(x);  
  }
  while(1){
    x = dequeue();
    if(x.time <= q){
      total += x.time;
      printf("%s %d\n",x.name,total);
    }
    else{
      x.time -=q;
      total+=q;
      enqueue(x);
    }
    if(head == tail)break;
  }
  return 0;
}

Measured memory_bytes: 21072
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;
string S;

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

    char last = '?';
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (last == S[i]) continue;
        ans++;
        last = S[i];
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
use std::io::Read;

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 k: usize = iterator.next().unwrap().parse().unwrap();

    let vec = construct(k);

    return format!("{}", vec[k - 1]);
}

fn construct(k: usize) -> Vec<usize> {
    let mut phase: Vec<usize> = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];

    let mut result: Vec<usize> = Vec::new();
    result.extend(phase.iter());

    while result.len() < k {
        let mut next_phase: Vec<usize> = Vec::new();
        for l in phase {
            let generated = generate(l);
            next_phase.extend(generated);
        }
        result.extend(next_phase.iter());
        phase = next_phase;
    }
    result
}

fn generate(l: usize) -> Vec<usize> {
    let mut result: Vec<usize> = Vec::new();
    let last = l % 10;
    if last == 0 {
        result.push(l * 10 + 0);
        result.push(l * 10 + 1);
    } else if last == 9 {
        result.push(l * 10 + 8);
        result.push(l * 10 + 9);
    } else {
        result.push(l * 10 + last - 1);
        result.push(l * 10 + last);
        result.push(l * 10 + last + 1);
    }
    return result;
}


Measured memory_bytes: 6396
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 100
#define DIVISOR 1000000007

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    char *tmp = strtok(line, " ");
    int k = strtol(tmp, NULL, 10);
    for(i = 0; i < k; i++) {
        char *tmp = strtok(NULL, " ");
        arr[i] = strtol(tmp, NULL, 10);
    }
#else
#error
#endif
    return k;
}

#define NUM_MAX 18
#define K_MAX 18

int main(void) {
    int arr[NUM_MAX+1];
    int num = get_int();
    int k = fget_array(arr, K_MAX+1);
    int i;
    int match = 0;
    for(i = 0; i < k; i++) {
        match |= (1<<arr[i]);
    }
#ifdef DEBUG
    printf("match: %d\n", match);
#endif

    int pat;
    for(pat = 0; pat < (1<<num); pat++) {
        if((pat & match) != match) continue;
        printf("%d:", pat);
        for(i = 0; i < num; i++) {
            if(!(pat & (1<<i))) continue;
            printf(" %d", i);
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2088
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep))
    {
        v.push_back(buffer);
    }
    return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
    return accumulate(begin, end, 0ll);
}

void solve();

signed main()
{
    cout << fixed << setprecision(20);
    solve();
    while (true)
    {
        char s[MAX];
        if (scanf("%s", s) == EOF)
            break;
        int n = strlen(s);
        for (int i = n - 1; i > -1; i--)
        {
            ungetc(s[i], stdin);
        }
        solve();
    }
    return 0;
}

class Mycin {
	bool flag = true;
public:
	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
	operator bool() {return flag;}
} mycin;
 
class Mycout {
public:
	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
	Mycout& operator << (const char c) {printf("%c", c); return *this;}
	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
} mycout;
 
#define cin mycin
#define cout mycout
#define endl '\n'

int N;
int a[105];

void solve() {
    cin >> N;
    rep(i, N) cin >> a[i];
    sort(a, a+N);
    cout << a[N-1] - a[0] << endl;    
}


Measured memory_bytes: 256
# coding: utf-8
import sys
input = sys.stdin.readline

N, Q = [int(i) for i in input().split()]
S = input()
is_AC = [False] * N
AC_csum = [0] * N
for i in range(N):
  is_AC[i] = S[i:i+2] == "AC"
  AC_csum[i] = AC_csum[i-1] + is_AC[i]

for i in range(Q):
  l, r = [int(i) for i in input().split()]
  ans = AC_csum[r-1] - AC_csum[l-1] - is_AC[r-1] + is_AC[l-1]
  print(ans)


Measured memory_bytes: 8732
#include<iostream>
#include<vector>
using namespace std;

int main(){

    //inport
    int N;
    cin >> N;

    int V[N],C[N];
    //process
    for(int n;n<N;n++){
        cin >> V[n];
    }
    
    for(int n;n<N;n++){
        cin >> C[n];
    }

    int result = 0;
    
    for(int n;n<N;n++){
        int tmp = V[n] - C[n];
        if(tmp>0){
            result += tmp;
        }
    }

    //output
    cout << result << endl;

    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  int n,t,a;cin>>n>>t>>a;

  double diff;cin>>diff;
  diff = abs(a-(t-diff*0.006));
  int result=1;

  rep(i,n-1){
    double tt;cin>>tt;
    double td=abs(a-(t-tt*0.006));
    if(td<diff){
      result=i+2;
      diff=td;
    }
  }

  cout<<result;

  return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[0] * (m+1) for _ in range(n+1)]

for i in range(n):
    for j in range(m):
        dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j] - dp[i][j]) % MOD
        if s[i] == t[j]:
            dp[i+1][j+1] += dp[i][j] + 1
            dp[i+1][j+1] %= MOD

print((dp[n][m]+1) % MOD)


Measured memory_bytes: 72540
# coding: utf-8
# Your code here!
from collections import deque
N,Q = map(int,input().split())
tree = {}
px = []
counter = [0 for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    if a in tree:
        tree[a].append(b)
    else:
        tree[a] = [b]
    if b in tree:
        tree[b].append(a)
    else:
        tree[b] = [a]
for _ in range(Q):
    ip,ix = map(int,input().split())
    counter[ip-1] += ix


oya = deque([1])

while oya:
    oyai = oya.popleft()
    for ko in tree[oyai]:
        tree[ko].remove(oyai)
        counter[ko-1] += counter[oyai-1]
        oya.append(ko)




print(' '.join(map(str,counter)))


Measured memory_bytes: 77480
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>

using namespace std;

int main(){
    long long X,Y;
    cin >> X >> Y;

    vector<long long> A;
    A.push_back(X);
    long long now = X;
    while(1){
        now = now * 2;
        if(now <= Y){
            A.push_back(now);
        }else{
            break;
        }
    }

    cout << A.size() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int N, X;
    scanf("%i %i",&N,&X);
    int array[N];
    scanf("%i", &array[0]);
    int sum = array[0], min = array[0];
    for (int i = 1; i < N; i++)
    {
        scanf("%i", &array[i]);
        sum += array[i];
        if (min > array[i]) {
            min = array[i];
        }
    }
    printf("%i\n", (X - sum) / min + N);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int horieyui(const void* x, const void* y) {
	int a = *(const int*)x, b = *(const int*)y;
	return a < b ? -1 : a > b;
}

int N, Q;
int a[114514];
int l[114514], r[114514];

int main(void) {
	int i;
	if (scanf("%d%d", &N, &Q) != 2) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &a[i]) != 1) return 1;
	}
	for (i = 0; i < Q; i++) {
		if (scanf("%d%d", &l[i], &r[i]) != 2) return 1;
	}
	a[N] = -1;
	a[N + 1] = 1111111111;
	N += 2;
	qsort(a, N, sizeof(*a), horieyui);
	for (i = 0; i < Q; i++) {
		int under, hidari, migi, over;
		under = 0; hidari = N - 1;
		while (under + 1 < hidari) {
			int mid = under + (hidari - under) / 2;
			if (l[i] <= a[mid]) hidari = mid; else under = mid;
		}
		migi = 0; over = N - 1;
		while (migi + 1 < over) {
			int mid = migi + (over - migi) / 2;
			if (a[mid] <= r[i]) migi = mid; else over = mid;
		}
		printf("%d\n", migi - hidari + 1);
	}
	return 0;
}



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

int main() {
  int N;
  cin>>N;
  int a[N];
  for(int j=0;j<N;j++){
    cin>>a[j];
  }
  int idx=0, c=1;
  bool inc=false,dec=false;
  while(idx<N-1){
    if(a[idx+1]>a[idx]){
      if(dec){
        c++;
        idx ++;
        dec =false;
        //cout << a[idx] <<" "<<a[idx+1]<<endl;
        continue;
      }
      idx++;
      inc =true;
    }
    else if(a[idx+1]<a[idx]){
      if(inc){
        c++;
        idx ++;
        inc =false;
        //cout << a[idx] <<" "<<a[idx+1]<<endl;
        continue;
      }
      idx++;
      dec =true;
    }
    else if(a[idx+1]==a[idx]){
      idx++;
    }

  }
cout<<c<<endl;
}


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

int main(){
  string s;
  cin >> s;

  int cnt=0;
  int size_s=0;

  size_s=s.size();
  for(int i=0;i<size_s;i++){
   if(s.at(i)=='1') cnt++;
  }
  cout << cnt <<endl;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    map<string, long> map;
    rep(i, n)
    {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        map[s]++;
    }
    long sum = 0;
    for (auto x : map)
        sum += x.second * (x.second - 1) / 2;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 11136
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sequence decomposing
import bisect
n = int(input())
lists = [int(input()) for _ in range(n)]
lists = lists[::-1]
dataset = []
dataset.append(lists[0])
# datasetは単調増加なリストの値
for i in range(1, n):
    x = lists[i]
    if x >= dataset[-1]:
        dataset.append(x)
    elif x < dataset[-1]:
        index = bisect.bisect_right(dataset, x)
        dataset[index] = x
print(len(dataset))

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

int main(){
    int a, b;
    cin >> a >> b;
    string A,B;
    for(int i = 0; i < b; i++){
        A += to_string(a);
    }
    for(int i = 0; i < a; i++){
        B += to_string(b);
    }
    vector<string> dir;
    dir.push_back(A);
    dir.push_back(B);
    sort(dir.begin(),dir.end());
    cout << dir[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <cstdio>

int main() {
    int n;
    cin >> n;
    long long a;
    long long minValue = 1000000;
    long long maxValue = -1000000;
    long long sum = 0;
    for (int i = 1; i <= n; i++){
        cin >> a;
        if (a < minValue) minValue = a;
        if (a > maxValue) maxValue = a;
        sum += a;
    }

    cout << minValue << " " << maxValue << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

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

int main(void) {
    int n;
    int now=-1;

    cin>>n;
    FOR(i,1,n){
        if(n==(int)(i*1.08)){
            now=i;
            break;
        }
    }
    if(now==-1){
        cout<<":("<<endl;
    }else{
        cout<<now<<endl;
    }
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
using namespace std;
long long n, m, c, x, y = 0;

int main()
{
    cin>>n>>m;
    if(n==1){
        x = 1;
    }else{
        x = n - 2;
    }
    if(m==1){
        y = 1;
    }else{
        y = m - 2;
    }
    c = x * y;
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int UF[100];
pair<double,pair<int,int> > e[10000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);
	b=FIND(b);
	if(a==b)return;
	UF[a]+=UF[b];
	UF[b]=a;
}
double x[100],y[100],z[100],r[100];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			UF[i]=-1;
			scanf("%lf%lf%lf%lf",x+i,y+i,z+i,r+i);
		}
		int now=0;
		for(int i=0;i<a;i++){
			for(int j=i+1;j<a;j++){
				e[now++]=make_pair(max(0.0,-r[i]-r[j]+sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]))),make_pair(i,j));
			}
		}
		std::sort(e,e+now);
		double ret=0;
		for(int i=0;i<now;i++){
			if(FIND(e[i].second.first)!=FIND(e[i].second.second)){
				UNION(e[i].second.first,e[i].second.second);
				ret+=e[i].first;
			}
		}
		printf("%.3f\n",ret);
	}
}


Measured memory_bytes: 2672
#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;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int main() {
    int n;
    cin >> n;
    vector<mint>a(n);
    rep(i,n) cin >> a[i].x;
    vector<mint>s(n+1);
    rep(i,n) {
        s[i+1] = s[i]+a[i];
    }
    mint ans = 0;
    rep(i,n-1) {
        ans += a[i]*(s[n]-s[i+1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int n;
    cin>>n;
    vector<long int> v(n);
    for(long int i=0;i<n;i++)
    cin>>v[i];
    long long int sum=0;
    for(long int i=0;i<n;i++)
    sum += v[i];
    sum = round(float(sum)/float(n));
    long long res=0;
    for(long int i=0;i<n;i++)
    {
        res += (v[i]-sum)*(v[i]-sum);
    }
    cout<<res<<endl;
    return 0;
}

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


int main(void)
{
	int H, W;
	while (cin >> H >> W) {


		if (W == 0 && H == 0)
		{
			break;
		}
		for (int i = 0; i < H; i++)
		{
			for (int p = 0; p < W; p++)
			{
				if (i == 0 || i == H - 1 || p == 0 || p == W - 1)
				{
					cout << "#";
				
				}
				else
				{
					cout << ".";

				}
			}
			cout << endl;

		}cout << endl;

	}

    return 0;
}



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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (tmp >= k) cnt++;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  ll A, B;
  cin >> N >> A >> B;
  vector<ll> X(N);
  rep(i, N) cin >> X[i];
  ll ans = 0;
  rep(i, N) {
    if(i == 0) continue;
    ans += min((X[i] - X[i-1]) * A, B);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt=0,tmp;
  cin>>n;
  vector<int> L(n);
  vector<int>::iterator l,a,b,c;
  for(l=L.begin();l!=L.end();++l){
    cin>>*l;
  }
  sort(L.begin(),L.end());
  for(b=L.begin()+1;b!=L.end()-1;++b){
    cerr<<endl<<*b<<':';
  	for(a=L.begin();a!=b;++a){
      tmp=lower_bound(b,L.end(),*b+*a)-b-1;
      cnt+=tmp;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int a, b, c, d;

int main(){
	scanf("%d %d %d %d", &a, &b, &c, &d);
	if(a > c) std::swap(a, c), std::swap(b, d);
	printf("%d\n", std::max(0, std::min(b, d) - c));
}

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

int main() {
  long N;
  cin >> N;
  string s;
  do {
    N--;
    s += 'a' + (N % 26);
    N /= 26;
  }while(N > 0);
  
  reverse(s.begin(), s.end());
  cout << s << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <string>
using namespace std;
int N,K,Q;
typedef long long ll;
typedef pair<int,int> p;
#define NMAX 1000
vector<p> data;
ll dp[NMAX][NMAX];

int main(){
    cin >> N >> K >> Q;
    vector<int> a(N,0);

    for(int i=0;i<Q;i++){
        int temp;
        cin >> temp;
        a[temp-1] += 1;
    }  
    for(int i=0;i<N;i++){
        if(a[i]+K-Q>0) cout << "Yes" <<endl;
        else cout << "No" <<endl;
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	ll x, a, b; cin >> x >> a >> b;
	if (b <= a) cout << "delicious" << endl;
	else if (b - a <= x) cout << "safe" << endl;
	else cout << "dangerous" << endl;
	return 0;
}

Measured memory_bytes: 256
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

string hi = "hi";

int main()
{
  string s;
  cin >> s;
  string t = "hi";
  for(int it = 0 ; it < 10 ; it++) {
    if(s == t){
      cout << "Yes" << endl;
      return 0;
    }
    t += hi;
  }
  cout << "No" << endl;
  return 0;
}


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

int main(){
  long long n, m; cin >> n >> m;
  vector<pair<long long, long long>> ab(n);
  for(int i = 0; i < n; i++){
    cin >> ab.at(i).first >> ab.at(i).second;
  }
  sort(ab.begin(), ab.end());
  long long out = 0;
  priority_queue<long long> que;
  int ind = 0;
  for(int i = 1; i < m + 1; i++){
    for(int j = ind; j < n; j++){
      if(ab.at(j).first <= i){
        que.push(ab.at(j).second);
        if(j == n - 1) ind = n;
      }else{
        ind = j;
        break;
      }
    }
    if(!que.empty()){
      out += que.top();
      que.pop();
    }
  }
  cout << out;
}


Measured memory_bytes: 2936
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int A,B,X;
  cin >> A >> B >> X;
  if(A<=X){
    if(X-A <= B){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }if(A>X){
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let n: usize = read_as_vec()[0];
    let a = read_as_vec::<u64>();
    let mut diff = 0;
    for elem in &a {
        diff ^= *elem;
    }

    for i in 0..n {
        if i < n {
            print!("{} ", a[i] ^ diff);
        } else {
            println!("{}", a[i] ^ diff);
        }
    }
}


Measured memory_bytes: 5836
#include<cmath>
#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<assert.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define setIO(x) freopen(x".in","r", stdin);freopen(x".out","w",stdout);
typedef long long ll;
typedef unsigned long long ul;
typedef pair<int, int> pii;
const ul BASE = 107;
const ll LINF = 9e18 + 7;
const int N = 2e3 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-8;
//-----------------head-----------------
int n, x, a[N], f[N][N];
void init() {
	rep(i, 0, n)
	{
		f[i][0] = a[i];
		rep(j, 1, n)
			f[i][j] = min(f[i][j - 1], a[(i - j + n) % n]);
	}
}
ll solve(ll d) {
	ll ret = x * d;
	rep(i, 0, n)
		ret += f[i][d];
	return ret;
}
int main() {
	cin >> n >> x;
	rep(i, 0, n)
		cin >> a[i];
	init();
	ll ans = solve(0);
	rep(i, 1, n)
		ans = min(ans, solve(i));
	cout << ans;
	return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    ll a,b,res=0;
    cin >> a >> b;
    if(a%2==1&&b%2==1){
        res^=a;
        res^=(b-a)/2&1;
    }else if(a%2==0&&b%2==0){
        res^=b;
        res^=(b-a)/2&1;
    }else if(a%2==1&&b%2==0){
        res^=b;
        res^=a;
        res^=((b-a-1)/2)&1;
    }else{
        res^=(b-a+1)/2&1;
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools


def input_int_list():
    return list(map(int, input().split()))


def input_int_list_with_length(length=None):
    if length == None:
        length = int(input())
    return list(map(int, input().split()))[:length]


def solve(N: int, K: int):
    l = []
    for _ in range(K):
        l += input_int_list_with_length()
    print(N-len(set(l)))


def main():
    solve(*input_int_list())


if __name__ == '__main__':
    main()


Measured memory_bytes: 67952
#include<stdio.h>
#include<stdlib.h>
#pragma warning(disable:4996)
int main()
{
	int a;
	scanf("%d", &a);
	long long *b = (long long *)malloc(sizeof(long long)*a);
	long long *c = (long long *)malloc(sizeof(long long)*a);
	for (int i = 0; i < a; i++)
	{
		scanf("%lld", b + i);
	}
	int A = a;
	if (a % 2 == 0)
	{
		for (int i = 0; i < A/2; i++)
		{
			c[i] = b[a - 2 * i-1];
		}
		for (int i = 0; i < A/2; i++)
		{
			c[i+A/2] = b[2 * i];
		}
	}
	if (a % 2 == 1)
	{
		for (int i = 0; i <= A/2; i++)
		{
			c[i] = b[a - 2 * i-1];
		}
		for (int i = 1; i <= A / 2; i++)
		{
			c[A / 2+i] = b[2 * i-1];
		}
	}
	for (int i = 0; i < A; i++)
	{
		printf("%lld ", c[i]);
	}
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll n;cin>>n;
    vp v(n);
    rep(i,n)cin>>v[i].fi;
    rep(i,n)v[i].se=i;
    sort(all(v));reverse(all(v));
    vvi dp(n,vi(n+1,-inf));
    dp[0][0]=v[0].fi*(n-1-v[0].se);
    dp[0][1]=v[0].fi*v[0].se;
    rep(i,n-1){
        rep(j,n){
            chmax(dp[i+1][j],dp[i][j]+v[i+1].fi*abs(n-(i-j+1)-1-v[i+1].se));
            chmax(dp[i+1][j+1],dp[i][j]+v[i+1].fi*abs(j-v[i+1].se));
        }
    }
    ll ans=-inf;
    rep(i,n+1)chmax(ans,dp[n-1][i]);
    out(ans);
}

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

using Weight = int;

struct edge
{
    int from, to;
    Weight weight;
};

using Edges = std::vector<edge>;
using Graph = std::vector<Edges>;

const Weight winf = numeric_limits<Weight>::max();

vector<Weight> bellman_ford(const Edges& es, int V, int s)
{
    vector<Weight> dst(V, winf);
    dst[s] = 0;

    for (int i = 0; i < V; i++) {
        for (auto& e: es) {
            if (dst[e.from] != winf && dst[e.to] > dst[e.from] + e.weight) {
                dst[e.to] = dst[e.from] + e.weight;
                if (i == V - 1) return vector<Weight> ();
            }
        }
    }
    return dst;
}

int main()
{
    int v, e, r; cin >> v >> e >> r;
    Edges es;
    for (int i = 0; i < e; i++) {
        int s, t, d; cin >> s >> t >> d;
        es.push_back({s, t, d});
    }

    auto bf = bellman_ford(es, v, r);
    if (bf.empty()) cout << "NEGATIVE CYCLE" << endl;
    else {
        for (int i = 0; i < v; i++) {
            cout << (bf[i] == winf ? "INF" : to_string(bf[i])) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  vector<int> c(5);
  string s;
  
  rep(i,0,n){
    cin >> s;
    if(s[0]=='M') c[0]++;
    if(s[0]=='A') c[1]++;
    if(s[0]=='R') c[2]++;
    if(s[0]=='C') c[3]++;
    if(s[0]=='H') c[4]++;
  }
  
  int ans = 0;
  
  ans += c[0]*c[1]*c[2];
  ans += c[0]*c[1]*c[3];
  ans += c[0]*c[1]*c[4];
  ans += c[0]*c[2]*c[3];
  ans += c[0]*c[2]*c[4];
  ans += c[0]*c[3]*c[4];
  ans += c[1]*c[2]*c[3];
  ans += c[1]*c[2]*c[4];
  ans += c[1]*c[3]*c[4];
  ans += c[2]*c[3]*c[4];
  
  cout << ans << endl;
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
rsum = [[0] * (W + 1)]
for _ in range(H):
    rsum.append([0])
    tot = 0
    for c, v in enumerate(map(int, input())):
        tot += v
        rsum[-1].append(tot + rsum[-2][c + 1])
ans = 10 ** 10
for i in range(1 << H):
    hcuts = [0]
    for j in range(H - 1):
        if i & (1 << j):
            hcuts.append(j + 1)
    hcuts.append(H)
    vcuts = [0]
    ok = True
    for c in range(1, W + 1):
        for b in range(2):
            max_w = 0
            for h in range(1, len(hcuts)):
                max_w = max(
                    max_w,
                    rsum[hcuts[h]][c]
                    - rsum[hcuts[h - 1]][c]
                    - rsum[hcuts[h]][vcuts[-1]]
                    + rsum[hcuts[h - 1]][vcuts[-1]],
                )
            if max_w > K:
                if b:
                    ok = False
                    break
                vcuts.append(c - 1)
        if not ok:
            break
    if not ok:
        continue
    vcuts.append(W)
    ans = min(ans, len(hcuts) - 2 + len(vcuts) - 2)
print(ans)


Measured memory_bytes: 45404
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()
A = zz()
A = sorted(A)

kasanari = []
count = [0]*(10**6+1)
for a in A:
    count[a] += 1
    if (count[a] > 1):
        kasanari.append(a)
ref = list(set(A) - set(kasanari))

erasut = np.ones(A[-1]+1, dtype=np.int64)
for a in set(A):
    if(a*2 < A[-1]+1):
        erasut[a*2::a] = 0
erasut = erasut[ref]
# kasanari = set(kasanari)
print(sum(erasut))
# print(int(sum()) - len(set(kasanari)))


Measured memory_bytes: 67768
import java.util.*;

class Main {
  static Scanner cin = new Scanner(System.in);
  public static void main(String[] args) {
    while (cin.hasNext()) {
      double n = cin.nextDouble(), ans = n;
      for (int i = 2; i <= 10; i++) {
        if (i % 2 == 0) {
          n *= 2;
          ans += n;
        } else {
          n /= 3;
          ans += n;
        }
      }
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 28056
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,D,X;
  cin>>N>>D>>X;
  vector<int> A(N);
  REP(i,N)cin>>A[i];
  REP(i,N){
    X+=((D-1)/A[i])+1;
  }
  cout<<X<<endl;
}


Measured memory_bytes: 256
import           System.IO hiding (char8)
import           Control.Applicative
import           Control.Monad
import           Data.List
import           Debug.Trace

-- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + --

main :: IO ()
main = do  
  cs <- getLine
  putStrLn $ map (\c -> if c == ',' then ' ' else c) cs

-- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + --


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;

int main(){
    int a,b,h,m; cin >> a >> b >> h >> m;

    //角度の計算
    double pi = 2 * M_PI * ((double) h / 12.0 + ((double) m / 60.0) / 12.0 - (double) m / 60.0);

    double ans = sqrt((double)(a*a + b*b) - (double)(2*a*b)*cos(pi));
    printf("%20.20f\n",ans);
}

Measured memory_bytes: 4184
o = input()
e = input()

ans = ""
for i in range(len(o)-1):
    ans = ans + o[i] + e[i]


if (len(o) == len(e)):
    ans = ans + o[len(o)-1] + e[len(e)-1]
else:
    ans = ans + o[len(o)-1]

print(ans)


Measured memory_bytes: 3060
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
S, T = input().split()
ans = []
for s, t in zip(S, T):
    print(s + t, end="")
print()



Measured memory_bytes: 6992
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int H,W;
  cin >> H >> W;
  vector<string> s(H);
  for(int i=0;i<H;i++) cin >> s[i];

  vector<vector<int> > dp(H,vector<int>(W));

  if(s[0][0]=='#') dp[0][0]=1; else dp[0][0]=0;

  int ans;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans=20000;
      if(i!=0){
	if(s[i-1][j]=='.' && s[i][j]=='#') ans=dp[i-1][j]+1;
	else ans=dp[i-1][j];
      }
      if(j!=0){
	if(s[i][j-1]=='.' && s[i][j]=='#') ans=min(dp[i][j-1]+1,ans);
	else ans=min(dp[i][j-1],ans);
      }

      if(i!=0 || j!=0){
	dp[i][j]=ans;
      }

    }

  }


  
  cout << dp[H-1][W-1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
/* Akshat Sharma @akshat98 */
#include <iostream>
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp   make_pair
#define pb   push_back
#define F    first
#define S    second
#define ll   long long
#define MOD  1000000007
#define MAX  1000000001
#define vi 	 vector<int>
#define vl   vector<ll>
#define vpi  vector<pair<int,int> >
#define vpl  vector<pair<ll,ll> >
#define rep(i,a,b) for(i=a;i<b;i++)
#define reqp(i,a,b) for(i=a;i<=b;i++)
#define ren for(i=0;i<n;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;


int main()
{
	// #ifndef ONLINE_JUDGE
	//freopen("input_file.txt", "r", stdin);
	//freopen("output_file.txt", "w", stdout);
	// #endif
	int i,j,k,l,n,test_case,a,b,c;
	test_case=1;
	//cin>>test_case;
	while(test_case--){
		int ans=0;
		string str;
		cin>>str;
		n=str.length();
		stack<char>ss;
		ss.push(str[0]);
		i=1;
		while(i<n){
			if(ss.empty()){
				ss.push(str[i]);
			}
			else if(str[i]!=ss.top()){
				ss.pop();
			}else{
				ss.push(str[i]);
			}
			i++;
		}
		int x=0;
		while(!ss.empty()){
			// cout<<ss.top()<<".\n";
			x++;
			ss.pop();
		}
		cout<<n-x;

	}
	
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

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

    vector<int> v;
    rep(i,n){
        int x;
        cin >> x;
        v.emplace_back(x);
    }
    sort(all(v));
    cout << v.back() - v.front() << endl;
}


Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int n,a[N];
signed main()
{
    n=read();
    for(ri int i=1;i<=n;i++) a[i]=read();
    sort(a+1,a+1+n);
    int res=0;
    if(n>1) res+=a[n];
    int now=n-1;
    int i;
    for(i=n-1;i>=3;i-=2) res+=2*a[now], now--;
    if(i==2) res+=a[now];
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 5168
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int x,y ;
	cin >> x >> y ;
	if(x%y==0) cout << -1 << endl ;
	else cout << x << endl ;
}


Measured memory_bytes: 256