akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

map<ll, ll> primeFactor(ll n) {
  map<ll, ll> res;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}

int main() {
  ll n;
  cin >> n;
  auto pf = primeFactor(n);
  ll ans = 0;
  for(auto v : pf) {
    ll now = 1;
    while(v.second >= now) {
      ans++;
      v.second -= now;
      now++;
    }
  }
  cout << ans << endl;
}

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

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

if(a<b){
   if(b<c){
      cout<< a<<" "<< b<<" "<< c<<endl;
   }else{
      if(a<c){
         cout<< a<<" "<< c<<" "<< b<<endl;
      }else{
         cout<< c<<" "<< a<<" "<< b<<endl;
      }
   }
}else{
   if(a<c){
      cout<< b<<" "<< a<<" "<< c<<endl;
   }else{
      if(b<c){
         cout<< b<<" "<< c<<" "<< a<<endl;
      }else{
         cout<< c<<" "<< b<<" "<< a<<endl;
      }
   }

}
return 0;
}

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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

vector<vector<int>> edges;

int dfs(int i,int p = -1) {
    int g = 0;
    for (int& j : edges[i]) if (j != p) {
        g ^= dfs(j,i)+1;
    }
    return g;
}

int main() {
    int n;
    cin >> n;
    edges.resize(n);
    for (int i = 0;i < n-1;++i) {
        int u,v;
        cin >> u >> v;
        u--;v--;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    cout << (dfs(0) ? "Alice" : "Bob") << endl;
    return 0;
}

Measured memory_bytes: 10368
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int MAX = 1000000;
		boolean[] prime = new boolean[MAX + 1];
		for (int i = 4; i <= MAX; i += 2) {
			prime[i] = true;
		}
		for (int i = 3; i <= Math.sqrt(MAX); i += 2) {
			if (!prime[i]) {
				for (int j = i * 3; j <= MAX; j += i * 2) {
					prime[j] = true;
				}
			}
		}
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			if ((n | m) == 0)
				break;
			int[] a = new int[n];
			int min = Integer.MAX_VALUE;
			boolean[] f = new boolean[m + 1];
			for (int i = 0; i < n; i++) {
				int s = scanner.nextInt();
				min = Math.min(s, min);
				a[i] = s;
				for (int j = s; j <= m; j += s) {
					f[j] = true;
				}
			}
			Arrays.sort(a);
			int max = 0;
			for (int i = min; i <= m; i++) {
				if (!f[i])
					for (int j = 0; j < n; j++) {
						if (i - a[j] >= 0 && f[i - a[j]]) {
							f[i] = true;
							break;
						}
					}
				if (f[i] && !prime[i])
					max = i;
			}
			System.out.println(max == 0 ? "NA" : max);

		}

	}
}

Measured memory_bytes: 59536
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    vector<int> A;
    int minimum = INT_MAX;
    int maximum = INT_MIN;
    int min_index = -1;
    int max_index = -1;
    for(int i = 0;i < N;i++){
        int a;cin>>a;
        A.push_back(a);
        if(minimum > a){
            minimum = a;
            min_index = i;
        }
        if(maximum < a){
            maximum = a;
            max_index = i;
        }
    }
    vector<int> ops;
    bool positive = (maximum>0 && abs(minimum)<abs(maximum));
    for(int i = 0;i < N;i++){
        if(positive && A[i] < 0){
            A[i] += maximum;
            ops.push_back(max_index);
            ops.push_back(i);
        }else if(!positive && A[i] > 0){
            A[i] += minimum;
            ops.push_back(min_index);
            ops.push_back(i);
        }
    }
    cout<<ops.size()/2+N-1<<endl;
    for(int i = 0;i < ops.size();i+=2){
        cout<<ops[i]+1<<" "<<ops[i+1]+1<<endl;
    }
    for(int i = 1;i <= N-1;i++){
        if(positive){
            cout<<i<<" "<<i+1<<endl;
        }else{
            cout<<N+1-i<<" "<<N+1-i-1<<endl;
        }
        
    }
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
guides = [0] * (n + 1)
connections = {}
m.times.map{|i|
    a, b = gets.split.map(&:to_i)
    if !connections.has_key?(a)
        connections[a] = []
    end
    if !connections.has_key?(b)
        connections[b] = []
    end
    connections[a].push(b)
    connections[b].push(a)
}
current = [1]
next_current = []
while !current.empty?
    current.each{|new_cell|
        connections[new_cell].each{|next_cell|
            if guides[next_cell] == 0
                guides[next_cell] = new_cell
                next_current.push(next_cell)
            end
        }
    }
    current = next_current
    next_current = []
