akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;

class STlazy{
private:
    int n;
    vector<ll> node, lazy;
 
public:
    STlazy(vector<ll> v){
        int siz = v.size();
        n = 1;
        while(n < siz)  n *= 2;
        node.resize(2*n-1, 0);
        lazy.resize(2*n-1, 0);
        
        for(int i = 0; i < siz; i++)    node[n-1+i] = v[i];
        for(int i = n-2; i >= 0; i--)   node[i] = node[2*i+1] + node[2*2+2];
    }
 
    void eval(int k, int l, int r){
        if(lazy[k] == 0)    return;
        node[k] += lazy[k]; node[k] %= mod;
        if(r-l > 1){
            lazy[2*k+1] += lazy[k]/2;
            lazy[2*k+2] += lazy[k]/2;
        }
        lazy[k] = 0;
    }
 
    void add(int a, int b, ll x, int k=0, int l=0, int r=-1){
        if(r < 0)   r = n;
        eval(k, l, r);
        if(r <= a || b <= l)    return;
        if(a <= l && r <= b){
            lazy[k] += (r-l)*x;
            eval(k, l, r);
            return;
        }
        add(a, b, x, 2*k+1, l, (l+r)/2);
        add(a, b, x, 2*k+2, (l+r)/2, r);
        node[k] = (node[2*k+1] + node[2*k+2])%mod; // 自分の全ての子孫の値伝播が終わったら自分を更新する
    }
 
    ll query(int a, int b, int k=0, int l=0, int r=-1){
        if(r < 0)   r = n;
        if(r <= a || b <= l)    return 0;
        eval(k, l, r); // 最初の呼び出しが必ずeval(0,0,n)となるので漏れなく上から値の伝播がなされている
        if(a <= l && r <= b)    return node[k];
        ll lx = query(a, b, 2*k+1, l, (l+r)/2);
        ll rx = query(a, b, 2*k+2, (l+r)/2, r);
        return (lx+rx)%mod;
    }
};

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

    vector<int> to, val;
    int r = 1;
    while(r <= n){
        int tmp = n/r;
        int reach = n/tmp;
        to.push_back(reach);
        val.push_back(tmp);
        r = reach+1;
    }

    int siz = to.size(); // O(sqrt(N)) ?

    vector<ll> cnt(siz, 1);
    for(int i = 1; i < siz; i++)    cnt[i] = to[i]-to[i-1];

    auto f = [&](int x)->int{
        return upper_bound(to.begin(),to.end(),x)-to.begin();
    };

    // memo (needless)
    vector<int> memo(siz);
    for(int i = 0; i < siz; i++)    memo[i] = f(val[i]);

    // O(sqrt(N) * log(sqrt(N)) * K) ?
    vector<vector<ll>> dp(k, vector<ll>(siz+1, 0));
    for(int i = 0; i < siz; i++)    dp[0][i] = cnt[i];
    for(int i = 0; i+1 < k; i++){
        for(int j = 0; j < siz; j++){
            dp[i+1][0] = (dp[i+1][0] + dp[i][j]) % mod;
            dp[i+1][memo[j]] = (dp[i+1][memo[j]] - dp[i][j] + mod) % mod;
        }
        for(int j = 1; j < siz; j++){
            dp[i+1][j] += dp[i+1][j-1];
            if(dp[i+1][j] < 0)    dp[i+1][j] += mod;
            dp[i+1][j] %= mod;
        }
        for(int j = 0; j < siz; j++){
            dp[i+1][j] *= cnt[j];
            dp[i+1][j] %= mod;
        }
    }

    // for(int i = 0; i < k; i++){
    //     for(int j = 0; j < siz; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    ll ans = 0;
    for(int i = 0; i < siz; i++)    ans += dp[k-1][i], ans %= mod;
    cout << ans << endl;

    return 0;
}


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

int main(){
  int n;
  int a[100000];
  cin >> n;

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

  int max = 0;
  int max_id = 0;
  for(int i = 0;i < n;i++){
    if(max < a[i]){
      max = a[i];
      max_id = i;
    }
  }

  int b[100000],c[100000];
  for(int i = 0;i < n;i++){
    b[i] = a[i] - (max/2);
    if(max % 2 != 0){
      c[i] = a[i] - (max/2 + 1);
    }else{
      c[i] = b[i];
    }
  }

  int min = 1000000001;
  int r;
  for(int i = 0;i < n;i++){
    if(i != max_id){
      if(min > abs(b[i])){
        min = abs(b[i]);
        r = i;
      }
      if(min > abs(c[i])){
        min = abs(c[i]);
        r = i;
      }
    }
  }

  cout << max << " " << a[r] << endl;
  return(0);
}


