akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
import math

def main():
    N, K = [int(x) for x in input().split()]

    ans = 0

    first = math.ceil(math.log2(K / N))
    num = 2 ** first
    for i in range(N, 0, -1):
        if i >= K:
            ans += 1 / N
            continue
        else:
            first = math.ceil(math.log2(K / i))
            num = 2 ** first
        ans += (1 / N) * (1 / num)

    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
def main():
    n = int(input())
    s = digit_sum(n)

    if n % s == 0:
        print('Yes')
    else:
        print('No')

def digit_sum(n):
    s = 0
    while n != 0:
        r, m = divmod(n, 10)
        s += m
        n = r
    return s


main()

Measured memory_bytes: 2940
n = int(input())

alp = [chr(i) for i in range(97, 97+26)]

def dfs(i):
    if i == 1:
        return [("a", 1)]
    else:
        ret = []
        for i in dfs(i-1):
            nowstr, nowmax = i
            for j in range(nowmax+1):
                ret.append((nowstr+alp[j], max(j+1,nowmax)))
        return ret

ans = dfs(n)
#print(ans)
for i in range(len(ans)):
    print(ans[i][0])

Measured memory_bytes: 27444
#include <bits/stdc++.h>
using namespace std;
int n, ans, a[1010], t[3];
int main(){
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	for (int i = 1; i <= n; ++i) {	
		for(int j = i + 1; j <= n; ++j){
			for(int k = j + 1; k <= n; ++k){
				t[1]=a[i];
				t[2]=a[j];
				t[3]=a[k];
				sort(t+1,t+3+1);
				if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k]&&t[1]+t[2]>t[3])
					ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#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 f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("ip1.txt", "r", stdin);
  freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
int32_t main()
{
  k_007();
  int n;
  cin >> n;
  int a[n];
  f(i, n)
  {
    cin >> a[i];
  }
  int ans = 0;
  int start = 0;
  for (int i = 1; i < n; i++)
  {
    if (a[i] > a[i - 1]) start = i;
    ans = max(ans, i - start);
  }

  cout << ans << endl;

}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
  return (a.second < b.second);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int prime(int n) {
  int flag = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {flag = 0; break;}
  }
  return flag;
}
int power(int x, int y)
{
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
  else
    return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
using namespace std;
using ipair = pair<int, int>;
using P = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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 double PI=3.14159265358979323846;

const int mod = 1e9+7;

int main(){
  int A, B;
  cin >> A >> B;
  for(int i=1; i<=1e8; i++){
    int tmp_A = i * 0.08;
    int tmp_B = i * 0.1;

    if(A==tmp_A && B==tmp_B){
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;
  return 0;
}


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

int main(){
  int W,H,N;
  cin>>W>>H>>N;
  int w=0, h=0;
  while(N--){
    int x,y,a;
    cin>>x>>y>>a;
    if(a==1&&x>w) w=x;
    if(a==2&&x<W) W=x;
    if(a==3&&y>h) h=y;
    if(a==4&&y<H) H=y;
  }
  if((W-w)<=0||(H-h)<=0) cout<<0<<endl;
  else cout<<(W-w)*(H-h)<<endl;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  vector<vector<int>> C(3, vector<int>(3));
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      scanf("%d", &C[i][j]);
    }
  }
  vector<int> A(3), B(3);
  for (int i = 0; i < 3; ++i) {
    B[i] = C[0][i];
  }
  for (int i = 1; i < 3; ++i) {
    A[i] = C[i][0] - B[0];
  }
  bool ok = true;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      if (A[i] + B[j] != C[i][j]) {
        ok = false;
        break;
      }
    }
  }
  printf("%s\n", ok ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
// AOJ 	0601 Sugar Glider
// 2018.1.16 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define QMAX 350000
typedef struct { long long t; int s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void max_heapify(int i)
{
	int l, r, max;
	QUE qt;
	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t > que[i].t) max = l; else max = i;
	if (r < qsize && que[r].t > que[max].t) max = r;
	if (max != i) {
		qt = que[i], que[i] = que[max], que[max] = qt;
		max_heapify(max);
	}
}

void deq()
{
	que[0] = que[--qsize];
	max_heapify(0);
}

void enq(int s, long long t)
{
	int i, max;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[max = PARENT(i)].t < que[i].t) {
		qt = que[i]; que[i] = que[max], que[max] = qt;
		i = max;
	}
}

typedef struct { int a, b, t; } T;
T tbl[300002];

int h[100002];
int *to[100002], *dt[100002], hi[100002];
char used[100002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

long long dijkstra(int start, int goal, int val)
{
	int i, s, e, c;
	long long d, x;

	qsize = 0;
	enq(start, val);
	while (qsize) {
		s = que[0].s, d = que[0].t, deq();
		if (s == goal) return val + h[goal] - d*2;
		if (used[s]) continue;
		used[s] = 1;
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i];
			c = dt[s][i];
			if (used[e] || c > h[s]) continue;
			x = d - c; if (x > h[e]) x = h[e];
			enq(e, x);
		}
	}
	return -1;
}