end

puts 'Yes'
guides[2..-1].each{|it|
    puts it
}

Measured memory_bytes: 35624
#include <stdio.h>
using namespace std;
int main(){ int W,H,x,y,r; 

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if((x >= r && x <= W-r) && (y >= r && y <= H-r)) printf("Yes\n");

else{ printf("No\n"); 
    
}
} 



Measured memory_bytes: 2692
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

int main() {
  int N, K;
  string s;
  cin >> N >> K;
  cin >> s;
  s[K-1] += 'a' - 'A';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=15000005,M=3,INF=1<<30;
bool seen[MAX];
ll ans[17],x[17],y[17],p[17];
int N;
ll rui[17];
ll maex[500005][17],maey[500005][17];

void DFS(ll state,int cnt){
    if(seen[state]) return;
    seen[state]=1;
    
    ll sum=0;
    
    int xs=0,ys=0;
    ll now=state;
    for(int j=0;j<N;j++){
        if(now%M==1) xs+=1<<j;
        else if(now%M==2) ys+=1<<j;
        now/=M;
    }
    
    now=state;
    
    for(int i=0;i<N;i++){
        if(now%M==0){
            ll mi=1LL<<60;
            chmin(mi,min(abs(x[i]),abs(y[i])));
            chmin(mi,maex[xs][i]);
            chmin(mi,maey[ys][i]);
            sum+=mi*p[i];
            
            DFS(state+rui[i],cnt+1);
            DFS(state+rui[i]*2,cnt+1);
        }
        now/=M;
    }
    
    chmin(ans[cnt],sum);
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i]>>p[i];
    }
    
    for(int i=0;i<17;i++) ans[i]=1LL<<60;
    
    rui[0]=1;
    for(int i=1;i<17;i++) rui[i]=rui[i-1]*3;
    
    for(int bit=0;bit<(1<<N);bit++){
        for(int i=0;i<N;i++){
            maex[bit][i]=1LL<<60;
            maey[bit][i]=1LL<<60;
            for(int j=0;j<N;j++){
                if(!(bit&(1<<j))) continue;
                chmin(maex[bit][i],abs(x[i]-x[j]));
                chmin(maey[bit][i],abs(y[i]-y[j]));
            }
        }
    }
    
    DFS(0,0);
    
    for(int i=0;i<=N;i++){
        cout<<ans[i]<<"\n";
    }
}


Measured memory_bytes: 26380
#include<stdio.h>
int insertionSort( int A[], int n, int g, int *cnt ){

  int i,j,v;
  
  for ( i = g ; i < n ; i++ ){

    v = A[i];
    j = i - g;
    
    while ( j >= 0 && A[j] > v ){
      A[ j + g ] = A[j];
      j = j - g;
      *cnt += 1;
    }

    A[ j + g ] = v;
    
  }

  return 0;

}
int main(){

  int i,k,m,n,A[1000001],G[21],cnt;

  cnt = 0;

  scanf("%d", &n );

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

  m = 1;
  k = 1;
  while ( k * 2 < n ){
    k *= 2;
    m += 1;
  }

  for ( i = 0 ; i < m ; i++ ){
    if ( i == 0 ) {
      G[i] = k;
    } else {
      G[i] = G[ i - 1 ] / 2;
    }
  }

  for ( i = 0 ; i < m ; i++ ){
    insertionSort( A, n, G[i], &cnt );
  }

  printf("%d\n", m );

  for ( i = 0 ; i < m ; i++ ){
    if ( i < m - 1 ) {
      printf("%d ", G[i] );
    } else {
      printf("%d\n", G[i] );
    }
  }

  printf("%d\n", cnt );

  for ( i = 0 ; i < n ; i++ ){
    printf("%d\n", A[i] );
  }

  return 0;

}

Measured memory_bytes: 4504
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

