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

int main(){
 bool run = 1;
 string s;
 cin >> s;
 int inda = -1,indz = -1;
 for(int i = 0; i < s.length(); i++){
    if(s[i] == 'A' && run == 1){
       inda = i;
      run = 0;
    }
   else if(s[i] == 'Z')
      indz = i; 
 }
 cout << indz - inda + 1;
 return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef unsigned long long ull ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll n, x, t, ans, val ;
    cin >> n >> x >> t ;

    val = ceil(double(n) / double(x)) ;
    val *= t ;
    cout << val ;


    return 0 ;
}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<int> A(n + 1), B(n);
    rep(i, n + 1) cin >> A[i];
    rep(i, n) cin >> B[i];
    rep(i, n) {
        if (A[i] <= B[i]) {
            ans += A[i];
            B[i] -= A[i];
            A[i] = 0;
        } else {
            ans += B[i];
            A[i] -= B[i];
            B[i] = 0;
            continue;
        }
        if (B[i] >= A[i + 1]) {
            ans += A[i + 1];
            B[i] -= A[i + 1];
            A[i + 1] = 0;
        } else {
            ans += B[i];
            A[i + 1] -= B[i];
            B[i] = 0;
            continue;
        }
    }
    cout << ans << endl;
}

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


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

const int Max = 25;
int cur = 0;
int n, A[Max], q, m;

int Exhaustive0(int m, int A[], int n, int cur)
{
    if(m==0) return 1;
    if(m<0) return 0;
    if(cur==n) return 0;
    //cout << m << endl;
    if(Exhaustive0(m-A[cur], A, n, cur+1))//选择该值
        return 1;
    if(Exhaustive0(m, A, n, cur+1))//不选
        return 1;
    return 0;
}

int main()
{
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> A[i];
    cin >> q;
    for(int i=0; i<q; i++)
    {
        cin >> m;
        cur = 0;
        //cout << endl;
        if(Exhaustive0(m, A, n, cur))
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
    return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a,b,c,d=1;
signed main()
{
	cin>>a>>b>>c;
	if(a<=b||c-b<2){
		cout<<a+1;
	}else{
		d=b;
		a=a-(b-1);
		d=d+(c-b)*(a/2);
		a=a-(a/2)*2;
		if(a==1){
			cout<<d+1;
		}else{
			cout<<d;
		}
	}
}

Measured memory_bytes: 256
n=int(input())
s=input()
b_c=0
b_t=s.count("#")
ans=b_t
for i in range(n):
  a=b_c+(n-i)-(b_t-b_c)
  ans=min(a,ans)
  if s[i]=="#":
    b_c+=1
print(ans)

Measured memory_bytes: 3500
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int n = scan.nextInt();
        int x = 1;
        int y = 0;
        if (n >= 3 && n <= 10000) {
            for (int count = 0;count < n; count++) {
                y = x / 10;
                if (x % 3 == 0){
                    sb.append(" ")
                        .append(x);
                } else {
                    y = x;
                    while(y != 0) {
                        if (y % 10 == 3) {
                            sb.append(" ")
                                .append(x);
                            break;
                        }
                        y /= 10;
                    }
                }
                x++;
            }
            System.out.println(sb);
        }
    }
}

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

diff_dic = {}
diff_dic[('R', 'G')] = []
diff_dic[('R', 'B')] = []
diff_dic[('G', 'R')] = []
diff_dic[('G', 'B')] = []
diff_dic[('B', 'G')] = []
diff_dic[('B', 'R')] = []

R_lst = [0] * N
G_lst = [0] * N
B_lst = [0] * N

r_cnt = 0
g_cnt = 0
b_cnt = 0