int main()
{
	int n, m, x;
	int i, k;
	T *tp;

	n = in(), m = in(), x = in();
	for (i = 0; i < n; i++) h[i] = in();
	for (tp = tbl, i = 0; i < m; i++, tp++) {
		tp->a = in()-1, tp->b = in()-1, tp->t = in();
		hi[tp->a]++, hi[tp->b]++;
	}
	for (i = 0; i < n; i++) {
		to[i] = malloc(hi[i] << 2);
		dt[i] = malloc(hi[i] << 2);
	}
	memset(hi, 0, sizeof(hi));
	for (tp = tbl, i = 0; i < m; i++, tp++) {
		k = hi[tp->a]++, to[tp->a][k] = tp->b, dt[tp->a][k] = tp->t;
		k = hi[tp->b]++, to[tp->b][k] = tp->a, dt[tp->b][k] = tp->t;
	}
	printf("%lld\n", dijkstra(0, n-1, x));
	return 0;
}


Measured memory_bytes: 17372
n = int(input())

pr = []
max_c = 0
sum_c = 0

for i in range(n):
    s = int(input())
    pr.append(s)
    if pr[i] >= max_c:
        max_c = pr[i]

    sum_c += pr[i]

sum_c = sum_c - max_c/2

print(int(sum_c))

Measured memory_bytes: 3060
// inputに入力データ全体が入る
function Main(input) {
  input = input.split("\n");
  const N = input[0];
  const A = input[1].split(' ').map(v => parseInt(v));
  f = false;

  A.forEach(v => {
    if (v % 2 == 0 && v % 3 != 0 && v % 5 != 0) f = true;
  });

  if (f) {
    console.log("DENIED");
  } else {
    console.log("APPROVED");
  }
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 23092
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1<<30;
const ll LINF = 1LL<<61;

int main()
{
    int N, M, R;
    cin >> N >> M >> R;
    V r(R);
    rep(i,R) cin >> r[i];
    rep(i,R) --r[i];
    auto dp = make_vec(N, N, LINF);
    rep(i,N) dp[i][i] = 0;
    rep(i,M)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        chmin(dp[a][b], (ll)c);
        chmin(dp[b][a], (ll)c);
    }
    rep(k,N) rep(i,N) rep(j,N)
        chmin(dp[i][j], dp[i][k] + dp[k][j]);
    
    sort(r.begin(), r.end());

    ll ans = LINF;
    do
    {
        ll sum = 0;
        rep(i, R-1)
        {
            int u = r[i], v = r[i+1];
            sum += dp[u][v];
        }
        chmin(ans, sum);
    } while (next_permutation(r.begin(), r.end()));

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

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

int main(){

	int n,d,x;
	cin>>n>>d>>x;

	vector<int> p(n);
	for(int i = 0; i< n; i++) cin>>p[i];

	int ans = n;
	for(int i = 0; i<n;i++){
		for(int j = 1; j*p[i]+1<=d;j++) ans++;
	}
	
	cout<<ans+x;
}

Measured memory_bytes: 256
/*****************
 *   I<3   C++   *
 *  IWANT ANYAC  *
 * ILOVEPROGRAM! *
 *IT'SINTERESTING*
 * ILOVEPROGRAM! *
 *  INCONTESTS   *
 *   GETSCORE    *
 *    ACCODE     *
 *     LETS      *
 *      GO       *
 *****************/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define ALL(a) (a).begin(),(a).end()
#define Inf 1e9
#define Mod 1000000007
#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(a) return puts(a),0
#define fastio ios::sync_with_stdio(0)
#define filei(f) freopen(f,"r",stdin)
#define fileo(f) freopen(f,"w",stdout)
#define MASK(a) (1<<(a))
#define MASKX(x,a) ((x)<<(a))
#define BIT(a,b) ((a>>b)&1)
using namespace std;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int Uint;
typedef long long INT;
typedef pair<INT,INT> PII;
typedef stringstream sst;
typedef istringstream iss;
typedef vector<int> vint;
typedef vector<INT> VINT;
typedef vector<pii> vpii;
typedef vector<PII> VPII;
typedef priority_queue<int> pqi;
typedef priority_queue<INT> PQI;
typedef priority_queue<pii> pqp;
typedef priority_queue<PII> PQP;
typedef priority_queue<int,vint,greater<int> > xqi;
typedef priority_queue<INT,VINT,greater<INT> > XQI;
typedef priority_queue<pii,vpii,greater<pii> > xqp;
typedef priority_queue<PII,VPII,greater<PII> > XQP;

int mxzhuan[100007],znmx=0,cnt=0;
int n,m,a[100007];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	mxzhuan[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)mxzhuan[i]=max(mxzhuan[i+1],a[i+1]);
	for(int i=0;i<n;i++)if(mxzhuan[i]-a[i]>znmx)znmx=mxzhuan[i]-a[i];//‮
	for(int i=0;i<n;i++)if(mxzhuan[i]-a[i]==znmx)cnt++;
	printf("%d\n",cnt);
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int count = 0;
  int L = 0;
  int R = 0;
  int LR = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    int k = s.size();
    if (s[0] == 'B' && s[k-1] == 'A') LR++;
    else if (s[0] == 'B') L++;
    else if (s[k-1] == 'A') R++;
    for (int j = 0; j < k-1; j++) {
      if (s.substr(j,2) == "AB") {
        count += 1;
        j += 1;
      }
    }
  }
  
  if (LR > 0) {
    count += LR-1;
    if (L > 0) {
      count += 1;
      L--;
    }
    if (R > 0) {
      count += 1;
      R--;
    }
  }
  cout << count + max(min(L,R),0) << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <cstdio>