int main() {
    double l;
    cin >> l;
    double ans = (l * l * l) / 27;
    printf("%.10lf", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll n;
	cin >> n;
	
	ll ans = n * (n - 1LL) / 2LL;
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e8;
const int INF = 1e9;
const int MOD = 998244353;


void bad() {
    cout << -1;
    exit(0);
}

int main() {
    int n;
    cin >> n;
    int a[n], b[n];
    set<pair<int, int>> st;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        if (a[i] != b[i])
            st.emplace(b[i], i);
    }
    ll ans = 0;
    while (!st.empty()) {
        int ind = st.rbegin()->second;
        st.erase(--st.end());
        int pre = (ind - 1 + n) % n;
        int next = (ind + 1) % n;
        ll sm = b[pre] + b[next];
        if (b[ind] - a[ind] < sm)
            bad();
        ll k = (b[ind] - a[ind]) / sm;
        ans += k;
        b[ind] -= k * sm;
        if (b[ind] != a[ind])
            st.emplace(b[ind], ind);
    }
    for (int i = 0; i < n; i++)
        if (a[i] != b[i])
            bad();
    cout << ans;
}

Measured memory_bytes: 13184
class Node

  attr_accessor:id, :parent, :left, :right, :depth, :height, :sibling

  def initialize(id)
    @id = id
    @parent = nil
    @left = nil
    @right = nil
    @depth = 0
    @height = 0
    @sibling = nil
  end

  def depth
    if @parent.nil?
      0
    else
      @parent.depth + 1
    end
  end

  def height
    left_height =
      if @left.nil?
        -1
      else
        @left.height
      end
    right_height =
      if @right.nil?
        -1
      else
        @right.height
      end
    if left_height > right_height
      left_height + 1
    else
      right_height + 1
    end
  end

  def type
    if @parent == nil
      "root"
    elsif @child_left.nil?
      "leaf"
    else
      "internal node"
    end
  end

  def to_s
    parent_id =
      if @parent.nil?
        -1
      else
        @parent.id
      end

    sibling =
      if @sibling.nil?
        -1
      else
        @sibling.id
      end

    degree = 0
    if @left != nil
      degree = degree + 1
    end
    if @right != nil
      degree = degree + 1
    end

    type =
      if @parent.nil?
        "root"
      elsif @left.nil? && @right.nil?
        "leaf"
      else
        "internal node"
      end

    "node #{@id}: parent = #{parent_id}, sibling = #{sibling}, degree = #{degree}, depth = #{depth}, height = #{height}, #{type}"
  end

  def children_to_s
    ss = []
    if @child_left.nil?
      ss
    else
      a = @child_left
      while a != nil
        ss.push(a.id.to_s)
        a = a.right_sibling
      end
      ss
    end
  end
end

def preorder(node, arr)
  if node != nil
    arr.push(node.id)
    l = node.left
    preorder(l, arr)
    r = node.right
    preorder(r, arr)
  end
end

def inorder(node, arr)
  if node != nil
    l = node.left
    inorder(l, arr)
    arr.push(node.id)
    r = node.right
    inorder(r, arr)
  end
end

def postorder(node, arr)
  if node != nil
    l = node.left
    postorder(l, arr)
    r = node.right
    postorder(r, arr)
    arr.push(node.id)
  end
end


n = STDIN.gets.to_i

tree = []
for i in 0..(n - 1)
  as = STDIN.gets.split(' ')
  id = as[0].to_i
  left_id = as[1].to_i
  right_id = as[2].to_i

  node = tree[id]
  if node.nil?
    node = Node.new(id)
    tree[id] = node
  end

  if left_id != -1
    left = tree[left_id]
    if left.nil?
      left = Node.new(left_id)
      tree[left_id] = left
    end
    left.parent = node
    node.left = left
  end

  if right_id != -1
    right = tree[right_id]
    if right.nil?
      right = Node.new(right_id)
      tree[right_id] = right
    end
    right.parent = node
    node.right = right
  end

  if left_id != -1 && right_id != -1
    node.left.sibling = node.right
    node.right.sibling = node.left
  end

end

root = tree.find {|node|
  node.type == "root"
}

puts "Preorder"
as = [""]
preorder(root, as)
puts as.join(" ")

puts "Inorder"
bs = [""]
inorder(root, bs)
puts bs.join(" ")

puts "Postorder"
cs = [""]
postorder(root, cs)
puts cs.join(" ")

Measured memory_bytes: 8748
N = int(input())
A = [int(x) for x in input().split()]

min_A = min(A)
max_A = max(A)

if min_A == max_A:
    print(0)
elif max_A < 0:
    print(N - 1)
    for i in range(N - 1, 0, -1):
        print(i + 1, i)
elif min_A > 0:
    print(N - 1)
    for i in range(N - 1):
        print(i + 1, i + 2)
else:
    if abs(min_A) > max_A:
        index = A.index(min_A)
    else:
        index = A.index(max_A)

    print(2 * N - 1)
    for i in range(N):
        print(index + 1, i + 1)

    if abs(min_A) > max_A:
        for i in range(N - 1, 0, -1):
            print(i + 1, i)
    else:
        for i in range(N - 1):
            print(i + 1, i + 2)


Measured memory_bytes: 3064
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
A,B,C,D = [x for x in S()]
for op1,op2,op3 in itertools.product(['+','-'],repeat=3):
    if eval('{}{}{}{}{}{}{}'.format(A,op1,B,op2,C,op3,D))==7:
        print(*[A,op1,B,op2,C,op3,D,'=7'],sep='')
        break


Measured memory_bytes: 3060
function bomb(x,y,c){
   var dx=[0,-1,1,0];
   var dy=[-1,0,0,1];
   max=Math.max(max,c);
   for(var i=0;i<4;i++){
      var xx=x+dx[i];
      var yy=y+dy[i];
      if(xx<0 || yy<0 || xx>=m || yy>=n)continue;
      if(YX[yy][xx]==0)continue;
      YX[yy][xx]=0;
      bomb(xx,yy,c+1);
      YX[yy][xx]=1;
   }
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var m=Arr.shift()-0;
   var n=Arr.shift()-0;
   if(m==0 && n==0)break;
   var yx=[];
   for(var i=0;i<n;i++){
      var v=Arr.shift().split(" ").map(Number);
      yx.push(v);
   }
   var max=0;
   for(var i=0;i<m;i++){
      for(var j=0;j<n;j++){
         var YX=yx.map(function(v){return v.slice();});
         if(YX[j][i]==1)bomb(i,j,0);
      }
   }
   console.log(max);
}

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

void solve(int n, vector<int>& arr) {
	unordered_map<int, vector<int>> mp;
	for (int i=0; i<n; i++) mp[arr[i]].push_back(i);
	if (mp[1].size() == 1) {
		cout << 1;
		return;
	}
	if (mp[1].size() > 1) {
		cout << 0;
		return;
	}
	int cnt = 0;
	for (auto a : arr) {
		if (mp[a].size() > 1) continue;
		cnt++;
		for (int i=2; i<=sqrt(a); i++) {
			if (a % i == 0 && (mp[i].size() > 0 || mp[a/i].size() > 0)) {
				cnt--;
				break;
			}
		}
	}
	cout << cnt;
	
}

int main() {
	int n; cin >> n;
	vector<int> arr(n);
	for (int i=0; i<n; i++) cin >> arr[i];
	solve(n, arr);
}	


Measured memory_bytes: 47564
#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 rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

vi memo(100005);

bool is_prime(long long _Num){
    if(_Num < 2)return false;
    if(_Num % 2 == 0){
        if(_Num == 2)return true;
        else return false;
    }
    bool prime = true;
    for(long long i = 3; i <= sqrt(_Num); i += 2){
        if(_Num % i == 0){
            prime = false;
            break;
        }
    }
    return prime;
}

int main(void) {
    int q;
    cin >> q;

    for (int i = 1; i <= 100001; i += 2) {
        if (is_prime(i) && is_prime((i + 1) / 2)) memo[i]++;
    }

    for (int i = 1; i <= 100001; i++) memo[i] += memo[i - 1];

    rep (i, q) {
        int l, r;
        cin >> l >> r;
        cout << memo[r] - memo[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double ans,a;
string b;
int main(void){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(b=="JPY")ans+=a;
        else{
            ans+=a*380000;
        }
    }
    cout<<setprecision(15)<<ans<<endl;
}


Measured memory_bytes: 256
#一文字ずつ区切る
chars = list(input())
#文字列で入っているぽい[2017/01/07]
#['2', '0', '1', '7', '/', '0', '1', '/', '0', '7']
# 文字を入れ替える
chars[3]="8"

# 文字を出力する
for s in chars:
  # スペーサーをなしに設定
  print(s, end ="")

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;

namespace diverta2019D
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = CIN.Long();

            Dictionary<long, int> soinsuu = new Dictionary<long, int>();
            long temp = N;
            long a = 2;
            double Root = Math.Sqrt(N);
            while (temp > 1)
            {
                if (temp % a == 0)
                {
                    if (soinsuu.ContainsKey(a))
                    {
                        soinsuu[a]++;
                        temp /= a;
                        continue;
                    }

                    soinsuu.Add(a, 1);
                    temp /= a;
                    continue;
                }

                a++;
                if (a > Root)
                {
                    soinsuu.Add(temp, 1);
                    break;
                }
            }

            long flag = 1;
            foreach (KeyValuePair<long, int> sosuu in soinsuu)
            {
                flag *= sosuu.Value + 1;
            }

            Dictionary<long, bool> aa = new Dictionary<long, bool>();
            long ans = 0;
            for (int i = 0; i < flag; i++)
            {
                int l = i;
                long K = 1;
                foreach (var keyValuePair in soinsuu)
                {
                    int ko = l % (keyValuePair.Value + 1);
                    K *= (long) Math.Pow(keyValuePair.Key, ko);
                    l /= keyValuePair.Value + 1;
                }

                if (K > N / K + 1 && !aa.ContainsKey(K))
                {
                    aa.Add(K, true);
                    ans += K - 1;
                }
            }

            Console.WriteLine(ans);
        }
    }

    internal static class CIN
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13276
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF = (ll)1e18;
const int N = 200200;
ll ANS;
int n;
ll a[N];
ll prefSum[N];
ll X;

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

	scanf("%d%lld", &n, &X);
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	for (int i = 0; i < n; i++)
		prefSum[i + 1] = prefSum[i] + a[i];
	ANS = INF;
	for (int k = 1; k <= n; k++) {
		ll curAns = k * X;
		int r = n;
		curAns += 2 * (prefSum[r] - prefSum[r - k]);
		ll z = 1;
		while(r > 0) {
			z += 2;
			int l = max(0, r - k);
			ll sum = prefSum[r] - prefSum[l];
			if (2 * INF / z < sum) {
				curAns = INF;
				break;
			}
			curAns += sum * z;
			curAns = min(curAns, INF);
			r = l;
		}
		ANS = min(ANS, curAns);
	}


	ANS += n * X;
	printf("%lld\n", ANS);

	return 0;
}