cnt = 0
for i in range(N):
    if S[i] == 'R':
        r_cnt += 1
    elif S[i] == 'G':
        g_cnt += 1
    else:
        b_cnt += 1

    R_lst[i] = r_cnt
    G_lst[i] = g_cnt
    B_lst[i] = b_cnt

    for j in range(i):
        d = i - j
        if (S[i] == 'R' and S[j] == 'G') or (S[i] == 'G' and S[j] == 'R'):
            if j - 1 >=0 and B_lst[j - 1] > 0:
                cnt += B_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'B':
                    cnt -= 1

        if (S[i] == 'G' and S[j] == 'B') or (S[i] == 'B' and S[j] == 'G'):
            if j - 1 >=0 and R_lst[j - 1] > 0:
                cnt += R_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'R':
                    cnt -= 1

        if (S[i] == 'B' and S[j] == 'R') or (S[i] == 'R' and S[j] == 'B'):
            if j - 1 >= 0 and G_lst[j - 1] > 0:
                cnt += G_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'G':
                    cnt -= 1

print(cnt)


Measured memory_bytes: 69204
<?php
$input = trim(fgets(STDIN));
list($w, $h, $x, $y, $r) = sscanf($input, "%d %d %d %d %d");

if (($x+$r)>$w || ($x-$r)<0 || ($y+$r)>$h || ($y-$r)<0) {
    echo "No\n";
} else {
    echo "Yes\n";
}


Measured memory_bytes: 9216
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramC a = new ProgramC();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            //時間に換算して起きてる時間からk時間を除く
            Console.WriteLine(s.Substring(0,3));

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            string[] s1 = Console.ReadLine().Split(' ');
            long a = long.Parse(s1[0]);
            long v = long.Parse(s1[1]);
            string[] s2= Console.ReadLine().Split(' ');
            long b = long.Parse(s2[0]);
            long w = long.Parse(s2[1]);
            long t = long.Parse(Console.ReadLine());
            long temp = t * (v - w);

            //?はD、それ以外は普通に出す
            if (temp >= Math.Abs(a - b))
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }

    class ProgramC
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);
            string[] a1 = Console.ReadLine().Split(' ');

            long[] a = new long[n];

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(a1[i]);


            for (int x = 0; x < k; x++)
            {

                long[] b = new long[n];
                for (int i = 0; i < n; i++)
                {
                    long l = Math.Max(0, i - a[i]);
                    long r = Math.Min(n - 1, i + a[i]);
                    b[l]++;
                    if (r + 1 < n)
                        b[r + 1]--;

                }

                for (int i = 1; i < n; i++)
                    b[i] += b[i - 1];

                for (int i = 0; i < n; i++)
                    a[i] = b[i];

                if (x == 50)
                    break;
            }

            for (int i = 0; i < n; i++)
                Console.Write(a[i] + " ");
        }
    }
}






Measured memory_bytes: 74848
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;

int main() {
  int a,b,c,x,y,ans,lim;
  cin >> a >> b >> c >> x >> y;
  ans = a*x+b*y;
  lim = max(x,y);
  repd(i,1,lim+1){
    int amai = (x-i>=0)?x-i:0;
    int bmai = (y-i>=0)?y-i:0;
    int cans = a*amai+b*bmai+c*2*i;
    ans = min(ans,a*amai+b*bmai+c*2*i);
  }
  cout << ans << endl;
}


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

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

  vector<int> L(N);
  for (int i = 0; i < L.size(); i++) {
    cin >> L.at(i);
  }
  sort(L.begin(), L.end());

  int count = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      if (L.at(i) == L.at(j)) {
        continue;
      }
      for (int k = j + 1; k < N; k++) {
        if (L.at(j) == L.at(k)) {
          continue;
        }
        if (L.at(i) + L.at(j) > L.at(k)) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


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

int main() {
  int parkingHours, parkingFeePerHour, fixedFee;
  cin >> parkingHours >> parkingFeePerHour >> fixedFee;
  
  int plan1Fee = parkingHours * parkingFeePerHour;
  int plan2Fee = fixedFee;
  
  cout << min(plan1Fee, plan2Fee) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include<cmath>
#include<string>
#define pb push_back
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
 
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
 
// look for  all edge cases
//search for a pattern



signed main() {    
	ios::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
		
	int n;
	cin >> n;
	if(n == 0)
		cout<<1;
	else
		cout<<0;
	
	 
	return 0;
}


Measured memory_bytes: 3612
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls)


Measured memory_bytes: 6384
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n < 105) {
        cout << 0 << endl;
    } else if (n >= 105 && n < 135){
        cout << 1 << endl;
    } else if (n >= 135 && n < 165){
        cout << 2 << endl;
    } else if (n >= 165 && n < 189){
        cout << 3 << endl;
    } else if (n >= 189 && n < 195) {
        cout << 4 << endl;
    } else {
        cout << 5 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		for (int i = 0; i <= N; i++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int num[] = new int[n];
		
		for (int i = 0; i < n; i++) {
			num[i]  = scan.nextInt();
		}

		int count = 0;
		
		for (int i = 0; i < n; i++) {
			if (num[i] % 2 == 0 && num[i] > 2) continue;
			boolean isPrime = true;
			for (int j = 3; j * j <= num[i]; j += 2) {
				if (num[i] % j == 0) {
					isPrime = false;
					break;
				}
			}
			if (isPrime) count++;
		}
		
		System.out.println(count);
		scan.close();
	}

}