#include <algorithm>
#define rg register
#define llint long long
using namespace std;
const int N=108611;

struct ios
{
	template <typename _tp>
	inline ios operator >> (_tp &x)
	{
		x = 0;int f = 1;char c = getchar();
		for(;c<'0'||c>'9';c=getchar()) if(c=='-') f = -1;
		for(;c<='9'&&c>='0';c=getchar()) x = (x<<1)+(x<<3)+(c^48);
		x *= f;
		return *this;
	}
	template <typename _tp>
	inline ios operator << (_tp x)
	{
		char s[66];int dgt = 0;
		if(x==0) putchar('0');
		if(x<0) putchar('-'),x = -x;
		while(x) ++dgt,s[dgt] = x%10+'0',x/=10;
		while(dgt) putchar(s[dgt]),--dgt;
		return *this;
	}
	inline ios operator << (char x)
	{
		putchar(x);
		return *this;
	}
}io;

int n,cnt,inv;
int q[N];

int main()
{
	io >> n;
	for(rg int i=1;i<=n;++i)
		q[i] = -1;
	for(rg int i=1;i<=n;++i)
	{
		io >> inv;
		int l = 1,r = cnt;
		while(l<=r)
		{
			int mid = (l+r)>>1;
			if(q[mid]>=inv) l = mid+1;
			else r = mid-1;
		}
		if(q[l]==-1||q[l]>=inv) ++cnt,q[cnt] = inv;
		else q[l] = inv;
	}
	io << cnt << '\n';
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		if(n%2==0)
		{
			System.out.printf("%.6f\n",(n/2)/(double)n);
		}
		else
		{
			System.out.printf("%.6f\n",(n/2+1)/(double)n);
		}
		sc.close();
		
	}
}


Measured memory_bytes: 24916
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n = read_cols!(usize);
    let probs = read_vec::<f64>();

    let result = probs.iter().fold(vec![1.0], |dp, &p| {
        iter::once(&0.0)
            .chain(dp.iter())
            .zip(dp.iter().chain(iter::once(&0.0)))
            .map(|(q, r)| q * p + r * (1.0 - p))
            .collect()
    });

    let ans: f64 = result.into_iter().skip(n / 2 + 1).sum();

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c=0;
cin >> a >> b;
if(a<b){
c=c+b;
b-=1;
}else{
c=c+a;
a-=1;
}
if(a<b){
c=c+b;
}else{
c=c+a;
}
cout << c << endl;
  
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
	int n, W; cin >> n >> W;
	vector<ll> dp(W + 1);
	
	// dp[i] = maximum total lvalue with total weight i
	for(int item = 0; item < n; item++){
		int weight, value;
		cin >> weight >> value;
		for(int weight_already = W - weight; weight_already >= 0; --weight_already){
		//for(int weight_already = 0; weight_already <= W - weight; weight_already++){
			dp[weight_already + weight] = max(dp[weight_already + weight], dp[weight_already] + value);
		}
	}
	ll ans = 0;
	for(int i = 0; i <= W; i++){
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
}
		 
		
int main(){
	//int t; cin >> t;
	int t = 1;
	while(t--){
		solve();
	}
}


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