Measured memory_bytes: 1408
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	restDays := 15 - len(s)
	ctWin := 0
	for _, ss := range s {
		if ss == 'o' {
			ctWin++
		}
	}

	if ctWin+restDays < 8 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var hw = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int h = hw[0];
			int w = hw[1];
			if (h % 3 == 0 || w % 3 == 0) {
				Console.WriteLine(0);
				return;
			}

			long l = w > h ? w : h;
			long s = w > h ? h : w;
			long[] delta = new long[4];
			long[] lls = new long[] { (l / 3), (l / 3) + 1 };
			for (int i = 0; i < 2; i++) {
				long ll = lls[i];
				long r1 = s * ll;
				long r2 = (l - ll) * (s / 2);
				long r3 = (l - ll) * (s - (s / 2));
				long max = Math.Max(r1, Math.Max(r2, r3));
				long min = Math.Min(r1, Math.Min(r2, r3));
				delta[i] = max - min;
			}

			long[] sss = new long[] { (s / 3), (l / 3) + 1 };
			for (int i = 0; i < 2; i++) {
				long ss = sss[i];
				long r1 = ss * l;
				long r2 = (s - ss) * (l / 2);
				long r3 = (s - ss) * (l - (l / 2));
				long max = Math.Max(r1, Math.Max(r2, r3));
				long min = Math.Min(r1, Math.Min(r2, r3));
				delta[i + 2] = max - min;
			}

			Console.WriteLine(Math.Min(delta.Min(), s));
		}
	}
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, i, j, k;
	string s, t;
	int flg, ans;
	cin >> s >> n;
	ans = 0;
	for(i = 0; i < n; i++){
		cin >> t;
		for(j = 0; j < t.length(); j++){
			if(s[0] == t[j]){
				flg = 1;
				k = 0;
				while(k != s.length()){
					// cout << s[k] << " " << t[(j + k) % t.length()] << endl;
					if(s[k] != t[(j + k) % t.length()]){
						flg = 0;
					}
					k++;
				}
				if(flg == 1)	break;
			}
			else{
				flg = 0;
			}
		}
		if(flg == 1)	ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3196
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var a, b, m int
	fmt.Fscan(r, &a)
	fmt.Fscan(r, &b)
	fmt.Fscan(r, &m)

	as := make([]int, a)
	minA := math.MaxInt64
	for i := 0; i < a; i++ {
		fmt.Fscan(r, &as[i])
		minA = min(minA, as[i])
	}
	bs := make([]int, b)
	minB := math.MaxInt64
	for i := 0; i < b; i++ {
		fmt.Fscan(r, &bs[i])
		minB = min(minB, bs[i])
	}

	var x, y, c int
	ans := minA + minB
	for i := 0; i < m; i++ {
		fmt.Fscan(r, &x)
		fmt.Fscan(r, &y)
		fmt.Fscan(r, &c)
		x--
		y--

		sum := as[x] + bs[y] - c
		ans = min(ans, sum)
	}

	fmt.Println(ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


Measured memory_bytes: 4736
import java.util.Scanner;
import java.util.*;
import java.lang.*;
 
class Main {
 
    public static void main(String[] args) {
        int x = 0, tot;
        Scanner sc = new Scanner(System.in);
 

 
            int temp = sc.nextInt();

 
            tot = temp * temp * temp;
 
            System.out.println((int)tot);

 
        }
 
    }

Measured memory_bytes: 26172
def generate_perms(n, perms):
    if n == 0:
        return perms
    new_perms = []
    for perm in perms:
        for i in range(1, N+1):
            if i not in perm:
                p = list(perm)
                p.append(i)
                new_perms.append(p)
    return generate_perms(n-1, new_perms)


N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
perms = generate_perms(N, [[]])
print(abs(perms.index(P) - perms.index(Q)))


Measured memory_bytes: 19828
#include<bits/stdc++.h>
#define rep(i, n) for(int i; i < n; i++)

using namespace std;
 //桁数を求める
int64_t f(int64_t N){
  int counter = 0;
  while(N>0){
    N = N/10;
    counter++;
  }
  return counter;
}
  
 
int main(){
  int64_t N;
  cin >> N;
  
 int ans= f(N);//最大値にしておく
  for(int64_t A = 1; A*A <= N; A++){
    if(N%A==0){
      int64_t B = N/A;
      int X = max( f(A), f(B) );
     
      if(ans>X){
        ans = X;
      }
     
    }
  }
  
  cout << ans << endl;
}
      
  



Measured memory_bytes: 764
use proconio::input;

fn main() {
  input! {
    n: usize,
    a: [isize; n],
  };
  let cond = |n| (n % 2 == 1 || (n % 3 == 0 || n % 5 == 0));
  if a.iter().all(cond) { 
    println!("APPROVED");
  } else {
    println!("DENIED");
  }
}


Measured memory_bytes: 2140
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int x[100];
    
    for(int i = 0; i < n; i++){
        cin >> x[i]; 
    }
    for(int j = n - 1; j >= 0; j--){
        if(j == 0){
            cout << x[j] << endl;
        } else {
            cout << x[j] <<" ";
        }
    }
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int P,Q,R;
    cin >> P >> Q >> R;
    
    int A=0,B=0,C=0;
    A = P+Q;
    B = Q+R;
    C = P+R;
    
    int ans = 0;
    ans = min({A,B,C});
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);
    int num = 1;
    rep(i, n) {
        if (i == 0) continue;
        if (s[i] != s[i-1]) num++;
    }
    printf("%d\n", num);
}