Measured memory_bytes: 3328
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final int H = sc.nextInt();
        final int W = sc.nextInt();
        String[] S = new String[H];
        int[] dx = {1, 0, -1, 0};
        int[] dy = {0, 1, 0, -1};
        for(int i = 0;i < H;i++)    S[i] = sc.next();
        boolean ans = true;
        loop: for(int i = 0;i < H;i++){
            for(int j = 0;j < W;j++){
                char s = S[i].charAt(j);
                if(s == '#'){
                    boolean f = false;
                    for(int k = 0;k < 4;k++){
                        int x = j+dx[k];
                        int y = i+dy[k];
                        if(x >= 0 && x < W && y >= 0 && y < H && S[y].charAt(x) == '#') f = true;
                    }
                    if(!f){
                        ans = false;
                        break loop;
                    }
                }
            }
        }
        if(ans) System.out.println("Yes");
        else    System.out.println("No"); 
    }
}

Measured memory_bytes: 21716
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int X,Y;
    cin>>X>>Y;
    REP(i,101){
        REP(j,101){
            if(i+j!=X) continue;
            if(2*i+4*j==Y){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

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

int main()
{
    int n,m;
    std::cin >> n >> m;
    std::vector<std::vector<int>> c(n+1);
    std::vector<std::pair<int, int>> o;
    for (int i = 0; i < m; i++) {
        int p, y;
        std::cin >> p >> y;
        o.emplace_back(p, y);
        c[p].push_back(y);
    }

    for (int i = 0; i < n+1; i++) {
        std::sort(c[i].begin(), c[i].end());
    }

    for (int i = 0; i < m; i++) {
        int p = o[i].first;
        auto it = std::lower_bound(c[p].begin(), c[p].end(), o[i].second);
        printf("%06d%06lu\n", p, std::distance(c[p].begin(), it)+1);
    }

    return 0;
}


Measured memory_bytes: 7796
#include<iostream>
#include<string>
#include<stdio.h>

std::string f( const std::string &s )
{
	std::string ret;

	for( int i = 0; i < s.size(); i++ ){
		int r = 1;
		
		while( s[i] == s[i+1] ){
			r++;
			i++;
		}
		
		char ch[10];
		sprintf( ch, "%d", r );
		
		ret += ch;
		ret += s[i];
	}
	
	return ret;
}

int main()
{
	int n;
	std::string s;
	while( std::cin >> n, n ){
		std::cin >> s;
		
		while( n-- ){
		 	s = f( s );
		}
	
		std::cout << s << std::endl;
	}

 	return 0;
}

Measured memory_bytes: 1372
/*痛みを受け取れ，痛みを知れ*/
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 5e5 + 5;

int main()
{
	//freopen("in.txt", "r", stdin);
	int a, b;
	while (cin >> a >> b)
	{
		if (a > b)swap(a, b);
		int ans = -1;
		f(i, 1, 100000)
		{
			int aa = i * 0.08;
			int bb = i * 0.1;
			if (aa == a && b == bb) { ans = i;break; }
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
n,m=map(int, input().split())

A=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    c=[]
    for j in range(m):
        c += A[i][j]*b[j]
    print(sum(c))


Measured memory_bytes: 6768
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#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 all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};
 
ll dp[100010][13];

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

	dp[0][0] = 1;
	for(int i = 0; i < s.size(); i++){
		for(int j = 0; j < 13; j++){
			for(int k = 0; k < 10; k++){
				if(s[i] == '?' || s[i]-'0' == k){
					dp[i+1][(j*10+k)%13] += dp[i][j];
					dp[i+1][(j*10+k)%13] %= MOD;
				}
			}
		}
	}

	cout << dp[s.size()][5] << endl;

	return 0;
}

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

int main() {
  int64_t a,b,c,d;
  int64_t e;
  cin >> a >> b >> c >> d;
  e = a * c;
  if (a * d > e){
    e = a * d;
  }
  if (b * d > e){
    e = b * d;
  }
  if (b * c > e){
    e = b * c;
  }
  cout << e << endl;
}


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

int main(void){
	int N,Y;
	cin >> N >> Y;
	bool flag=false;
	for(int i=0;i<N+1;i++){
		for(int j=0;j<N+1-i;j++){
			if(1000*i+5000*j+10000*(N-i-j)==Y){
				cout << N-i-j << " " << j << " " << i << endl;
				flag=true;
				return 0;
			}
		}
	}	
	if(flag==false){
	cout << "-1 -1 -1" << 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 = int64_t;
using pint = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
      n: usize,
      aa: [usize; n],
    }
    let mut aa = aa;
    aa.sort();
    println!("{}", aa[n-1] - aa[0]);
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int64_t> a_vec(N);
    for (int i = 0; i < N; ++i)
        cin >> a_vec.at(i);
    int64_t min_cost = -1;
    for (int i = 1; i < (1 << N); ++i) {
        bitset<15> visible(i);
        if (static_cast<int>(visible.count()) != K)
            continue;
        int64_t prev_hight = 0;
        int64_t cost = 0;
        for (int j = 0; j < N; ++j) {
            int64_t hight = a_vec.at(j);
            if (visible.test(j) == 1 && hight <= prev_hight) {
                cost += prev_hight + 1 - hight;
                hight = prev_hight + 1;
            }
            prev_hight = max(prev_hight, hight);
        }
        if (min_cost == -1 || min_cost > cost)
            min_cost = cost;
    }
    cout << min_cost << endl;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
typedef unsigned long long int ull;
using namespace std;

int LIS(int* A,int L){
  int DP[L];
  fill(DP,DP+L,INF);
  rep(i,L) *upper_bound(DP,DP+L,A[i])=A[i];
  return lower_bound(DP,DP+L,INF)-DP;
}
int LCM(int a,int b){
  int tmp,r,x;
  x=a*b;
  if(a<b) tmp=a,a=b,b=tmp;
  r=a%b;
  while(r!=0) a=b,b=r,r=a%b;
  x=x/b;
  return x;
}
int GCD(int a,int b){
  return (a*b)/LCM(a,b);
}

int main(void){
  int N;
  cin >> N;
  int h[N],dp[N];
  rep(i,N) cin >> h[i];
  dp[0]=0,dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<N;i++) dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  cout << dp[N-1] << endl;
}

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

int main(){
    int n,ans=0;
    cin >>n;
    vector<int> d(n);
    rep(i,n) cin >> d.at(i);
    rep(k,n){
        rep(l,n){
            if(k<l) ans += d[k]*d[l];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    int n;
    cin >> n;
    cout << pow(n,3) << endl;;
        
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = str(input())
lst = []

for i in range(n-1):
    x = list(s[:i+1])
    y = list(s[i+1:])
    x1 = list(set(x))
    y1 = list(set(y))
    z = x1 + y1
    z1 = list(set(z))

    lst.append(len(z)-len(z1))

print(max(lst))

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	bool F[101][10] = {};
	rep(i, N) {
		rep(j, 10) {
			cin >> F[i][j];
		}
	}
	int P[101][11];
	rep(i, N) {
		rep(j, 11)cin >> P[i][j];
	}
	priority_queue<int>ans;
	reps(i,1, 1<<11-1) {
		int k = i;
		int cnt[101] = {};
		rep(j, 10) {
			bool f = k % 2;
			k /= 2;
			if (!f)continue;
			rep(x, N) {
				if (F[x][j] && f)cnt[x]++;
			}
		}
		int sum = 0;
		bool flag = false;
		rep(j, N) {
			if (P[j][cnt[j]])flag = true;
			sum += P[j][cnt[j]];
		}
		if (flag == false)cout << i<<endl;
		if (flag)ans.push(sum);
	}
	cout <<ans.top() << endl;

	return 0;
}

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

int main() {
  int N, order;
  
  // input
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for(int i = 0;i < N;i++) {
    cin >> A.at(i);
    B.at(A.at(i)-1) = i+1;
  }
  
  // output
  for(int i=0;i<N;i++) {
    cout << B.at(i) << " ";
  }
  cout << endl; 
}


Measured memory_bytes: 1536
N = int(input())

#6,9の累乗のリスト
sixs = []
t = 1
while t <= N:
    sixs.append(t)
    t *= 6

nines = []
t = 1
while t <= N:
    nines.append(t)
    t *= 9


ans = N

#aを６の指数乗、N-aを９の指数乗で支払う
for i in range(N+1):
    cnt = 0
    a = i
    b = N - i
    for num in list(reversed(sixs)):
        
        if a == 0:
            break
        elif a <= 5:
            cnt += a
            a = 0
        else:
            if a >= num:
                #if a == 36: print(a // num, num)
                tmp = a // num
                cnt += tmp
                a -=  num * tmp
                #if i == 36: print(a,cnt)
            else:
                continue
    #if i == 36: print(cnt)
    for num in list(reversed(nines)):
        
        if b == 0:
            break
        elif b <= 8:
            cnt += b
            b = 0
        else:
            if b >= num:
                tmp = b // num
                cnt += tmp
                b -=  num * tmp
            else:
                continue


    ans = min(ans, cnt)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int N;
  string s;
  cin >> N >> s;
  vector<int> counts(26);

  for (int i = 0; i < N; ++i) {
    const int d = s[i] - 'a';
    ++counts[d];
  }

  const int Mod = 1e9 + 7;
  int ans = 1;

  for (int i = 0; i < 26; ++i) {
    ans = (LL)ans * (counts[i] + 1) % Mod;
  }
  cout << (ans + Mod - 1) % Mod << "\n";

}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ostream>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007, INF = 1e10;

int main(){
  int n;
  long long zmi=2e9,zma=-2e9,wmi=2e9,wma=-2e9;
  cin>>n;
  while(n--){
    long long x,y;
    cin>>x>>y;
    zmi=min(zmi,x+y);
    zma=max(zma,x+y);
    wmi=min(wmi,x-y);
    wma=max(wma,x-y);
  }
  cout<<max(zma-zmi,wma-wmi)<<"\n";
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;

int main(){
  int N,Q;
  ll K;
  cin >> N >> K >> Q;

  map<int, int> m;
  REP(i,Q){
    int A;
    cin >> A;
    A--;
    m[A]++;
  }

  REP(i,N){
    if(K - Q + m[i] > 0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }

}



Measured memory_bytes: 5888
package main

import "fmt"

func main() {
	var N, K int
	fmt.Scanf("%d %d", &N, &K)
	
	var cnt int = 0
	for i := 0; i < N; i++ {
		var h int
		fmt.Scanf("%d", &h)

		if h >= K {
			cnt++
		}
	}

	fmt.Println(cnt)
}

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

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007


int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  vector<int> x, y;

  for (int i = 0; 100 * A * i <= F; i++) {
    for (int j = 0; 100 * A * i + 100 * B * j <= F; j++) {
      x.push_back(100 * A * i + 100 * B * j);
    }
  }

  for (int i = 0; C * i <= F; i++) {
    for (int j = 0; C * i + D * j <= F; j++) {
      y.push_back(C * i + D * j);
    }
  }

  int ans_a = 100 * A, ans_s = 0;

  for (auto a : x) {
    for (auto b : y) {
      if (a + b <= F && 100 * b <= a * E && a != 0) {
        if (ans_a * b >= (a + b) * ans_s) {
          ans_a = a + b;
          ans_s = b;
        }
      }
    }
  }

  cout << ans_a << " " <<  ans_s << endl;




}


Measured memory_bytes: 1400
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int n,m,fx,fy,xx,yy,zz,f[110000],ans;
int father(int x){
	if (f[x]!=x) f[x]=father(f[x]);
	return f[x];
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,1,n) f[i]=i;ans=n;
	fo(i,1,m){
		scanf("%d%d%d",&xx,&yy,&zz);
		fx=father(xx);fy=father(yy);
		if (fx!=fy){
			f[fx]=fy;
			ans--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine();
        var length = inputs.Length;
        var front = inputs.Take((length - 1) / 2);
        var back = inputs.Reverse().Take((length - 1) / 2);

        bool isKaibun = inputs.SequenceEqual(inputs.Reverse());

        bool isKaibun1 = front.SequenceEqual(front.Reverse());
        bool isKaibun2 = back.SequenceEqual(back.Reverse());

        if (isKaibun && isKaibun1 && isKaibun2) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

Measured memory_bytes: 13152
#include<iostream>
#include<cctype>
#include<string>
using namespace std;
  
int main()
{
	int i,count = 0;
	string w,t;
	
	cin >>w;//????????????????????????
	
	for( i = 0; i<w.size(); i++){
		w[i] = tolower(w[i]);
	}
	
	while(1){
		cin >> t;//??????????????????
		//END_OF_TEXT??§????????????
		if(t == "END_OF_TEXT") break;
		
		for(int i=0; i<t.size(); i++){
        	t[i] = tolower(t[i]);
		}
    	if (t == w) count++;
	}
	cout << count << endl;
	return 0;
}

//???????????????????????£???

Measured memory_bytes: 1192
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  ll ans=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0)ans+=i;
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>
int main(void)
{
    long long int a,b,k;
    scanf("%lld%lld%lld",&a,&b,&k);

    if(k>=a+b)
    {
        a=0;
        b=0;
    }
    else if(k>a)
    {
        b-=(k-a);
        a=0;
    }
    else if(k<=a)
    {
        a-=k;
    }
    printf("%lld %lld",a,b);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>
#include<time.h>

#define DIV 998244353
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
	
	vector<bool> dpw(F/100 + 1);
	dpw[0] = true;
	for (int k = 0; k < F / 100; k++) {
		if (dpw[k]) {
			if (k + A <= F / 100) {
				dpw[k + A] = true;

			}
			if (k + B <= F / 100) {
				dpw[k + B] = true;

			}

		}
	}

	vector<bool> dps(F + 1);
	dps[0] = true;
	for (int k = 0; k < F ; k++) {
		if (dps[k]) {
			if (k + C <= F) {
				dps[k + C] = true;

			}
			if (k + D <= F) {
				dps[k + D] = true;

			}

		}
	}

	int sw = 0, s = 0;
	for (int i = 0; i <= F / 100; i++) {
		if (!dpw[i]) continue;
		
		for (int j = 0; j <= F; j++) {
			if (!dps[j]) continue;
			if (100 * i + j <= F && j <= i * E) {
				if (s * (100 * i + j) <= sw * j) {
					sw = 100 * i + j, s = j;
				}
			}
			else break;
		}


	}

	cout << sw << " " << s << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main() {
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    vector<vector<int>> ans(h,vector<int>(w));
    for (int i=0;i<b;i++) {
        for (int j=0;j<a;j++) ans[i][j]=0;
        for (int j=a;j<w;j++) ans[i][j]=1;
    }
    for (int i=b;i<h;i++) {
        for (int j=0;j<a;j++) ans[i][j]=1;
        for (int j=a;j<w;j++) ans[i][j]=0;
    }
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) cout << ans[i][j];
        cout << endl;
    }
}

Measured memory_bytes: 5120
from collections import defaultdict

N, M = map(int, input().split())
res = defaultdict(list)
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    res[p].append(s)

num_AC = num_WA = 0
for p, xs in res.items():
    wa = 0
    for i, x in enumerate(xs):
        if x == 'AC':
            num_AC += 1
            num_WA += wa
            break
        else:
            wa += 1

print(num_AC, num_WA)

Measured memory_bytes: 66904
#include<stdio.h>
#include<string.h>
int main(void) {
	char S[10], T[10],U[10];
	int a, b;
	scanf("%s", S);
	scanf("%s", T);
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%s", U);
	if (strcmp(S, U) == 0)
		a = a - 1;
	if (strcmp(T, U) == 0)
		b = b - 1;
	printf("%d ", a);
	printf("%d", b);
	return 0;

}

Measured memory_bytes: 128
/* */
#include<stdio.h>
int main(void)
{
  int p,q,r,max;
  scanf("%d %d %d",&p,&q,&r);
  if(p<=q){
      if(q<=r)
        max=r;
      if(q>r)
        max=q;
  }
  if(p>q){
    if(p>=r)
      max=p;
    if(p<r)
      max=r;
  }
  printf("%d",p+q+r-max);
  return 0;
}


Measured memory_bytes: 128