using ll=long long;
int main(){
    int n,m;
    cin>>m>>n;
    int m0,md,n0,nd;
    cin>>m0>>md>>n0>>nd;
    vector<int> car(m);
    vector<int> kiw(n);
    auto create=[](vector<int>& vec,int v0,int d,int mod){
        vec[0]=v0;
        for(int i=1;i<vec.size();i++){
            vec[i]=(vec[i-1]*58+d)%mod;
        }
    };
    create(car,m0,md,n+1);
    create(kiw,n0,nd,m+1);

    sort(kiw.rbegin(),kiw.rend());
    vector<int> d(n);
    for(int i=0;i<n-1;i++){
        d[i]=kiw[i]-kiw[i+1];
    }
    d[n-1]=kiw[n-1];

    set<int> pos;
    for(int i=0;i<n;i++) if(d[i]) pos.insert(i);
        
    ll res=0;
    for(int i=0;i<m;i++){
        auto bit=pos.lower_bound(car[i]-1);
        vector<int> eraser;
        if(bit!=pos.end()){
            int v=*bit;
            if(bit==pos.begin()){
                if(v-car[i]>=0){
                    d[v-car[i]]++;
                    pos.insert(v-car[i]);
                }
                if((--d[v])==0){
                    pos.erase(v);
                }
            }
            else{
                int f=*prev(bit);
                int k=car[i]-f-1;
                if((--d[f])==0){
                    pos.erase(f);
                }
                if((--d[v])==0){
                    pos.erase(v);
                }
                d[v-k]++;
                pos.insert(v-k);
            }
            res+=car[i];
        }
        else if(bit!=pos.begin()){
            auto fit=prev(bit);
            int v=*fit;
            res+=v+1;
            if((--d[v])==0){
                pos.erase(v);
            }
        }
    }
    cout<<res<<endl;
    return 0;
}


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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;  

    cin>>n;
    string s;
    cin>>s;
    map<char,ll>ap;
    for(i=0;i<n;i++)
    {
        ap[s[i]]++;
    }
    for(auto &ss:ap)
    {
        if(ss.S&1) 
        {
            flag=true;
            break;
        }
    }
    if(flag) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

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

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


Measured memory_bytes: 3640
#![allow(unused_imports)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

//
// Macro debug!
//

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}





fn main() {
    input! {
        n: usize,
        m: usize,
        xs: [(i64, i64); m],
    }
    let _ = n + 1;

    let (a, b) = xs.into_iter().fold((1, 1000000), |(a, b), (x, y)| (max(a, x), min(b, y)));
    let ans = max(0, b - a + 1);
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
const int MAX_N = 100000;
ll N, M, A[MAX_N];
ll dp[MAX_N + 1];

void solve() {
    long long res = 0;
    unordered_map<ll, ll> mp;

    for (int i = 0; i < N; i++) {
        dp[i + 1] = (dp[i] + A[i]) % M;
        mp[dp[i + 1]]++;
    }

    for (auto val: mp) {
        res += val.second * (val.second - 1) / 2;
        if (val.first == 0) {
            res += val.second;
        }
    }

    printf("%lld\n", res);
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] = A[i] % M;
    }
    solve();
    return 0;
}

Measured memory_bytes: 4876
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] v = {in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt()};
        System.out.println(v[2] * Math.min(v[0], v[1]) + v[3] * Math.max(0, v[0] - v[1]));
    }

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less   
using namespace __gnu_pbds;  
using namespace std;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> set1;
ll find(ll a,ll p[])
{
   //cout<<"find "<<a<<endl;
   if(a==p[a])
   return a;
   else return p[a]=find(p[a],p);

}
void join(ll a,ll b,ll p[],ll sz[])
{
   a=find(a,p);
   b=find(b,p);
   if(a!=b)
   {
      if(sz[a]<sz[b])
      swap(a,b);
      sz[a]+=sz[b];
      p[b]=a;
   }
}
ll power(ll a,ll b,ll mod)
{
   ll res=1;
   while(b>0)
   {
      if(b&1)
      res=(res*a)%mod;
      b=b/2;
      a=(a*a)%mod;
   }
   return res;
}
ll inverse(ll x, ll p)
{
   return power(x,p-2,p);
}
ll hash1(ll x,ll y)
{
   return x+y+x*y;
}
ll f[200000]={0};
ll mod=1000000007;
void ini()
{
   f[0]=1;
   for(ll i=1;i<=200000;i++)
   f[i]=(i*f[i-1])%mod;
}



