akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        char[][] array = new char[h][];
        long ans = 0;
        for (int i = 0; i < h; i++) {
            array[i] = sc.next().toCharArray();
        }
        int hMax = (int)Math.pow(2, w);
        int wMax = (int)Math.pow(2, h);

        for (int i = 0; i < hMax; i++) {
            int hi = i;
            boolean[][] searched = new boolean[h][w];
            while (Integer.bitCount(hi) > 0) {
                int ht = Integer.lowestOneBit(hi);
                hi -= ht;
                ht = (int)(Math.log(ht) / Math.log(2));
                for (int j = 0; j < h; j++) {
                    searched[j][ht] = true;
                }
            }
            for (int j = 0; j < wMax; j++) {
                int wi = j;
                boolean[][] searchedCopy =  new boolean[h][w];
                for (int l = 0; l < h; l++) {
                    System.arraycopy(searched[l], 0, searchedCopy[l], 0, w);
                }
                while (Integer.bitCount(wi) > 0) {
                    int wt = Integer.lowestOneBit(wi);
                    wi -= wt;
                    wt = (int)(Math.log(wt) / Math.log(2));
                    Arrays.fill(searchedCopy[wt], true);
                }
                int count = 0;
                for (int o = 0; o < h; o++) {
                    for (int l = 0; l < w; l++) {
                        if (!searchedCopy[o][l] && array[o][l] == '#') {
                            count++;
                        }
                    }
                }
                if (count == k) {
                    ans++;
                }
            }
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 38744
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <queue>

using namespace std;

using ll = long long;

ll N, X, Y;
ll cnt[10000];

int main()
{
    cin >> N >> X >> Y;
    X--;
    Y--;
    for(int i = 0;i < N;i++)
    {
        for(int j = i+1;j < N;j++)
        {
            ll d = j-i;
            d = min(d, abs(X-i)+1+abs(Y-j));
            d = min(d, abs(Y-i)+1+abs(X-j));
            cnt[d]++;
        }
    }
    for(int i = 1;i <= N-1;i++)
    {
        cout << cnt[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 888
import math
N,C,K = list(map(int,input().split()))
T = sorted([int(input()) for _ in range(N)])
ans = 1
count = 0
first = T[0]
for t in T:
    if t <= first+K and count < C:
        count += 1
    else:
        count = 1
        ans += 1
        first = t
print(ans)

Measured memory_bytes: 8276
#[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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        b: String,
    }
    let ans = match &*b {
        "A" => "T",
        "T" => "A",
        "G" => "C",
        "C" => "G",
        _ => panic!("hoge"),
    };
    println!("{}", ans);
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  ll W = nextInt();
  ll H = nextInt();
  ll x = nextInt();
  ll y = nextInt();
  int ans = (W == x*2 && H == y*2);
  cout << (H*W)/2.0 << " " << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(void) {
	int num, a, b, i, k = 0, sum = 0;
	long long H, W, ss;
	cin >> H >> W >> num;
	ss = (H - 2) * (W - 2);
	vector<pair<int, int>> list(9 * num);
	vector<int> ans(10, 0);
	map<pair<int, int>, int> mp;
	pair<int, int> p;
	for (i = 0; i < num; i++) {
		scanf("%d%d", &a, &b);
		for (int j = -1; j < 2; j++) {
			for (int l = -1; l < 2; l++) {
				p = make_pair(a + j, b + l);
				if (mp[p] == 0)
					list[k++] = p;
				mp[p]++;
			}
		}
	}
	for (i = 0; i < 9 * num; i++) {
		if (list[i].first > 1 && list[i].first < H && list[i].second > 1 && list[i].second < W) {
			ans[mp[list[i]]]++;
			sum++;
		}
	}
	cout << ss - sum << "\n";
	for (i = 1; i < 10; i++)
		cout << ans[i] << "\n";
	return 0;
}

Measured memory_bytes: 63488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		long n =scn.nextLong();
		long k=scn.nextLong();
		if(n%k==0){
			System.out.println(0);
			return ;
		}
		n = n%k;
		long res= Math.min(n, Math.abs(n-k));
		System.out.println(res);

	}

}

Measured memory_bytes: 23252
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
sum = 0
sum_1 = 0

for i in range(N):
    sum += A[i]%mod
sum = (sum**2)%mod

for j in range(N):
    sum_1 += (A[j]**2)%mod
sum2=sum-sum_1
if sum2<0:
    sum2+=mod
ans=(sum2*500000004)%mod
print(int(ans))


Measured memory_bytes: 31004
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn main() {
    input! {
        a: usize,
        b: Chars
    };

    let b: usize = b
        .into_iter()
        .filter(|&ch| ch != '.')
        .join("")
        .parse()
        .unwrap();
    let res = a * b / 100;
    println!("{}", res);
}


Measured memory_bytes: 2188
import sys
import math
 
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
 
    print(4 + math.ceil(N / min(A, B, C, D, E)))
 
main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// Not gonna give up until it's over
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 1e4 + 10;
const ll MAXD = 101;
ll dp[MAXN][MAXD][2];
ll a[MAXN];
const ll MOD = 1e9 + 7;
ll X,n;

ll rec(ll idx,ll val,ll tight){
    if(idx > n) {
        if(val == 0) return 1;
        else return 0;
    }

    ll &ans = dp[idx][val][tight];

    if(ans != -1) return ans;

    ans = 0;
    ll high = 9;
    if(tight) high = a[idx];

    FOR(i,0,high){
        ll n_t = tight; 
        if(i != high) n_t = 0;

        ans = (ans + rec(idx+1,(val + i)%X,n_t))%MOD;
    }

    return ans;
}

void solve(){
    string s; cin>>s;

    FOR(i,0,s.length()-1) a[i+1] = s[i]-'0';
    n = s.length(); cin>>X;

    MINUS(dp);

    cout<<(rec(1,0,1) - 1 + MOD)%MOD<<endl;
}

signed main(){
 
   FastRead;    
 

    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 17024
use proconio::{input, fastout};

fn f(n: u64) -> usize {
    let mut cnt = 0;
    let m = (n as f64).sqrt() as u64;
    for x in 1..m {
        for y in x..m {
            for z in y..m {
                if x*x + y*y + z*z + x*y + y*z + z*x == n {
                    if x == y && y == z {
                        cnt += 1;
                    } else if x != y && y != z && x != z {
                        cnt += 6;
                    } else {
                        cnt += 3;
                    }
                }
            }
        }
    }
    cnt
}

#[fastout]
fn main() {
    input! {
        n: u64
    }
    for i in 1..=n {
        println!("{}", f(i));
    }
}


Measured memory_bytes: 2116
#XXOR
n,k=map(int,input().split())
a=list(map(int,input().split()))

#それぞれの桁の１の数を数えていく。
flag=[0]*(40)
for u in a:
    for j in range(40):
        if (u>>j)&1==1:
            flag[j]+=1
            
#mはxの最大値。Mはそれによる得られる値。l、Lも同じ。
m=0
M=0
l=0
L=0
for i in range(40):
    if (k>>i)&1==1:
        if n>2*flag[i]:
            if M>L+(2**i)*(n-2*flag[i]):
                L=M
                l=m
            else:
                L+=(2**i)*(n-2*flag[i])
                l+=2**i
        else:
            L=m
            l=m
    if n>2*flag[i]:
        M+=(2**i)*(n-2*flag[i])
        m+=2**i

ans=0
for u in a:
    ans+=(u^l)

print(ans)

Measured memory_bytes: 15144
#include <iostream>

int main(){
    int n;
    std::cin >> n;
    int d[n];
    int sum=0;
    
    for(int i=0;i<n;++i){
        std::cin >> d[i];
    }
    
    for(int i=0;i<n-1;++i){
        for(int j=i+1;j<n;++j){
            sum+=d[i]*d[j];
        }
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <random>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cerr << C << endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a : b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N, K;
VI a;
VII edge;
int ans = 0;

int dfs(int id) {
    //DEBUG(id)
    int res = 0;
    FORE(el, edge[id]) {
        res = max(res, dfs(el) + 1);
    }
    if (a[id] != 0 && res >= K - 1) {
        a[id] = 0;
        ans++;
        res = -1;
    }
    return res;
}

int main(void) {
    cin >> N >> K;
    a.resize(N);
    REP(i, N) {
        scanf("%d", &a[i]);
        a[i]--;
    }
    if (a[0] != 0) {
        a[0] = 0;
        ans++;
    }
    edge.resize(N);
    FOR(i, 1, N) {
        edge[a[i]].EB(i);
    }
    dfs(0);
    cout << ans << endl;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >>e;
    vector<int>nums;
    nums.push_back(a);
    nums.push_back(b);
    nums.push_back(c);
    nums.push_back(d);
    nums.push_back(e);
    vector<int> vec = {0};
    for(int i=0; i<5; i++){
        if(10-(nums[i]%10)!= 10){
            vec.push_back(10-(nums[i]%10));
        }
    }
    sort(vec.begin(),vec.end());
    int count = 0;
    for(int i=0; i<vec.size()-1; i++){
        count+=vec[i];
    }
    int ans = a+b+c+d+e;
    cout << ans+count <<endl;

}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 9999999999;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<pll> v;
	for(int i = 1;i<=n;i++)
	{
		ll a,b;
		cin >>a>>b;
		v.pb(mp(b,a));
	}
	sort(all(v));

	ll cur = 0;
	for(int i = 0;i<v.size();i++)
	{
		cur+=v[i].s;
		if(cur>v[i].f )return cout << "No\n",0;
	}
	cout << "Yes\n";



	return 0;
}



Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        int x=i,num=0;
        while(x){
            x/=10;
            num++;
        }
        if(num%2==1) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集
 
const int MAX = 2000010;
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int N, M;
map<int, int> mp;
bool used[100010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> N >> M;

  int ac = 0, pena = 0;
  REP(i,M){

    int p;
    string s;
    cin >> p >> s;
    if(!used[p] && s == "AC"){
      pena += mp[p];
      ac++;
      used[p] = true;
    }else{
      mp[p]++;
    }
  }

  cout << ac << " " << pena << endl;
  return 0;
}

Measured memory_bytes: 8276
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		
		int w = sc.nextInt();
		
		for(int i = 0; i < input.length(); i+=w){
			System.out.print(input.charAt(i));
		}
		System.out.println();
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<' '<<x<<' '<<y<<endl;
}

Measured memory_bytes: 768
#include<cstdio>
using namespace std;
typedef long long ll;
ll p;
const int sz=3e3;
ll A[sz],B[sz][sz];
ll power(ll a,ll b){return b?power(a*a%p,b/2)*(b%2?a:1)%p:1;}
main()
{
    scanf("%lld",&p);
    for(int i=0;i<p;i++)scanf("%lld",A+i);
    B[0][0]=1;
    B[p-1][0]=p-1;
    for(int i=1;i<p;i++)
    {
        B[p-1][i]=p-1;
        for(int j=p-2;j>0;j--)B[j][i]=B[j+1][i]*i%p;
    }
    for(int i=0;i<p;i++)
    {
        ll now=0;
        for(int j=0;j<p;j++)(now+=B[i][j]*A[j])%=p;
        printf("%lld ",now);
    }
    puts("");
    return 0;
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec A(N); cin >> A;
    Sort(A);
    bool ans = true;
    REP(i, N - 1) if(A[i] == A[i + 1]) ans = false;
    Ans(ans, "YES", "NO");

    return 0;
}


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

    long long gcd(long long a, long long b){
        int c;
        if (a < b) {
            a+=b; b=a-b; a-=b;
        }

        while (b != 0) {
            c = a % b;
            a = b;
            b = c;
        }
        return a;
    }

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

   	long long g = gcd(a[0],a[1]);

   	for(long long i=2;i<n;i++){
   		g = gcd(g,a[i]);
   	}
   	ans = g;
   int cnt=0;
   	cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

char c[] = {'S','W'};
int v0[] = {0,0,1,1};
int v1[] = {0,1,0,1};
int main() {
  int n; string s;
  cin >> n >> s;
  vector<int> v;
  auto f = [&](int v0,int v1){
    v = vector<int>(n+1);
    v[0]=v0,v[1]=v1;
    rep(i,n-1){
      if(v[i+1]==0&&s[i+1]=='o') v[i+2] = v[i];
      if(v[i+1]==1&&s[i+1]=='x') v[i+2] = v[i];
      if(v[i+1]==0&&s[i+1]=='x') v[i+2] = (v[i]^1);
      if(v[i+1]==1&&s[i+1]=='o') v[i+2] = (v[i]^1);
    }
    if(v[0]!=v[n]) return false;
    if(v[0]==0&&s[0]=='o') return v[n-1] == v[1];
    if(v[0]==1&&s[0]=='x') return v[n-1] == v[1];
    if(v[0]==0&&s[0]=='x') return v[n-1] == (v[1]^1);
    if(v[0]==1&&s[0]=='o') return v[n-1] == (v[1]^1);
    return false;
  };
  rep(i,4){
    if(f(v0[i],v1[i])){
      rep(i,n) cout << c[v[i]]; cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

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

#define lint long long

int main(){
    int N, M, X;
    cin >> N >> M >> X;
    
    int cnt = 0;
    
    while(true){
        int a;
        cin >> a;
        if(a < X){
            ++cnt;
        } else {
            break;
        }
    }
    
    cout << min(cnt, M - cnt) << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize(3)
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>

typedef long long LL;
using namespace std;

#define MAXN 100005
LL dp[2][MAXN];
int nums[MAXN];

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	int groups;
	//scanf("%d", &groups);
	groups = 1;
	for (int i = 0; i < groups; i++) {
		int n;
		scanf("%d", &n);
		for (int j = 0; j < n; j++) {
			scanf("%d", &nums[j]);
		}
		dp[0][1] = nums[0] + nums[1];//不做
		dp[1][1] = -dp[0][1];
		for (int j = 2; j < n; j++) {
			dp[0][j] = max(dp[0][j - 1] + nums[j], dp[1][j - 1] + nums[j]);
			dp[1][j] = max(dp[0][j - 1] - nums[j] - 2 * nums[j - 1], dp[1][j - 1] - nums[j] + 2 * nums[j - 1]);
		}
		printf("%lld", max(dp[0][n - 1], dp[1][n - 1]));
	}
	return 0;
}

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

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

	ll r_num = 0, g_num=0, b_num=0;
	for(int i=0; i<N; i++){
		if(S[i]=='R')		r_num++;
		else if(S[i]=='G')  g_num++;
		else if(S[i]=='B')  b_num++;
	}

	ll rule1 = r_num * g_num * b_num;//条件１を満たす個数
	// ll rule1 = 1;
	// rule1 *= r_num;
	// rule1 *= g_num;
	// rule1 *= b_num;
	ll rule1_not2 = 0;//条件1を満たすが条件2を満たさない個数
	ll ans = 0; // ans = rule1 - rule1_not2;
	for(int i=0; i<N; i++){
		for(int j=i; j<N; j++){
			int k = 2*j - i;
			if(k < 0 || N <= k) continue;
			if(S[i] != S[j] && S[i] != S[k] && S[j] != S[k]){
				//cout << " i:" << i << " j: " << j << " k: " << k << endl;
				rule1_not2++;
			}
		}
	}
	
	//cout << " rule1: " << rule1 << " rule1_not2: " << rule1_not2 << endl;
	ans = rule1 - rule1_not2;
	std::cout << ans << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD           1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl "\n"
#define PI 3.14159265358979323846264338327950L
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int fc[100001], in[100001];
/*int pwmd(int a, int n)
{
	if (!n)
		return 1;
	int pt = pwmd(a, n / 2);
	pt *= pt, pt %= mod;
	if (n & 1)
		pt *= a, pt %= mod;
	return pt;
}*/

/*void dfs(int i,int par)
{
	for(int x:adj[i])
	{
		if(x!=par)
		{
			dfs(x,i);
		    sub[i]+=sub[x];
		}
	}
}*/
int pow(int a, int b, int m)
{
	int ans = 1;
	while (b > 0)
	{
		if (b % 2 == 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans % m;
}
/*vector<int> sq(5002);
void pre()
{
	for (int i = 0; i <= 5000; ++i)
		sq.pb(i * i);
}*/

bool compare(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b)
{
	if (a.ss.ff != b.ss.ff)
		return (a.ss.ff > b.ss.ff);
	else
		return (a.ff < b.ff);
}
bool comp(string a, string b)
{
	if (a.size() == b.size())
		return a < b;
	return a.size() < b.size();
}
int32_t main()
{
	FIO;
	char c;
	cin >> c;

	if (c >= 'a' && c <= 'z')
		cout << "a" << endl;
	else
		cout << "A" << endl;

}


Measured memory_bytes: 3644
h = [[[0]*10 for i in range(3)] for j in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    h[b-1][f-1][r-1] += v

s = ""
for i in range(4):
    for j in range(3):
        for k in range(10):
            s += " " + str(h[i][j][k])
        s += "\n"
    if i < 3:
        s += "####################\n"

print(s,end="")

Measured memory_bytes: 7684
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

int main() {
	int n; cin >> n;
	vector<char>s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	int count = 0;
	int tmp = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'I') {
			count++;
			if (tmp < count) {
				tmp = count;
			}
		}
		else {
			count--;
		}
	}
	cout << tmp << endl;
}




    

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

void dfs(int now, int prev, vector<int>& dists, vector<vector<int>>& adj){
  for(auto next: adj[now]){
    if(next != prev){
      dists[next] = dists[now] + 1;
      dfs(next, now, dists, adj);
    }
  }
}

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

  vector<vector<int>> adj(N);
  for(int i = 0; i < N - 1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }

  vector<int> dist_from_head(N), dist_from_last(N);
  dfs(0, -1, dist_from_head, adj);
  dfs(N - 1, -1, dist_from_last, adj);
  int black_near = 0;
  for(int i = 0; i < N; i++){
    if(dist_from_head[i] <= dist_from_last[i]){
      black_near++;
    }
  }
  if(2 * black_near <= N){
    cout << "Snuke" << endl;
  }else{
    cout << "Fennec" << endl;
  }
}


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

int main() {
	long long int m,i,j,k,n,sum=0,flag=0;
	string s,t,temp;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)
	{
	    cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n-1;i++)
	{
	    if(a[i]==a[i+1])
	    {
	        cout<<"NO"<<endl;
	        return 0;
	    }
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func main() {
	var k, a, b int
	fmt.Scan(&k)
	fmt.Scanf("%d %d", &a, &b)

	ok := false
	for i := a; i <= b; i++ {
		if i%k == 0 {
			ok = true
			break
		}
	}

	if ok {
		fmt.Print("OK")
	} else {
		fmt.Print("NG")
	}
}


Measured memory_bytes: 1820
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAX 1000

int main() {
    char ch[MAX];
    
    while (1) {
        std::cin >> ch;
        if (ch[0] == '0') break;
        int sum = 0;
        for (int i = 0; i < strlen(ch); i++) {
            sum += ch[i] - '0';
        }
        printf("%d\n", sum);
    }
    
    return 0;
}

Measured memory_bytes: 3200
import java.util.Scanner;

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


Measured memory_bytes: 38704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
const double EPS=1e-9;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define t() ll t;cin>>t;while(t--) 

int main()
{ 
    fastio;
    ll i,n,j,k;
    cin>>n>>k;
    vector<ll>a(n),dp(n,INT_MAX);
    for(i=0;i<n;i++) cin>>a[i];
    dp[0]=0;
    for(i=1;i<n;i++)
    {
        for(j=min(i,k);j>0;j--)
            dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
    }
    cout<<dp[n-1];
    
    
    
       
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
 	int a,b,x=0; scanf("%d%d",&a,&b);
	for(int i=0;i<2;i++){
		if(a>b)
		{
			x+=a;a--;
		}else
		{
			x+=b;b--;
		}
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void){
	int W, H, x, y, r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if((0<=(x-r))&&((x+r)<=W)&&(0<=(y-r))&&((y+r)<=H)){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {

	public static void main(String[] args) {
		final FastScanner sc = new FastScanner(System.in);
		int k = sc.nextInt();
		if (k <= 9) {
			System.out.println(k);
			return;
		}

		Queue<Long> q = new LinkedList<>();
		for (long i = 1; i < 10; i++) q.offer(i);
		while (!q.isEmpty() && k > 0) {
			long x = q.poll();
			k--;
			if (k == 0) {
				System.out.println(x);
				break;
			}
			long last = x % 10;
			if (last > 0) q.offer(x * 10 + last - 1);
			q.offer(x * 10 + last);
			if (last < 9) q.offer(x * 10 + last + 1);
		}
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

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


Measured memory_bytes: 33236
#include<iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c <= 21)
    {
        cout<<"win";
    }
    else if(a+b+c >21)
    {
        cout<<"bust";
    }
    cout<<endl;
}

Measured memory_bytes: 256
N,D=map(int, input().split())
XY=[map(int, input().split()) for _ in range(N)]
X,Y=[list(i) for i in zip(*XY)]

D2=D**2
K=0

for i in range(0,N):
    S=(X[i])**2+(Y[i])**2
    if D2>=S:
        K+=1

print(K)

Measured memory_bytes: 116708
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  int n = 0,min = 0,tmp = 0,flag = 0,cnt = 0;
  cin >> n;

  for(int i=0;i<n;i++){
    cin >> tmp;
    if(tmp == 1&&flag == 0){
      min++;
      flag++;
      cnt++;
    }
    if(flag == 1&&tmp == min + 1){
      min++;
      cnt++;
    }
  }

  if(flag == 1){
    cout << n-cnt << endl;
  }else{
    cout << -1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <climits>
using namespace std;
int mp[200002];
void solve()
{
	string s;
	cin>>s;
	int n=s.size();
	while(n--)
		cout<<'x';

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0;
}

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

int main(){
    vector<int> a(5);
    rep(i,5) cin >> a[i];
    int res = -1;
    int s = 10;
    rep(i,5){
        if(a[i]%10 != 0){
            res += a[i]/10 + 1;
            s = min(s,a[i]%10);
        }
        else res += a[i]/10;
    }
    int sum = 10 * res;
    cout << sum + s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int A[500001],hs;

int parent(int x){
  return (x/2);
}

int left(int x){
  return 2*x;
}

int right(int x){
  return 2*x+1;
}

void maxHeapify(int i){
  int l,r,tmp;
  int largest;
  l = left(i);
  r = right(i);
  if(l <= hs && A[l] > A[i]){
    largest = l;
  } else {
    largest = i;
  }
  if(r <= hs && A[r] > A[largest]){
    largest = r;
  }
  if(largest !=i){
    tmp = A[i];
    A[i]=A[largest];
    A[largest]= tmp;
    maxHeapify(largest);
  }
  
}

void buildMaxHeap(){
  int i;
  for(i = hs/2;i >0;i--){
    maxHeapify(i);
  }
}

int main(){
  int i;

  scanf("%d",&hs);
  for(i=1;i<=hs;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap();
  for(i=1;i<=hs;i++){
    printf(" %d",A[i]);
  }    
  printf("\n");

  return 0;
}

Measured memory_bytes: 2552
#include <stdio.h>
//#include <math.h>
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
#define ABS(x) ((x) >= 0 ? (x) : (-(x)))
int main() {
  int a,b,c,k;
  scanf("%d%d%d%d", &a,&b,&c,&k);
  int rest = k;
  if (rest > a) {
    rest -= a;
    if (rest > b) {
      rest -= b;
      printf("%d", a-rest);
    } else {
      printf("%d", a);
    }
  } else {
    printf("%d", rest);
  }
  return 0;
}

Measured memory_bytes: 2148
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		double[] v = new double[n];
		for(int i = 0;i < n;i++){
			v[i] = saori.Hayamin();
		}
		Arrays.sort(v);
		double ans = (v[0] + v[1])/2;
		for(int i = 2;i < n;i++){
			ans = (ans + v[i])/2;
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int tmp,cnt=0;

void bubbleSort(int a[], int n){
    int flag = 1;
    while (flag){
        flag = 0;
        for(int j=n-1; j>=1; j--){

            if(a[j]<a[j-1]){
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                cnt++;
                flag = 1;
            }
        }
    }
}

int main()
{
    int n;
    int a[105]={};
    cin>>n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    bubbleSort(a,n);
    
    for(int i=0; i<n; i++){
        if(i) cout<<" ";
        cout<< a[i];
    }
    cout<<endl;
    cout<<cnt<<endl;
}

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

int main(){
 char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>=22)   cout << "bust";
    else    cout << "win";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<int,int> pii;
map<int,int>M;
vector<int> V[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000;
    return 0;
}


Measured memory_bytes: 5940
import sys
input = sys.stdin.readline
n = int(input())
a = tuple(map(int,input().split()))

#b[q+1]-b[p] = a[p]+...a[q]
b = [0]*(n+1)
for i in range(n):
    b[i+1] = b[i]+a[i]

#dp[i][j] : i~j までをまとめるコストの最小値
dp = [[0]*n for i in range(n)]
for j in range(1,n):
    for i in range(n-j):
        
        mi = float("inf")
        for k in range(i,i+j):
            mi = min(mi,dp[i][k]+dp[k+1][i+j])
        dp[i][i+j] = mi+b[i+j+1]-b[i]

print(dp[0][n-1])

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

typedef uint32_t u32;
typedef uint64_t u64;

int main() {

  std::string str;
  std::getline(std::cin, str);
  for(u32 i = 0; i < str.size(); ++i) {
    if( 'a' <= str[i] and str[i] <= 'z' ) {
      str[i] ^= 0x20;
    }
  }

  std::cout << str << std::endl;
  
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    map<char, int> mp;
	string str;
    mp['q']=11;mp['a']=12;mp['z']=13;
	mp['w']=21;mp['s']=22;mp['x']=23;
	mp['e']=31;mp['d']=32;mp['c']=33;
	mp['r']=41;mp['f']=42;mp['v']=43;
	mp['t']=51;mp['g']=52;mp['b']=53;
	mp['y']=61;mp['h']=62;mp['n']=63;
	mp['u']=71;mp['j']=72;mp['m']=73;
	mp['i']=81;mp['k']=82;
	mp['o']=91;mp['l']=92;
	mp['p']=101;
	while(1){
	cin >> str;
	//auto itr=str.begin();
	if(str[0]=='#')break;
	int pos=0;
	    int hand=0;
	    int count=0;
	for(int i=0;i<str.size();i++){
		char x=str[i];
		if(!pos){
			pos=mp[x];
			hand=(pos/60);
		}
		else{
			if((mp[x]/60)!=hand){
				count++;
				hand=1-hand;
			}
			pos=mp[x];
		}
	}
	cout <<count<<endl;
	
    }
}

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


int main() {
  unsigned long long H, W;
  cin >> H >> W;
  
  if(H==1 || W==1){
    cout << 1 << endl;
  }
   
  else if (H%2==1 && W%2==1){
    cout << H*W/2 + 1 << endl;
  }
  else {
    cout << H*W/2 << endl;
  }
  
  
  
  return 0;
}



Measured memory_bytes: 3628
#include <stdio.h>
#define LL long long
int p[50],m[50],tot;
int main(){
	LL n;
	int i,j,ans=0;
	scanf("%lld",&n);
	for(i=2;(LL)i*i<=n;i++)
		if(n%i==0){
			p[++tot]=i;
			while(n%i==0)n/=i,m[tot]++;
		}
	if(n>1)p[++tot]=n,m[tot]=1;
	for(i=1;i<=tot;i++){
		j=1;
		while(1){
			if(m[i]>=j)ans++,m[i]-=j;
			else break;
			j++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    x = int(input())
    value = 0

    for i in range(100):
        for j in range(2, 10):
            tmp = pow(i, j)
            if tmp <= x and tmp > value:
                value = tmp

    print(value)


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    lint H, W;
    cin >> H >> W;
    if (H == 1 or W == 1) {
        cout << 1 << endl;
        return 0;
    }
    if (H % 2 == 0 and W % 2 == 0) {
        cout << (H * W) / 2 << endl;
    } else if (H % 2 == 1 and W % 2 == 1) {
        cout << ((H * W) + 2 - 1) / 2 << endl;
    } else {
        cout << (H * W) / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <map>
#include <vector>
#include <algorithm>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,p;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  std::map<ll,ll> dp0[LIMIT1],dp1[LIMIT1];
  
  scanf("%s",s);
  scanf("%lld",&k);
  n=strlen(s);
  dp0[0][0]=0;
  dp1[0][0]=1;
  
  rep(i,n){
    rep(j,k+1){
      m = (ll)(s[i]-'0');
      for(p=0;p<=m&&j+(p==0 ? 0 : 1)<=k;p++){
        if(p<m){
          dp0[i+1][j+(p==0 ? 0 : 1)] += dp1[i][j];
        }else{
          dp1[i+1][j+(p==0 ? 0 : 1)] += dp1[i][j];
        }
      }
      dp0[i+1][j] += dp0[i][j];
      if(j<k) dp0[i+1][j+1] += dp0[i][j]*9;
    }
  }
  result = dp0[n][k]+dp1[n][k];
  printf("%lld",result);
  return 0;
}



Measured memory_bytes: 19200