Measured memory_bytes: 36612
#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      m: usize,
      abs: [(usize,usize); n],
    }
    let mut table = vec![vec![]; m];

    for &(a, b) in abs.iter() {
        if a <= m {
            table[m-a].push(b);
        }
    }
    use std::collections::BinaryHeap;

    let mut q = BinaryHeap::new();
    let mut ans = 0;
    for i in (0..m).rev() {
        for &v in table[i].iter() {
            q.push(v);
        }
        if q.len() > 0 {
            let v = q.pop().unwrap();
            ans += v;
        }
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 12540
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
p(6484)
a(0,1,3)
a(2,3,3,1)
for x in r(2):
	a(x,3,x)
	for t in r(30):b(v:=x+4);a(v,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

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

int main(){
  int n; cin >> n;
  int tmp = n;
  int s = 0;
  while(tmp > 0){
    s += tmp%10;
    tmp /= 10;
  }
  if(n%s == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    long N=sc.nextLong();
    long K=sc.nextLong();
    long min1=0;
    long min2=0;
    long kaisuu=(long)(N/K);
      min1=N-K*kaisuu;
      min2=K*(kaisuu+1)-N;
      
      
      if(min1<=min2) System.out.println(min1);
      else System.out.println(min2);
      return;
  }
}

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

struct rect{
    int h, w, len;
};

int main(){
    int h, w;
    while(cin >> h >> w, h||w){
        struct rect ans;
        ans.h = ans.w = 150;
        ans.len = 150 * 150 + 150 * 150;
        range(i,1,150){ // i:width
            range(j,1,i){ //j:height
                if((h * h + w * w < j * j + i * i && j * j + i * i < ans.len) || (h * h + w * w < j * j + i * i && j * j + i * i == ans.len && j < ans.h) || (h * h + w * w == j * j + i * i && h < j && j < ans.h)){
                    if(i == w && j == h) continue;
                    ans.h = j;
                    ans.w = i;
                    ans.len = i * i + j * j;
                }
            }
        }
        cout << ans.h << ' ' << ans.w << endl;
    }
}

Measured memory_bytes: 1160
import math
def func(a):
    global ans
    b = bin(int(a))
    for i in range(len(b)-1,1,-1):
        if b[i] == '0':
            ans += 1
        else:
            break

    return int(a)

n = int(input())
ans = 0
alist = list(map(func,input().split()))
print(ans)



Measured memory_bytes: 42716
//Md Fahad
// CSE 18

#include<bits/stdc++.h>

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int dx[] = {+1,-1,+0,+0};                         // 4 X directions
const int dy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int dx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int dy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

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 trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;

int main(void)
{

    int a; cin >> a;
    set<int> aa;

    for(int i=0;i<a;i++){
        int x; cin >> x;
        aa.insert(x);
    }
    if(aa.size()==a)
        cout << "YES"<< endl;
    else
        cout << "NO" << endl;


    return 0;
}




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

using namespace std;

#define ll long long

int main() {
    vector<ll> vec[1005];
    vector<ll>::iterator it;
    int n, a, q, t;
    ll x;
    cin >> n >> q;
    while (q--) {
        cin >> a;
        if (a == 0) {
            cin >> t >> x;
            vec[t].push_back(x);
        } else if (a == 1) {
            cin >> t;
            if (vec[t].empty()) cout << endl;
            else {
                for (it = vec[t].begin(); it != vec[t].end(); it++) {
                    if (it == vec[t].begin()) cout << *it;
                    else cout << " " << *it;
                }
                cout << endl;
            }
        } else if (a == 2) {
            cin >> t;
            vec[t].clear();
        }
    }

    return 0;
}


Measured memory_bytes: 8824
#include <stdio.h>

int main(){
	int n;
	scanf("%d" ,&n);
	if(n % 1000 == 0){
		printf("0\n");
	}
	else if(n < 1000){
		printf("%d" ,1000 - n);
	}
	else if(1000 < n && n < 2000){
		printf("%d" ,2000 - n);
	}
	else if(2000 < n && n < 3000){
		printf("%d" ,3000 - n);
	}
	else if(3000 < n && n < 4000){
		printf("%d" ,4000 - n);
	}
	else if(4000 < n && n < 5000){
		printf("%d" ,5000 - n);
	}
	else if(5000 < n && n < 6000){
		printf("%d" ,6000 - n);
	}
	else if(6000 < n && n < 7000){
		printf("%d" ,7000 - n);
	}
	else if(7000 < n && n < 8000){
		printf("%d" ,8000 - n);
	}
	else if(8000 < n && n < 9000){
		printf("%d" ,9000 - n);
	}
	else if(9000 < n && n < 10000){
		printf("%d" ,10000 - n);
	}
	return 0;
}

Measured memory_bytes: 1728
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		char[] ar = in.next().toCharArray();
		Arrays.sort(ar);
		if (ar[0]==ar[1] && ar[2]==ar[3] && ar[1]!=ar[2]) out.println("Yes");
		else out.println("No");
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 23636
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <map>

int main()
{
    int a{}, b{};
    std::cin >> a >> b;

    int xa = a * 25 / 2;
    int xa1 = xa;
    int xa2 = xa;
    while ((xa1 - 1) * 2 / 25 == a) xa1--;
    while ((xa2 + 1) * 2 / 25 == a) xa2++;
    if (xa1 * 2 / 25 != a) xa1++;
    if (xa2 * 2 / 25 != a) xa2--;
    const int xb = b * 10;
    int xb1 = xb;
    int xb2 = xb;
    while ((xb1 - 1) / 10 == b) xb1--;
    while ((xb2 + 1) / 10 == b) xb2++;

    int result = -1;
    for (int i = xb1; i <= xb2; i++) {
        for (int j = xa1; j <= xa2; j++) {
            if (i == j) {
                result = i;
                break;
            }
        }
        if (result >= 0) break;
    }
    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc097c()
}

fun abc097c() {
    val s = readLine()!!
    val k = readLine()!!.toInt()

    val set = mutableSetOf<String>()
    for (i in 0 until s.length) {
        var count = 0
        for (j in i until s.length) {
            if (count >= k) break
            set.add(s.slice(i..j))
            count++
        }
    }

    println(set.sorted()[k - 1])
}


Measured memory_bytes: 42948
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wnqmw
 */
public class Main {
    public static void main(String args[]){
        Scanner kb = new Scanner(System.in);
        
        int x = kb.nextInt(), y = kb.nextInt(), z = kb.nextInt();
        int temp = y;
        y = x;
        x = temp;
        
        temp = z;
        z = x;
        x = temp;
        System.out.println(x + " " + y + " " + z);
    }
}


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

int main(){
  string S;
  cin >> S;
  long long s=S.size();
  long long count=0;
  long long ans=0;
  for(int i=0;i<s;i++){
    if(S[i]=='W'){ans+=i-count; count++;}
  }
  cout << ans << endl;
}

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

int main() {
    // C: A のカウンティング配列
    // D[x] := C の中に x 以上が何個あるか
    // S: D の累積和
    // S2[x] = S[x] / x
    int N; cin >> N;
    vector<long long> C(N, 0);
    vector<long long> D(N+1, 0);
    for (int i = 0; i < N; ++i) {
        int a; cin >> a; --a;
        C[a]++;
        D[C[a]]++;
    }
    vector<long long> S(N+1, 0), S2(N+1, 0);
    for (int i = 1; i < N+1; ++i) S[i] = S[i-1] + D[i], S2[i] = S[i] / i;

    long long iter = N;
    for (long long K = 1; K <= N; ++K) {
        while (iter > 0 && K > S2[iter]) --iter;
        cout << iter << endl;
    }
}


Measured memory_bytes: 10240
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    map<string, int> m;
    rep(i,n) {
        string s; cin >> s;
        m[s]++;
    }
    printf("AC x %d\n", m["AC"]);
    printf("WA x %d\n", m["WA"]);
    printf("TLE x %d\n", m["TLE"]);
    printf("RE x %d\n", m["RE"]);
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}


int main(){
    fast();
    ll n, M;
    cin >> n >> M;
    map <ll, vector <string>> m;
    for(int i=0; i<M; i++){
        ll x;
        string y;
        cin >> x >> y;
        m[x].pb(y);
    }
    ll a = 0;
    ll b = 0;
    for(auto i:m){
        ll x = 0;
        bool check = 0;
        for(auto j:i.ss){
            if(j=="AC"){
                check = 1;
                break;
            }
            x++;
        }
        if(check){
            a++;
            b+=x;
        }
    }
    outs(a, b);
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
 
 string S;
 
 int main(){ 

  cin >> S;
   
  if (S == "xxx") cout << "700" << endl;

  else if (S == "oxx" || S == "xox" || S == "xxo" ) cout << "800" << endl;
  else if (S == "oox" || S == "xoo" || S == "oxo" ) cout << "900" << endl;
  else if (S == "ooo") cout << "1000" << endl;


 return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*16
#define REP(i,n) for(long long i = 0;i < n;++i)
vector<int> road[4];
int main() {
	REP(i, 3) {
		int a, b;
		cin >> a >> b;
		road[a].push_back(b);
		road[b].push_back(a);
	}
	int cnt[5] = {};
	for (int i = 1; i <= 4; ++i) {
		cnt[road[i].size()]++;
	}
	if (cnt[1] == 2 && cnt[2] == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int i = 0, j = s.size() -1, ans = 0;
  while (i < j) {
    if (s[i] != s[j]) ans++;
    i++, j--;
  }
  cout << ans << endl;
  return 0;
}

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

#define sc1(a)  scanf("%d",&a)

int main(){
    int n,ans=0,chk;
    sc1(n);
    for (int i=1;i<=n;i++) {
        chk=0;
        for (int j=1;j<=i;j++) {
            if (i%j==0) chk++;
        }
        i++;
        if (chk==8) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1000000009;

void solve() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    
    ll ans = a[n - 1];
    for (int i = 2; i < n; i += 2) {
        ans += a[n - i / 2 - 1];
        if (n - i > 1) {
            ans += a[n - i / 2 - 1];
        }
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int t = 1;
    //cin >> t;
    for (int qq = 0; qq < t; ++qq) {
       solve();
    }
   
    return 0;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; i++)
        cin >> L[i];

    sort(L.begin(), L.end());

    int ans = 0;
    for (int i = 0; i < N - 2; i++)
    {
        int a = L[i];
        for (int j = i + 1; j < N - 1; j++)
        {
            int b = L[j];
            auto end = lower_bound(L.begin(), L.end(), a + b);
            //cout << *end << endl;
            for (auto iter = L.begin() + j + 1; iter != end; iter++)
            {
                int c = *iter;
                if (a < b + c &&
                    b < c + a &&
                    c < a + b)
                {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
  static void Main(string[] args)
  {
    uint[] items = Array.ConvertAll(Console.ReadLine().Split(' '), uint.Parse);
    uint N = items[0];
    uint X = items[1];
    uint T = items[2];

    uint NpXCeil = N / X + (N % X != 0 ? 1u : 0u);

    Console.WriteLine(NpXCeil * T);
    return;
  }
}


Measured memory_bytes: 27592
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int n,m,i,p;
  char s[3];
  bool AC[100010]={};
  int WA[100010]={};
  int score=0,pe=0;

  cin>>n>>m;
  for(i=0;i<m;i++){
    cin>>p>>s;
    p--;
    if(s[0]=='A'){
      if(!AC[p]){
        score++;
        AC[p]=1;
        pe+=WA[p];
      }
    }
    else{
      WA[p]++;
    }
  }

  cout<<score<<" "<<pe<<endl;
  
  return 0;
}

Measured memory_bytes: 768
// panasonic2020_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll H, W;
    cin >> H >> W;

    if (H == 1 || W == 1){
        print(1);
        return 0;
    }
    
    ll ans = H * (W/2);
    if (W % 2 == 1){
        ans += (H + 1) / 2;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

const long long mod = 1e9 + 7;
using ll = long long;
using namespace std;

ll powMod(ll base, ll expo) {
  ll res = 1;
  while (expo) {
    if (expo & 1) {
      res = res * base % mod;
    }
    base = base * base % mod;
    expo = expo >> 1;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll ans = ((powMod(10, n) - 2 * powMod(9, n) % mod) + powMod(8, n)) % mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

char S[10] = {};
bool yymm = false, mmyy = false;

int main() {
	cin >> S;
	if ((S[0] - '0') * 10 + S[1] - '0' < 100 && (S[2] - '0') * 10 + S[3] - '0' <= 12 && (S[2] - '0') * 10 + S[3] - '0'>0)yymm = true;
	if ((S[2] - '0') * 10 + S[3] - '0' < 100 && (S[0] - '0') * 10 + S[1] - '0' <= 12 && (S[0] - '0') * 10 + S[1] - '0'>0)mmyy = true;
	if (yymm) {
		if (mmyy) {
			cout << "AMBIGUOUS" << endl;
		}
		else {
			cout << "YYMM" << endl;
		}
	}
	else {
		if (mmyy) {
			cout << "MMYY" << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
K = int(input())
INF = 10**18

a = [INF] * (K+1)
a[0] = 0

for n in range(1, K+1):
    a[n] = (10 * a[n-1] + 7) % K
    if a[n] == 0:
        print(n)
        break
else:
    print(-1)


Measured memory_bytes: 71476
S = list(input())

def bit_search(s):
    # print('s:',s,'len:',len(s))
    if len(s)==1:
        # print('len=1,s:',s,len(s), int(s[0]))
        return int(s[0]),1 # 第二返り値は場合の数
    else:
        # print('s[0],type:',s[0],type(s[0]))
        sum1, cases1 = bit_search(s[1:])
        tmp1 = int(s[0])*cases1+sum1
        tmp = [s[0]+s[1]]+s[2:]
        # print('tmp:',tmp)
        tmp2, cases2 = bit_search(tmp)
        return tmp1+tmp2, cases1+cases2

# print('initial S',S)
print(bit_search(S)[0])

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  if(N<600) printf("8\n");
  else if(N<800) printf("7\n");
  else if(N<1000) printf("6\n");
  else if(N<1200) printf("5\n");
  else if(N<1400) printf("4\n");
  else if(N<1600) printf("3\n");
  else if(N<1800) printf("2\n");
  else if(N<2000) printf("1\n");
  return 0;
}

Measured memory_bytes: 1660
N = input()
K = int(input())
L = len(N)

dp =[[[ 0 for _ in range(2)] for _ in range(5)] for _ in range(len(N)+1)]
# dp[i][j][flg] i+1桁目までで0以外の個数がj個
# flg = 1 -> N 以下が確定している

dp[0][1][1] = int(N[0])-1
dp[0][1][0] = 1

for i in range(1,L):
  for j in range(4):
    b = i-1 # hitotumae
    now = int(N[i])
    ## N上限に張り付いてる方
    if now == 0:
      dp[i][j][0] += dp[b][j][0]
    else:
      dp[i][j][1] += dp[b][j][0]
      dp[i][j+1][1] += dp[b][j][0] * (now-1)
      dp[i][j+1][0] += dp[b][j][0]
    ## 張り付いてない方
    dp[i][j][1] += dp[b][j][1]
    dp[i][j+1][1] += dp[b][j][1] * 9
  dp[i][1][1] += 9 # i桁目から始まった物（それより上がZEROのもの。）

print(dp[L-1][K][0] + dp[L-1][K][1])

Measured memory_bytes: 9068
def insertionSort(A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j += -1
        A[j+1] = v
        print(" ".join(map(str, A)))

n = int(input())
A = list(map(int, input().split()))
insertionSort(A, n)



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

using namespace std;

typedef long long int ll;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

vector < ll > fact(N);

ll pwr(ll a, ll b){
  ll res = 1;
  while(b > 0){
    if(b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

ll inv(ll a){
  return pwr(a, mod - 2);
}

ll comb(int n, int r){
  return (((fact[n] * inv(fact[n - r]) % mod) * inv(fact[r])) % mod);
}

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

  fact[0] = 1;
  for(int i = 1; i < N; i++) fact[i] = (i * fact[i - 1]) % mod;

  int n, m;
  cin >> n >> m;

  ll ans = 1;
  for(int i = 2; i <= sqrt(m); i++){
    if(m % i == 0){
      int cnt = 0;
      while(m % i == 0){
        cnt++;
        m /= i;
      }
      ans = (ans * comb(n + cnt - 1, n - 1)) % mod;
    }
  }
  if(m > 1){
    ans = (ans * n) % mod;
  }

  cout << ans << '\n';
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define fi first
#define se second
#define db double
#define ld long db
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}

const int p=1e9+7,N=2e5+5,inv2=500000004;
int n,sz[N],pw[N],sum[N],num[N];
vector<int>g[N];
inline int ksm(ri x,ri y){ri z=1;while(y)(y&1)?z=(ll)z*x%p:0,x=(ll)x*x%p,y>>=1;return z;}
inline int sub2(ri x,ri y){x-=y;return x<0?x+p:x;}
inline void add(ri &x,ri y){x+=y;x>=p?x-=p:0;}
inline void dfs(ri u,ri fa){
	sz[u]=1;
	for(ri v:g[u])if(v!=fa)dfs(v,u),sz[u]+=sz[v],++num[u];
	if(num[u]>1)for(ri v:g[u])if(v!=fa)add(sum[u],(ll)sub2(1,pw[sz[v]])*pw[sz[u]-1-sz[v]]%p);
}

int main()
{
	n=read();rep(i,1,n-1){ri u=read(),v=read();g[u].pb(v);g[v].pb(u);}
	pw[0]=1;rep(i,1,n)pw[i]=(ll)pw[i-1]*inv2%p;
	dfs(1,0);ri ans=0,cur;
	rep(u,1,n){
		if(num[u]<=1){
			if(sz[u]-1&&n-sz[u])add(ans,(ll)sub2(1,pw[sz[u]-1])*inv2%p*sub2(1,pw[n-sz[u]])%p);
			continue;
		}
		cur=sub2(sub2(1,pw[sz[u]-1]),sum[u]);
		if(sz[u]-1&&n-sz[u])add(ans,(ll)sum[u]*inv2%p*sub2(1,pw[n-sz[u]])%p);
		add(ans,(ll)cur*inv2%p);
	}	
	printf("%d\n",ans);
	return 0; 
}

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

fact = [True] * 55556

fact[0],fact[1] = False, False

ans = []
cnt = 0
for i in range(2, len(fact)):
  if fact[i]:
    if i % 5 == 1:
      ans.append(i)
      cnt += 1
      if cnt == N:
        break
    for j in range(i * 2, len(fact), i):
      fact[j] = False

print(*ans)

Measured memory_bytes: 9308
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        n -= a;
    }
    if (n < 0) n = -1;
    cout << n << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    vector<int> v(N);
    rep(i, N){
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    double ans = v[0];
    for(int i = 1; i < N; i++){
        ans = (ans + v[i]) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;


ll dp[110][10100]; //ある価値に対する最小の重さ
//dp[i][j] := i番目までの品物で価値がjとなるときの最小の重さ
ll v[110], w[110];
int N, W;
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    cin >> N >> W;
    REP(i, N) cin >> v[i] >> w[i];
    int maxVal=0;
    for(int i=0; i<N; ++i) maxVal+=v[i];
    for(int i=0; i<110; ++i) for(int j=0; j<10100; ++j) dp[i][j]=1e9;
    dp[0][0]=0;
    for(int i=0; i<N; ++i){
        for(int j=0; j<=maxVal; ++j){
            if(j-v[i]>=0) dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i]);
            else dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
    }
    
    int ans=0;
    for(int i=0; i<=maxVal; ++i){
        if(dp[N][i]<=W){
            ans = max(ans, i);
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11900
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <cctype>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

int main(){
    int n;
    cin >> n;
    if(n>=15) cout << 800*n-(n/15)*200 << endl;
    else cout << 800*n << endl;
}


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

using namespace std;

const int cons = 1e5 + 5;
vector<int> graph[cons];
int indegree[cons]; 
int dist[cons];
bool visited[cons];

void dfs(int a) {

    assert(!visited[a]);
    visited[a] = true;

    for(int b : graph[a]) {

        dist[b] = max(dist[b], dist[a] + 1);
        --indegree[b];
        if(indegree[b] == 0) {

            dfs(b);
        }
    }
}

int main() {

    int n, m;
    cin >> n >> m;

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

        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        ++indegree[b];
    }

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

        if(!visited[i] && indegree[i] == 0) {

            dfs(i);
        }
    }

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

        answer = max(answer, dist[i]);
    }

    cout << answer;
    return 0;
}

Measured memory_bytes: 9728
#include"bits/stdc++.h"
 

// NOTE TO SELF // try to simplyfy the problem
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define sz(n) (int)n.size()

#define ll long long int
using namespace std;



int main()
{
    int n,k;
    cin>>n>>k;
    
    vector<int> h(n);
    
    for(auto &it:h)
        cin>>it;
    
    const int INF=1e9+5;
    
    vector<int> dp(n,INF);
    
    dp[0]=0;
    
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<i+1+k;j++)
        {
            if(j<n)
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            
            
            
        }
        
        
    }
    
    cout<<dp[n-1]<<endl;
    
    
}


Measured memory_bytes: 3988
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
typedef pair<int,int> P;

int main(){
    int N;
    cin>>N;
    string str;
    cin>>str;
    int white[200001];
    int black[200001];
    int whiteNum=0;
    int blackNum=0;
    white[0]=black[0]=0;
    for(int i=0;i<N;i++){
        if(str[i]=='.'){
            white[i+1]=white[i]+1;
            black[i+1]=black[i];
            whiteNum++;
        }else{
            white[i+1]=white[i];
            black[i+1]=black[i]+1;
            blackNum++;
        }
    }
    int ans = 99999999;
    for(int i=0;i<=N;i++){
        int tmp = black[i] + (whiteNum - white[i]);
        ans = min(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)

int M, N;
string f[1010], p[2], JOI = "JOI";

bool isok(int y, int x) {
	if (y < 0 || x < 0 || y > M - 1 || x > N - 1) return 0;
	for_(i,0,2) for_(j,0,2) if (f[y+i][x+j] != p[i][j]) return 0;
	return 1;
}

int center(int y, int x) {
	int res = 0;
	for_(i,-1,1) for_(j,-1,1) if (isok(y+i,x+j)) ++res;
	return res;
}

int main() {
	cin >> M >> N;
	for_(i,0,M) cin >> f[i];
	for_(i,0,2) cin >> p[i];
	
	int ini = 0;
	for_(y,0,M) for_(x,0,N) if (isok(y,x)) ++ini;
	
	int ans = 0;	
	for_(y,0,M) for_(x,0,N) {
		int cur = center(y,x), nx = 0;
		char ff = f[y][x];
		
		for_(i,0,3) {
			f[y][x] = JOI[i];
			nx = max(nx, center(y,x));
		}
		
		f[y][x] = ff;
		ans = max(ans, ini + nx - cur);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2264