ll ncr(ll n,ll r)
{
   ll res=1;
   ll k=f[n];
   ll v=inverse(f[n-r],mod);
   ll u=inverse(f[r],mod);
   ll x=(u*v)%mod;
   k=(k*x)%mod;
   return k;
}
struct edge
{
   ll from;
   ll to;
};
void dfs(ll v,ll vis[],ll dp[],vector<ll> adj[])
{
   ll k=adj[v].size();
   for(ll i=0;i<k;i++)
   {
      ll u=adj[v].at(i);
      if(vis[u]==0)
      {
         vis[u]=1;
         dfs(u,vis,dp,adj);
         dp[v]=max(dp[v],dp[u]+1);
      }
      else
      dp[v]=max(dp[v],dp[u]+1);
   }
}

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
   cin>>n>>m;
   vector<ll> adj[n+1];
   vector<ll> back[n+1];
   vector<edge> li;
   ll out_deg[n+1]={0};
   ll in_deg[n+1]={0};
   for(ll i=0;i<m;i++)
   {
      ll u,v;
      cin>>u>>v;
      adj[u].pb(v);
      back[u].pb(v);
      edge z;
      z.from=u;
      z.to=v;
      out_deg[z.from]++;
      in_deg[z.to]++;
      li.pb(z);
   }
  ll dp[n+1]={0};
  ll vis[n+1]={0};
  for(ll i=1;i<=n;i++)
  {
     if(in_deg[i]==0)
     {
        vis[i]=1;
        dfs(i,vis,dp,adj);
     }
  }
  ll ans=0;
  for(ll i=1;i<=n;i++)
  ans=max(dp[i],ans);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 23664
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"
 
struct Edge {
	int src;
	int dst;
	int id;
};

// res: bridges
// v: current node
// from: parent node
int dfs2(vector<vector<Edge>>&g, vector<int>& res, int v, int& count, int from_id, vector<int>& low, vector<int>& pre) {
	pre[v] = count++;
	low[v] = pre[v];
	for (auto it = g[v].begin(); it != g[v].end(); it++) {
		int to = it->dst;
		if (pre[to] == -1) {
			// destination has not been visited
			// visit destination and update low[v]
			low[v] = min(low[v], dfs2(g, res, to, count, it->id, low, pre));
			if (low[to] == pre[to]) {
				// edge is not contained in a closed path -> bridge
				//res.push_back(it->id);
				res[it->id] = true;
			}
		}
		else {
			if (from_id == it->id) {
				// ignore a path to parent
				continue;
			}
			low[v] = min(low[v], low[to]);
		}
	}
	return low[v];
}

// Calculate bridges in a undirected graph.
// Assume graph is connected and has no parallel edges or self-loops.
// g: adjacency list
// V: number of nodes
void  bridges(vector<vector<Edge>>&g, int V, vector<int>&res) {

	if (V > 0) {
		// assume at least the first vertex exists
		vector<int> low(V, -1);  // lowest reacheable index
		vector<int> pre(V, -1);  // pre-order index
		int count = 0;  // pre-order index counter
		dfs2(g, res, 0, count, -1, low, pre);  // start dfs from vertex 0
	}
}

int main() {
	int V, E; cin >> V >> E;
	vector<vector<Edge>>es(V);
	vector<Edge>eids;
	for (int i = 0; i < E; ++i) {
		int s, t; cin >> s >> t;
		if (s > t)swap(s, t);
		es[s].push_back(Edge{ s,t,i });
		es[t].push_back(Edge{ t,s,i });
		eids.push_back(Edge{ s,t,i });
	}
	vector<int>res(E);
	bridges(es, V, res);
	vector<Edge>bris;
	for (int i = 0; i <E; ++i) {
		if (res[i])bris.push_back(eids[i]);
	}
	sort(bris.begin(), bris.end(), [=](const Edge&l, const Edge&r) {
		return l.src == r.src ? l.dst < r.dst : l.src < r.src;
	});
	for (int i = 0; i < bris.size(); ++i) {
		cout << bris[i].src << " " << bris[i].dst << endl;
	}
	return 0;
}

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

int main(void) {
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=c&&c<=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void)
{
  int a, b, c;
  double S, L, h;
  
  scanf("%d %d %d", &a, &b, &c);
  
  S = a * b * sin((double)(M_PI * c / 180)) / 2;
		  
  L = a + b + sqrt(a * a + b * b - 2 * a * b * cos((double)(M_PI * c / 180)));
  
  h = b * sin((double)(M_PI * c / 180));

  printf("%f\n", S);
  printf("%f\n", L);
  printf("%f\n", h);

  return 0;
}

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

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {


            
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            

            Console.WriteLine((input[0] % (input[1]*2 + 1) == 0) ? input[0] / (input[1]*2 + 1) : input[0] / (input[1]*2+1) + 1);

            Console.ReadKey();
           
        }


        public static long modder(){
            return (long)Math.Pow(10,9) + 7;
        }

        public static long GCD(long n, long m){
            
            if(m % n == 0) return n;
            else return GCD(m%n, n);

        }

        public static long LCD(long n, long m){

            return m * n / GCD(n,m);
        }
    }
}


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