Measured memory_bytes: 3892
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 * HashMap<Integer, Integer> hm = new HashMap<>();
 * int[] s = new int[M];
 * ArrayDeque<Integer> deq = new ArrayDeque<>();
 *
 */
public class Main implements Runnable { //クラス名はMain

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

	public void run() {
		try {
			FastScannerMainC sc = new FastScannerMainC(System.in);
			int N = sc.nextInt();
			int K = sc.nextInt();

			int[] D = new int[K];

			for (int i = 0; i < K; i++) {
				D[i] = sc.nextInt();
			}

			dfs(N, N, D);

		} catch (

		Exception e) {
			e.printStackTrace();
		}

	}

	private void dfs(int sum, int N, int[] D) {
		try {
			boolean ans = true;
			//System.out.println(sum);
			for (int i = 0; i < D.length; i++) {
				//System.out.println(D[i]);
				if (String.valueOf(sum).contains(String.valueOf(D[i]))) {
					ans = false;
					break;
				}
			}
			if (ans) {
				System.out.println(sum);
			} else {
				dfs(sum + 1, N, D);
			}
		} catch (

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

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

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

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

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

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

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

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

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

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


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

int main() {
    int N, A[100001];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    sort(A, A + N);
    int ptr = 0, res = 0;
    while (ptr < N) {
        int cc = A[ptr], f = 0;
        while (ptr < N && A[ptr] == cc) {
            ++ptr;
            ++f;
        }
        res += f % 2;
    }

    cout << res << endl;
}

Measured memory_bytes: 640
N,M=map(int,(input().split()))
k=list(map(int,input().split()))[1:]
for i in range(N-1):
  A=list(map(int,input().split()))[1:]
  l=[]
  for j in k:
    if j in A:
      l.append(j)
  k=l
print(len(k))


Measured memory_bytes: 9180
alf = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = input()
if s[0] != 'A':
  print('WA')
  exit()
cnt = 0
pos = 0
for i,c in enumerate(s[2:-1]):
  if c == 'C':
    cnt += 1
    pos = i+2
if cnt != 1:
  print('WA')
  exit()
for i,c in enumerate(s[1:]):
  if i+1 != pos and c in alf:
    print('WA')
    break
else:
  print('AC')

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

void solve(){
    string a,b;
    cin>>a>>b;
    int ctr=0;
    for(int i=0;i<a.size();i++){
        if(a[i]==b[i])
            ctr++;
    }
    cout<<ctr<<endl;
}

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

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define tc ll t; cin >> t; while (t--)
#define sz(c) (ll) (c).size()
#define trav(x,c) for(auto &x : c)
#define all(c) (c).begin(), (c).end()
#define rll(c) (c).rbegin(), (c).rend()
#define _for(i,a,n) for(ll i = a ; i < n; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios::sync_with_stdio(0); cin.tie(0);

int main() {
    godspeed;
    ll n; cin >> n;
    map<ll,ll> mp;
    vl v(n+1); _for(i,1,n+1) {cin >> v[i]; mp[v[i]] = i;}

    trav(x,mp) cout << x.s << " ";
}

Measured memory_bytes: 10240
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<52;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int n,m,h,k;
vi s;
vp a;

int main(){
	while(1){
		cin>>n>>m>>h>>k;
		if(!n) break;
		s=vi(n);
		a=vp(m);
		for(int i=0;i<n;i++) cin>>s[i];
		for(int i=0;i<m;i++) cin>>a[i].first>>a[i].second;
		sort(a.begin(),a.end(),[](P p,P q){
			return p.second<q.second;
		});
		vi b(n);
		vp c(m);
		for(int i=0;i<n;i++) b[i]=i;
		for(int i=0;i<m;i++){
			int F=a[i].first,S=a[i].second;
			c[i]=P(min(b[F-1],b[F]),max(b[F-1],b[F]));
			swap(b[F-1],b[F]);
		}
		vi d(n);
		int sum=0,ans;
		for(int i=0;i<n;i++){
			if(b[i]<k) sum+=s[i];
			d[b[i]]=i;
		}
		ans=sum;
		for(int i=0;i<m;i++){
			int F=c[i].first,S=c[i].second;
			if(F<k&&k<=S) ans=min(ans,sum-s[d[F]]+s[d[S]]);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4320
N = int(input())
A = list(map(int, input().split()))

seisu = [0 for i in range(N+1)]

for i in A:
  seisu[i] += 1
  
ans = 0
for i in seisu:
  ans += int(i*(i-1)/2)

for i in range(N):
  ans2 = ans - seisu[A[i]] + 1
  print(ans2)

Measured memory_bytes: 25716
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k  =sc.nextInt();
        String s = sc.next();
        if (s.length() <= k) {
            System.out.println(s);
        } else {
            String NS = s.substring(0, k) + "...";
            System.out.println(NS);
        }
    }

}

Measured memory_bytes: 38664
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
long long n,a[100005],b[1000005],maxn=-1,minn=1,mm=0x3f3f3f3f;
int main(){
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		cin>>n;
		for(int i=1;i<=n;i++)
			cin>>a[i];
		sort(a+1,a+1+n);
		for(int i=1;i<=n;i++){
			b[a[i]]++;
			if(a[i]>=maxn)maxn=a[i];
			//if(a[i]<mm)mm=a[i];
		}
		if(n==1){
			cout<<1;
			return 0;
		}
		if(n==2){
			if((a[1]==a[2])||((a[1]+1)==a[2])||((a[1]-1)==a[2])){
				cout<<2;
				return 0;
			}
			else cout<<1;
			return 0;
		}
		for(int i=0;i<=maxn;i++)
			//if(b[i]!=0)
				if((b[i]+b[i-1]+b[i+1])>minn)
					minn=(b[i]+b[i-1]+b[i+1]);
		cout<<minn<<endl;
	return 0;
} 

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec C(100000, 0);
    REP(i,0,N) {
        ll a;
        cin >> a;
        ++C[a];
    }

    ll cnt = 0;
    REP(i,1,100000) {
        if(C[i] > 1) cnt += C[i] - 1;
    }
    if(cnt % 2 == 0) PR(N-cnt);
    else PR(N-cnt-1);

    return 0;
}

/*



*/

Measured memory_bytes: 4056
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int a, b, c;
	
	cin>>a>>b>>c;
	
	a += b;
	a += c;
	
	if(a >= 22) cout<<"bust"<<endl;
	else if(a <= 21) cout<<"win"<<endl;
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]

l1 = Counter([i + 1 - A[i]for i in range(N)])
l2 = Counter([i + 1 + A[i]for i in range(N)])

ret = 0
for k, v in l1.items() :
  ret += v * l2[k]
  
print(ret)


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

int comDesc(const void *a, const void *b)
{
    return *(int *)b - *(int *)a;
}

int main(void)
{
    int n, a[110], alice = 0, bob = 0;
    scanf("%d", &n);

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

    qsort(a, n, sizeof(int), comDesc);

    for (int i = 0; i < n; i++)
    {
        if (i % 2)
        {
            bob += a[i];
        }
        else
        {
            alice += a[i];
        }
    }

    printf("%d", alice - bob);

    return 0;
}

Measured memory_bytes: 128
li=[13,1,2,3,4,5,6,7,8,9,10,11,12]
A,B = [int(x)-1 for x in input().split()]
if(li[A]>li[B]):
  print('Alice')
elif(li[A]==li[B]):
  print('Draw')
else:
  print('Bob')

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll N, M;
	cin >> N >> M;

	vector<vector<ll>> g(N + 1);
	repn(i, M) {
		ll a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	ll Q;
	cin >> Q;

	vector<ll> v(Q + 1), d(Q + 1), c(Q + 1,0);
	repn(i, Q) cin >> v[i]>>d[i]>>c[i];

	vector<vector<ll>> paint(N + 1, vector<ll>(12, 0));

	for (ll j = 10; j >= 0; j--) {
		repn(i, Q) {
			if (d[i] == j) { paint[v[i]][j] = max(i, paint[v[i]][j]); }
		}

		repn(v, N) {
			for (ll w : g[v]) {
				paint[v][j] = max(paint[v][j], paint[w][j + 1]);
			}
		}
	}

	vector<ll> ans(N + 1,0);
	repn(v, N) {
		rep(j, 11) {
			ans[v] = max(ans[v], paint[v][j]);
		}
	}

	repn(v, N) {
		cout << c[ans[v]] << endl;
	}

	system("PAUSE");
}


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

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

    bool flag = true;
    while(s.size() || flag == false){
        string::iterator begin = s.begin();
        if(s == "dream" || s == "dreamer" || s == "eraser" || s == "erase"){
            s.clear();
            break;
        }

        if(s.size() < 5){
            flag = false;
        }

        if(s.substr(0, 5) == "dream"){
        
            if(s.substr(5, 2) == "er"){
                if(s.substr(7, 1) == "d" || s.substr(7, 1) == "e"){
                    s.erase(begin, begin + 7);
                }else if(s.substr(7, 1) == "a"){
                    s.erase(begin, begin + 5);
                }else{
                    flag = false;
                }
            }else{
                s.erase(begin, begin + 5);
            }
        }else if(s.substr(0, 5) == "erase"){
            if(s.substr(5, 1) == "r"){
                s.erase(begin, begin + 6);
            }else{
                s.erase(begin, begin + 5);
           }
        }else{ 
            flag = false;
        }
        if(flag == false) break;
    }

    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 576
# sys.stdin.readline()
import sys
input = sys.stdin.readline
import collections

N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
cnt=[]
for k in c:
    cnt.append(c[k]*(c[k]-1)//2)

s=sum(cnt)
for i in range(N):
    print(s-c[A[i]]+1)


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

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

  vector<int> vec(n);
  for (int i = 1; i < n; i++)
    cin >> vec.at(i);

  map<int, int> hoge;
  for (int x : vec) {
    if (hoge.count(x)) {
      hoge[x] += 1;
    } else {
      hoge[x] = 1;
    }
  }

  for (int i = 1; i - 1 < n; i++) {
    if (hoge.count(i)) {
      cout << hoge[i] << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 13464
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, B, C, X, Y; 
  cin >> A >> B >> C >> X >> Y;

  cout << min(min(A*X+B*Y, max(X, Y)*C*2), min(X, Y)*C*2+(X-min(X, Y))*A+(Y-min(X, Y))*B) << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,k;
  cin >> n >> k;
  vi a(n);
  rep(i,n)cin >> a[i];
  int cnt = 0,ans=0;
  cnt+=k;
  ans++;
  while(cnt<n){
    cnt+=k-1;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 640
package main

import "fmt"

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func main() {
	// Code for B - Product Max
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	fmt.Println(max(a*c, a*d, b*c, b*d))
}


Measured memory_bytes: 1772
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
#define pb                emplace_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (ll)((x).size())
#define ff                first
#define ss                second
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define isBitset(S,i)     ((S>>i)&1)
#define print(x) 		  for(auto it:x) cout<<it<<" "; cout<<"\n"; 
#define MOD 1000000007
ll gcd(ll a, ll b){
    while(true){
        if(a>b)
            swap(a,b);
        if (a == 0) 
            return b; 
        ll p = b % a  , q = a;
        a = p;
        b = q;
    }
}
 
ll powerMod(ll x,ll y){
    ll res = 1;
    x %= MOD;
    while(y > 0){
        if(y & 1)res = (res*x)%MOD;
        y = y >> 1;
        x = (x * x)%MOD;
    }
    return res%MOD;
}
 
string binary(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}
void solve()
{
	ll n,x,t;cin>>n>>x>>t;
	ld k=x;
	ll ans=(ceil(n/k)*t);
	cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif    
        solve();
    return 0;
}

Measured memory_bytes: 3576
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

signed main(){
	ll n,cnt = 0;
	cin >> n;
	ll a[n] = {};
	
	rep(i,0,n) cin >> a[i];
	
	rep(i,1,n-1){
		if((a[i-1] < a[i] && a[i] < a[i+1]) || (a[i-1] > a[i] && a[i] > a[i+1])) cnt++;
	}
	
	cout << cnt << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    char op[] = {'+', '-'};
    int n4 = n % 10;
    n /= 10;
    int n3 = n % 10;
    n /= 10;
    int n2 = n % 10;
    n /= 10;
    int n1 = n % 10;
    n /= 10;

    if(n1 + n2 + n3 + n4 == 7)
        printf("%d+%d+%d+%d=7\n", n1, n2, n3, n4);
    else if(n1 + n2 + n3 - n4 == 7)
        printf("%d+%d+%d-%d=7\n", n1, n2, n3, n4);
    else if(n1 + n2 - n3 + n4 == 7)
        printf("%d+%d-%d+%d=7\n", n1, n2, n3, n4);
    else if(n1 + n2 - n3 - n4 == 7)
        printf("%d+%d-%d-%d=7\n", n1, n2, n3, n4);
    else if(n1 - n2 + n3 + n4 == 7)
        printf("%d-%d+%d+%d=7\n", n1, n2, n3, n4);
    else if(n1 - n2 + n3 - n4 == 7)
        printf("%d-%d+%d-%d=7\n", n1, n2, n3, n4);
    else if(n1 - n2 - n3 + n4 == 7)
        printf("%d-%d-%d+%d=7\n", n1, n2, n3, n4);
    else if(n1 - n2 - n3 - n4 == 7)
        printf("%d-%d-%d-%d=7\n", n1, n2, n3, n4);
}

Measured memory_bytes: 3776
import itertools
n,m,q=map(int,input().split())
a=[0 for i in range(q)]
b=[0 for i in range(q)]
c=[0 for i in range(q)]
d=[0 for i in range(q)]
for i in range(q):
    a[i],b[i],c[i],d[i]=map(int,input().split())
    a[i]-=1
    b[i]-=1
ans=0
buf=[None]*n

def dfs(nowdigit,cannum):
    global ans
    if nowdigit==n:
        tmp=0
        for j in range(q):
            if buf[b[j]] - buf[a[j]] == c[j]:
                tmp+=d[j]
        ans=max(ans,tmp)
    else:
        for i in range(cannum,m+1):
            buf[nowdigit]=i
            dfs(nowdigit+1,i)
dfs(0,1)
print(ans)

Measured memory_bytes: 80472
#include <stdio.h>
int main(void){
    int N;
    scanf("%d",&N);
    int C[N-1],S[N-1],F[N-1];
    for(int i=0;i<N-1;i++){
        scanf("%d %d %d",&C[i],&S[i],&F[i]);
    }
    for(int i=0;i<N;i++){
        int ans=0;
        for(int j=i;j<N-1;j++){
            if(ans<S[j])ans=S[j]+C[j];
            else {
                int syo=(ans-1)/F[j];
                ans=(syo+1)*F[j]+C[j];
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 128
package main
import "fmt"
func main(){
    // Your code here!
    var x int
    for i := 1; ; i++ {
        fmt.Scan(&x)
        if x == 0 {break;}
        fmt.Print("Case ")
        fmt.Print(i)
        fmt.Print(": ")
        fmt.Println(x)
    }
}



Measured memory_bytes: 1884
#include <iostream>
#include <math.h>
using namespace std;
inline int num(int b) {
	int cnt = 0;
	while (b > 0) {
		b /= 10;
		cnt++;
	}
	return cnt;
}

bool Is_sqr(int n) {
	bool f = false;

	for (int i = 1; i <=sqrt(n); i++)
	{
		if (i*i == n)
			f = true;
	}
	return f;
}

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

	a = a * pow(10, num(b));
	a += b;

	if (Is_sqr(a))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
cmin = 10 ** 15 + 1
for i in range(5):
    c = int(input())
    cmin = min(c, cmin, N)
#print("cmin={}".format(cmin))
t = 4 + N // cmin
if(N % cmin != 0):
    t += 1
print(t)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
int f[2010];
int main()
{
	int n;
	cin>>n;
	
	for(int i=3;i<=2001;i++)
	{
		f[i]=1;
		
		if(i-3>=3)
		{
			for(int j=3;j<=i-3;j++)
			{
				f[i]=(f[i]+f[j]%MOD)%MOD;
			}
		}
	}
	
	cout<<f[n];
} 

Measured memory_bytes: 3592
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        for (int i = 0; i < n - k; i++) {
            boolean ok = false;
            
            if (array[i] < array[i+k]) {
                ok = true;
            }
            
            if (ok) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 60384
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
sum = 0
for j in range(k):
  sum += p[j]
max = sum
for i in range(n-k):
  sum = sum-p[i]+p[i+k]
  if max < sum:
    max = sum
print((max+k)/2)

Measured memory_bytes: 25060
package main

import "fmt"

func main(){
	var n int
	var s string
	fmt.Scan(&n)
	m := make(map[string]int,n)
	for i:=0 ; i<n ; i++ {
		fmt.Scan(&s)
		m[s] = 1
	}
	fmt.Println(len(m))
}


Measured memory_bytes: 17696
R, G, B, N = map(int, input().split())
cnt = 0
for i in range(N+1):
        for j in range(N+1):
            if (N - R*i - G*j) % B == 0 and (N - R*i - G*j) > 0:
                cnt += 1
                # print(str(i) + " " + str(j) + " " + str)
            if N == R*i + G*j:
                cnt += 1

print(cnt)

Measured memory_bytes: 41452
import math
n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))

c = list(map(lambda x: abs(x[0]-x[1]), list(zip(a, b))))
print("{:.5f}".format(sum(c))) # 1

d = list(map(lambda x: x**2, c))
print("{:.5f}".format(math.sqrt(sum(d)))) # 2

e = list(map(lambda x: x**3, c))
print("{:.5f}".format(math.pow(sum(e), 1.0/3.0))) # 3

print("{:.5f}".format(max(c))) # inf

Measured memory_bytes: 7868
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    if A[i] < 0:
        cnt += 1
        A[i] *= -1
A.sort()
if cnt % 2 == 1:
    print(sum(A[1:])-A[0])
else:
    print(sum(A))

Measured memory_bytes: 19988
#include <stdio.h>


int main(void)
{
  
  int H, W;
  int i, j;
  
  while( scanf("%d %d", &H, &W),  H || W ){
    
    for( i = 0; i < H; i++ ){
      for( j = 0; j < W; j++ ){
        
        if( ( i && j ) && ( i<(H-1) && j<(W-1) ) ) {printf(".");}
        else                                       {printf("#");}
      }
      puts("");
    }
    
    puts("");
  }
  
  return 0;    
 
}       
        

Measured memory_bytes: 588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ar[3],cnt5=0,cnt7=0;
    for(int i=0;i<3;i++)
    {
        cin>>ar[i];
        if(ar[i]==5)
        {
            cnt5++;
        }
        else
        {
            cnt7++;
        }
    }
    if(cnt5==2 && cnt7==1)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main(){
  int x, y, x1, y1;
  std::cin >> x >> y >> x1 >> y1;
  int dx = x1 - x;
  int dy = y1 - y;
  std::cout << x1 - dy << ' ' << y1 + dx << ' ' << x - dy << ' ' << y + dx << '\n';
  return 0;
}


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

int main (void){
    string str;
    cin >> str;
    if ((str.find('a') != string::npos) && (str.find('b') != string::npos) && (str.find('c') != string::npos)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   string s;
   cin>>s;
   int ans=0;
   for(int i=0;i<s.length();i++)
   {
       ans+=(s[i]-'0');
   }
   if(ans%9==0)
    cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;
}


Measured memory_bytes: 3788
n = int(input())
a = sorted(list(map(int, input().split())))

x = max(a)
dp = [0] * (x+1)
for ai in a:
    i = 1
    if dp[ai] <= 2:
        while i * ai <= x:
            dp[i * ai] += 1
            i += 1

ans = 0
for ai in a:
    if dp[ai] <= 1:
        ans += 1

print(ans)

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

typedef vector<int> vi;

const int MOD = (int)1e9 + 7;
int N, M;
string S;
vi sum1, lr;
vector<vi> dp;

int main(void) {
	int l, r;

	cin >> N >> M >> S;

	sum1.resize(N + 1, 0);
	lr.resize(N + 1, 0);

	for (int i = 1; i <= N; ++i) {
		sum1[i] = (S[i - 1] == '1') ? sum1[i - 1] + 1 : sum1[i - 1];
		lr[i] = i;
	}

	for (int i = 0; i < M; ++i) {
		cin >> l >> r;
		for (int j = l; j <= r; ++j) {
			if (r > lr[j])
				lr[j] = r;
		}
	}

	vi v(N + 1, 0);
	dp.resize(N + 1, v);
	dp[0][0] = 1;
	for (int i = 0; i < N; ++i) {
		l = i - (lr[i] - sum1[lr[i]]);
		if (l < 0)
			l = 0;
		r = sum1[lr[i]];
		for (int j = l; j <= r; ++j) {
			dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
		}
	}

	int ans = dp[N][sum1[N]];
	cout << ans << '\n';
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  int num_day;
  if (s == "SUN") num_day = 7;
  if (s == "MON") num_day = 6;
  if (s == "TUE") num_day = 5;
  if (s == "WED") num_day = 4;
  if (s == "THU") num_day = 3;
  if (s == "FRI") num_day = 2;
  if (s == "SAT") num_day = 1;

  cout << num_day << endl;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	class Vertex {
		int id;
		int[] vertices;
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());

		int discovered[] = new int[n];
		int completed[] = new int[n];
		Vertex[] vertices = new Vertex[n];

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

			StringTokenizer st = new StringTokenizer(reader.readLine());
			int id = Integer.parseInt(st.nextToken());
			int cnt = Integer.parseInt(st.nextToken());

			vertices[i] = new Vertex();
			vertices[i].id = id;
			vertices[i].vertices = new int[cnt];
			for (int j = 0; j < cnt; j++) {
				vertices[i].vertices[j] = Integer.parseInt(st.nextToken());
			}

			discovered[i] = completed[i] = -1;
		}
		reader.close();
		
		DFS(n, vertices, completed, discovered);
		
		for (int i = 0; i < n; i++) {
			Vertex vertex = vertices[i];
			System.out.println(vertex.id + " " + completed[i] + " " + discovered[i]);
		}
	}

	private void DFS(int n, Vertex[] vertices, int[] discovered, int[] completed) {
		int time = 0;
		for (int i = 0; i < n; i++) {
			Vertex vertex = vertices[i];
			Stack<Integer> stack = new Stack<Integer>();
			if (discovered[vertex.id - 1] == -1) {
				stack.push(vertex.id);
			}
			while (!stack.isEmpty()) {
				vertex = vertices[stack.peek()-1];
				if (discovered[vertex.id - 1] == -1) {
					discovered[vertex.id - 1] = ++time;
				}
				int id = findNextVertex(vertices, discovered, vertex);
				if (id != -1) {
					discovered[id - 1] = ++time;
					stack.push(id);
				} else {
					completed[vertex.id - 1] = ++time;
					stack.pop();
				}
			}
		}
	}

	private int findNextVertex(Vertex[] vertices, int[] discovered, Vertex vertex) {
		for (int i = 0; i < vertex.vertices.length; i++) {
			int id = vertex.vertices[i];
			if (discovered[id - 1] == -1) return id;
		}
		return -1;
	}
}



Measured memory_bytes: 24720
n = int(input())
nums = list(map(int, input().split()))
d = [0 for _ in range(10 ** 5 + 10)]
for k in nums:
	d[k] += 1

ans = sum(nums)

q = int(input())
for _ in range(q):
	query = list(map(int, input().split()))
	k = d[query[0]]
	if k >= 1:
		ans += (query[1] - query[0]) * k
		d[query[0]] = 0 
		d[query[1]] += k
	print(ans)

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

#define int long long
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<pi>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) int t;cin>>t;while(t--)solve()
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define f(n) for (int i=0;i<n;++i)
#define init(arr,m,n,value) std::fill(*arr,*arr+m*n,value)
#define low(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define up(s) transform(s.begin(),s.end(),s.begin(),::toupper)
//debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);

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

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void solve(){
	
}

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//clock_t z = clock();
	int n;
	cin>>n;
	vii v;
	for (int i=0;i<n;++i){
		int a,b;
		cin>>a>>b;
		v.pb({a,b});
	}
	for (int i=0;i+2<n;++i){
		if (v[i].first==v[i].second && v[i+2].first==v[i+2].second && v[i+1].first==v[i+1].second){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}


Measured memory_bytes: 3616
#include<stdio.h>
#include<string.h>
void main(){
    char str_s[11]={},str_t[11]={},str_u[11]={};
    int n_a=0,n_b=0;

    scanf("%s %s",str_s,str_t);
    scanf("%d %d",&n_a,&n_b);
    scanf("%s",str_u);

    if(strcmp(str_s,str_u) == 0){
        n_a--;
    }else if(strcmp(str_t,str_u) == 0){
        n_b--;
    }

    printf("%d %d\n",n_a,n_b);

}

Measured memory_bytes: 128
S=input()
"""
#最終的にどこかに収束するはず
#Rから出発した人はLがある場所まで進み、あとはLとRで反復
Lも同様

"""
ans=[0]*len(S)
R,L=0,0
points=[]#i,i+1、R,Lの4要素リストが格納
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":#RかLが連続している
        R+=1
    elif S[i]=="L" and S[i+1]=="L":#RかLが連続している
        L+=1
    #みんなが集まるポイント
    elif S[i]=="R" and S[i+1]=="L":
        if ans[i]==0:
            ans[i]=1
        if ans[i+1]==0:
            ans[i+1]=1
        #今まで数えてきたRを足す
        ans[i]+=R//2
        ans[i+1]+=R//2+R%2#余りはもらう
        points=[i,i+1]
        R=0#R区間初期化
    #ここまで数えてきたLを前の数値に足す
    elif S[i]=="L" and S[i+1]=="R":
        if len(points)>0 and L>0:
            ans[points[0]]+=L//2+L%2#余りはもらう
            ans[points[1]]+=L//2
        L=0#L区間初期化
        points=[]
#拾い残し回収
if L>0 and len(points)>0:
    ans[points[0]]+=L//2+L%2#余りはもらう
    ans[points[1]]+=L//2

map = map(str, ans)
print(' '.join(map))

Measured memory_bytes: 78824
fun main(args: Array<String>) {
    readLine()
    val input =
        readLine()!!
            .split(" ")
            .map { it.toInt()}
    var maxCnt = 0
    var tmpCnt = 0
    var lastNum = 0
    for (n in input) {
        if (n <= lastNum) tmpCnt++  else tmpCnt = 0
        maxCnt = if (maxCnt > tmpCnt) maxCnt else tmpCnt
        lastNum = n
    }
    print(maxCnt)
}

Measured memory_bytes: 55900
#include <iostream> 
#include <sstream> 
#include <fstream> 
#include <string> 
#include <vector> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <algorithm> 
#include <functional> 
#include <utility> 
#include <bitset> 
#include <cmath> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
using namespace std;

int main(){
	int N;
	cin>>N;
	int a[100005];
	for(int i=1;i<=N;i++) cin>>a[i];
	int ind=1;
	int j;
	for(j=1;a[ind]!=2;j++){
		ind=a[ind];
		if(j>N){
			cout<<-1<<endl;
			exit(0);
		}
	}
	cout<<j<<endl;
return 0;
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdlib.h>
#include <iostream>

using namespace std;
 
int main(){
  int s;
  cin >> s;
  if (s==25){
    cout << "Christmas" << endl;
  }
  else if (s == 24){
    cout << "Christmas Eve" << endl;
  }
  else if (s == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  if (s ==  22){
    cout << "Christmas Eve Eve Eve";
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	string A, B, C;
	cin >> N >> A >> B >> C;
	int res = 0;
	REP(i, N) {
		if (A[i] == B[i] && B[i] == C[i]);
		else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) res++;
		else res += 2;
	}
	cout << res << "\n";
	
	return 0;
}

Measured memory_bytes: 256