int main(){
  string s;
  int n;
  cin>>n>>s;
  for(auto& i:s){
    i+=n;
    if('Z'<i)i-=('Z'+1-'A');
  }
  cout<<s<<endl;
}

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

const int N = 2e5;
ll a[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i]; a[i] -= 1 + i;
  }
  sort(a, a + n);
  ll ans = 1e18;
  for(int c : {n / 2, (n + 1) / 2}) {
    if(c >= n) continue;
    ll res = 0;
    for(int i = 0; i < n; i++) {
      res += abs(a[i] - a[c]);
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	q := getNextInt(scanner)
	seg := newSegment(n)
	for i := 0; i < q; i++ {
		c := getNextInt(scanner)
		if c == 0 {
			s := getNextInt(scanner) - 1
			t := getNextInt(scanner)
			x := getNextInt(scanner)
			seg.rangeadd(s, t, x)
			continue
		}
		pos := getNextInt(scanner)
		fmt.Fprintln(writer, seg.get(pos-1))
	}
}

type segment [][]int

func newSegment(n int) segment {
	seg := make(segment, 0)
	for n > 1 {
		seg = append(seg, make([]int, n))
		n = (n + 1) >> 1
	}
	seg = append(seg, make([]int, 1))
	return seg
}
func (seg segment) add(i int, x int) {
	for h := 0; h < len(seg); h++ {
		seg[h][i] += x
		i >>= 1
	}
}
func (seg segment) get(i int) int {
	var x int
	for h := 0; h < len(seg); h++ {
		x += seg[h][i]
		i >>= 1
	}
	return x
}
func (seg segment) rangeadd(l, r int, x int) {
	for h := 0; h < len(seg) && l < r; h++ {
		if l%2 == 1 {
			seg[h][l] += x
			l++
		}
		l >>= 1
		if r%2 == 1 {
			seg[h][r-1] += x
		}
		r >>= 1
	}
}
func (seg segment) sum(l, r int) int {
	var s int
	for h := 0; h < len(seg) && l < r; h++ {
		if l%2 == 1 {
			s += seg[h][l]
			l++
		}
		l >>= 1
		if r%2 == 1 {
			s += seg[h][r-1]
		}
		r >>= 1
	}
	return s
}



Measured memory_bytes: 5736
#include <bits/stdc++.h>
using namespace std;
typedef signed long long lint;
typedef unsigned long long ul;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  lint n;
  cin >> n;
  vector< ul > a(n);
  for (lint i=0; i<n; ++i) cin >> a[i];
  ul all = 0;
  for (lint i=0; i<n; ++i) all ^= a[i];
  for (lint i=0; i<n; ++i) cout << (all^a[i]) << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 4700
#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 rep1(i, n) for(int i = 1; i < (n); i++)

template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class F, class S> istream& operator >> (istream& s, pair<F, S>& p)
{ s >> p.first >> p.second; return s;}

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

    int ans = 10 - X / 200;

    cout << ans << endl;
}


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


int	h,w;

int maze(int sh1, int sw1,vector<vector<int>> S) {
	int i,j,sh,sw;
	vector<vector<int>> s(h+2, vector<int>(w+2));
	
	s = S;
	
	s[sh1][sw1] = 0;
	i = 0;
	
	while(1) {
		j = 0;
		for(sh=1;sh<=h;sh++) for(sw=1;sw<=w;sw++) {
			if (s[sh][sw] == i) {
				if (s[sh-1][sw  ] == -2) { s[sh-1][sw] = i+1; j=1; }
				if (s[sh+1][sw  ] == -2) { s[sh+1][sw] = i+1; j=1; }
				if (s[sh  ][sw-1] == -2) { s[sh][sw-1] = i+1; j=1; }
				if (s[sh  ][sw+1] == -2) { s[sh][sw+1] = i+1; j=1; }
			}
		}
		if (j==0) break;
		i++;
	}
	/*
	cout << endl;
	for(sh=1;sh<=h;sh++) {
		for(sw=1;sw<=w;sw++) {
			cout << (int)s[sh][sw];
		}
		cout << endl;
	}
	*/
	return i;
}

int main() {
	int		i,j,k,n,m,x,y,sh,sw,gh,gw,ans = 0;
	char	c;
	
	cin >> h >> w;
	
	vector<vector<int>> S(h+2, vector<int>(w+2));
	
	for(i=1;i<=h;i++) for(j=1;j<=w;j++) {
		cin >> c;
		if (c == '#') S[i][j] = -1;
		else S[i][j] = -2;
	}
	//printf("START\n");
	for(sh=1;sh<=h;sh++) for(sw=1;sw<=w;sw++) {
	//for(sh=1;sh<=1;sh++) for(sw=1;sw<=1;sw++) {
		if (S[sh][sw] == -1) continue;
		//printf("s(%d,%d) g(%d,%d)\n",sh,sw,gh,gw);
		ans = max(ans, maze(sh,sw,S) );
	}
	

	cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
bool hoge[222][222];
ll dp[222][222][10];
ll vx[2][6] = {{0,1,1,0,-1,-1},{0,1,1,0,-1,-1}};
ll vy[2][6] = {{1,0,-1,-1,-1,0},{1,1,0,-1,0,1}};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  ll n;cin>>n;
  for(int i=0;i<n;i++){
    ll x,y;cin>>x>>y;
    hoge[x+111][y+111] = true;
  }
  ll lx,ly;cin>>lx>>ly;

  for(int i=0;i<222;i++)
    for(int j=0;j<222;j++)
      for(int k=0;k<10;k++)
	dp[i][j][k]=llINF;
  dp[sx+111][sy+111][0]=0;

  priority_queue<pair<pair<ll,ll>,pair<ll,ll>>,vector<pair<pair<ll,ll>,pair<ll,ll>>>,greater<>>que;
  que.push(mp(mp(0,0),mp(sx+111,sy+111)));

  while(!que.empty()){
    pair<ll,ll>now = que.top().S;
    ll c = que.top().F.F;
    ll turn = que.top().F.S;
    que.pop();
    //cout<<now.F<<" "<<now.S<<endl;
    for(int k=0;k<6;k++){
      ll x = now.F+vx[abs(now.F+1)%2][k];
      ll y = now.S+vy[abs(now.F+1)%2][k];
      ll cost;
      if(k == (turn*abs(now.F-111)*abs(now.S-111))%6)cost = 0;
      else cost = 1;

      if(abs(x-111)>lx||abs(y-111)>ly||hoge[x][y]){
	if(dp[now.F][now.S][(turn+1)%6] > c+1){
	  dp[now.F][now.S][(turn+1)%6] = c+1;
	  que.push(mp(mp(c+1,turn+1),mp(now.F,now.S)));
	}
	continue;
      }

      if(dp[x][y][(turn+1)%6] > c+cost){
	dp[x][y][(turn+1)%6] = c+cost;
	que.push(mp(mp(c+cost,turn+1),mp(x,y)));
      }   
    }
  }

  ll ans=llINF;
  for(int i=0;i<6;i++){
    ans=min(ans,dp[gx+111][gy+111][i]);
  }
  if(ans==llINF)cout<<-1<<endl;
  else 
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 7152
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e17
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a,b,a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,n,m,m1,m2,n1,n2,o,p1,p2,p3,p4,
q1,q2,q3,q4,r,s,t,x,y,z,sum,mn,flg,flg1,flg2,id1,id2,id3,lim,cost;
int main()
{
    scanf("%lld%lld%lld",&k,&a,&b);
    if(a%k==0||b%k==0){
        printf("OK\n");return 0;
    }
    c=(a/k);
    c++;
    c=c*k;
    if(c<=b)printf("OK\n");
    else printf("NG\n");
    // solve();
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3764
import math
import heapq

n,m,s = map(int,input().split())

road = []
for i in range(m):
    u,v,a,b = map(int,input().split())
    road.append([u,v,a,b])

change = []
for i in range(n):
    c,d = map(int,input().split())
    change.append([c,d])

tree = [[] for _ in range(n+1)]

for i in range(m):  
    r = road[i]
    tree[r[0]].append([r[0],r[1],r[2],r[3]])
    tree[r[1]].append([r[1],r[0],r[2],r[3]])

least_cost = [[] for _ in range(n+1)]
for l in range(n+1):
    least_cost[l] = [math.inf]*2501

queue = []

#hwd [location, money, time]
def dijakstra(q):
    while q != []:
        hwd = heapq.heappop(q)

        if least_cost[hwd[1]][hwd[2]] > hwd[0]:
            least_cost[hwd[1]][hwd[2]] = hwd[0]
            
            for node in tree[hwd[1]]:
                # from node, to node , money, time
                if hwd[2] - node[2] >= 0:
                    heapq.heappush(q,(hwd[0]+node[3],node[1],hwd[2]-node[2]))
            if hwd[2] + change[hwd[1]-1][0] <= 2500:
                heapq.heappush(q,(hwd[0]+change[hwd[1]-1][1],hwd[1],hwd[2]+change[hwd[1]-1][0]))
    return least_cost

if s > 2500:
    s = 2500
queue.append((0,1,s))

ans = dijakstra(queue)

for i in range(2,n+1):
    print(min(ans[i]))

Measured memory_bytes: 52556
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int[] alpha = new int[26];
		
		char[] s = in.next().toCharArray();
		for (int i = 0 ; i < s.length; i++) {
			alpha[s[i] - 'a']++;
		}
		
		boolean flag = true;
		for (int i = 0 ; i < 26; i++) {
			flag = (alpha[i] % 2 == 0);
			if (!flag)
				break;
		}
		
		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std; 
 
 
int sumofdig(int n){
	int ans = 0; 
	while(n){
		ans += (n%10); 
		n /= 10; 
	}
	return ans; 
}

int pow(int a, int n){
	if(n == 0) return 1; 
	if(n == 1) return a;
	int b = pow(a,n/2);
	if(n%2 == 0) return b*b; 
	return b*b*a; 
}
 
int main(int argc, char const *argv[])
{	
	int n ; 
	cin >> n; 
	int p = log10(n); 
	int d = pow(10,p);

	if(n - d > 0){
		cout << 1 + sumofdig(n-d); 
	}
	else{
		d /=10; 
		cout << sumofdig(d) + sumofdig(n-d); 
	}
	return 0;
} 

Measured memory_bytes: 512
import sys
input = sys.stdin.readline

import itertools
import math

def main():
    N = int(input())
    X =[]
    Y =[]
    for _ in range(N):
        x, y = [int(x) for x in input().split()]
        X.append(x)
        Y.append(y)

    jun = list(itertools.permutations(range(N)))
    to = 0
    for i in jun:
        for j in range(N - 1):
            to += math.sqrt((X[i[j + 1]] - X[i[j]]) ** 2 + (Y[i[j + 1]] - Y[i[j]]) ** 2)

    print(to / (len(jun)))







if __name__ == '__main__':
    main()



Measured memory_bytes: 7972
import sys
import math

if sys.platform =='ios':
  sys.stdin=open('input134c.txt')

#+++++

n = int(input())
a = []
max=0
max2=0
for i in range(n):
	ai = int(input())
	a.append(ai)
	if max < ai:
		max2 = max
		max = ai
	elif max2 < ai:
		max2 = ai			

#n, d = map(int, input().split())

for j in a:
	if j == max:
		print(max2)
	else:
		print(max)

Measured memory_bytes: 12532
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

arr = list()
for i, a in enumerate(A):
    for j in range(a):
        arr.append(i + 1)
for i in range(H):
    sub = arr[i * W: (i + 1) * W]
    if i % 2 == 1:
        sub = list(reversed(sub))
    print(' '.join([str(x) for x in sub]))

Measured memory_bytes: 40432
#include <bits/stdc++.h>
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N, M;
    scan(N, M);

    priority_queue<int> a;
    rep(i, N) {
        int x;
        scan(x);
        a.push(x);
    }
    rep(i, M) {
        int x = a.top();
        a.pop();
        a.push(x / 2);
    }
    ll ans = 0;
    rep(i, N) {
        ans += a.top();
        a.pop();
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A;
    cin >> A;
    int B;
    cin >> B;

    if((A+B)%3==0) cout << "Possible" << endl;
    else if(A%3==0) cout << "Possible" << endl;
    else if(B%3==0) cout << "Possible" << endl;

    else  cout<<"Impossible" << endl;
}


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

int main()
{
   char a,b,c;
   string d;
   getline(cin,d);
   a=d[0],b=d[2];
   
   string first="",second="";
   
   for(int index=0;index<(int)(a-'0');index++)
   first+=b;
   
   for(int index=0;index<(int)(b-'0');index++)
   second+=a;
   
   if(a<=b)
   cout<<second<<endl;
   else 
   cout<<first<<endl;
    return 0;
}


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

int main(){
    ll n;
    cin>>n;
    ll t[n];
    for(ll i=0;i<n;++i){
        cin>>t[i];
    }
    ll t_copy[n];
    ll flag;
    ll sum=0;

    ll m;
    cin>>m;
    ll p[m];
    ll x[m];
    for(ll i=0;i<m;++i){
        sum=0;

        cin>>p[i]>>x[i];
        flag=p[i]-1;

        for(ll j=0;j<n;++j){
            t_copy[j]=t[j];
        }
        t_copy[flag]=x[i];
        for(ll j=0;j<n;++j){
            sum+=t_copy[j];
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 256