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

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;

#define rep(i,b) for(i=0;i<b;++i)
#define repp(i,a,b) for(i=a;i<b;++i)

int main() {
    ll t;
    cin >> t;
    ll fhun = t/500;
    ll rem = t % 500;
    fhun *= 1000;
    ll five = rem/5;
    five *= 5;
    cout << fhun+five << endl;

    return 0;
}
/*
         ,--"""",--.__,---[],-------._         
       ,"   __,'            \         \--""""""==;-
     ," _,-"  "/---.___     \       ___\   ,-'',"
    /,-'      / ;. ,.--'-.__\  _,-"" ,| `,'   /
   /``""""-._/,-|:\       []\,' ```-/:;-. `. /
             `  ;:::      ||       /:,;  `-.\
                =.,'__,---||-.____',.=
                =(:\_     ||__    ):)=
               ,"::::`----||::`--':::"._
             ,':::::::::::||::::::::::::'.
    .__     ;:::.-.:::::__||___:::::.-.:::\     __,
       """-;:::( O )::::>_|| _<::::( O )::::-"""
   =======;:::::`-`:::::::||':::::::`-`:::::\=======
    ,--"";:::_____________||______________::::""----.          , ,
         ; ::`._(    |    |||     |   )_,'::::\_,,,,,,,,,,____/,'_,
       ,;    :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
      ;/ /      :::::::::,||,:::::::::::::::::::::::::::::::::::/
     /; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
     ;/                :);/|_;| ,--.. . ```-.:::::::::::::_,"
    /;                :::):__,'//""\\. ,--.. \:::,:::::_,"
   ;/              :::::/ . . . . . . //""\\. \::":__,"
   ;/          :::::::,' . . . . . . . . . . .:`::\
   ';      :::::::__,'. ,--.. . .,--. . . . . .:`::`
   ';   __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
   ;    /  \\ .//""\\ . . . . . . . . . //""\\. :`::`
   ;   /       . . . . . . . . . . . . . . . . .:`::`
   ;   (          . . . . . . . . . . . . . . . ;:::`
   ,:  ;,            . . . . . . . . . . . . . ;':::`
   ,:  ;,             . . . . . . . . . . . . .;`:::
   ,:   ;,             . . . . . . . . . . . . ;`::;`
    ,:  ;             . . . . . . . . . . . . ;':::;`
     :   ;             . . . . . . . . . . . ,':::;
      :   '.          . . . . . . . .. . . .,':::;`
       :    `.       . . . . . . . . . . . ;::::;`
        '.    `-.   . . . . . . . . . . ,-'::::;
          `:_    ``--..___________..--'':::::;'`
             `._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________

*/


Measured memory_bytes: 256
#include <iostream>

constexpr auto P = static_cast<int>(1e9 + 7);

class modP {
private:
  int i;

public:
  modP(int i) noexcept : i(i % P) {}
  modP operator-(int b) { return (i - b) % P; }
  modP operator*(modP b) { return static_cast<int64_t>(i) * b.i % P; }
  modP factorial() {
		if(i == 0 || i==1 ) return 1;
		return (*this - 1).factorial() * *this; }
  friend std::ostream & operator<< (std::ostream & ostr, const modP &i);
};

std::ostream & operator<< (std::ostream& ostr, const modP& i){
  return ostr << i.i;
}

int main(void) {
  int N;
  std::cin >> N;
	std::cout << modP(N).factorial();
  return 0;
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double n, m, d;
  cin >> n >> m >> d;
  
  double ans;
  ans = 2 * (n - d) * (m - 1) / pow(n, 2);
  if (d == 0) ans /= 2;
  
  cout << fixed << setprecision(10) << ans << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define SORT(i) sort((i).begin(),(i).end())
constexpr ll INF = 2000000000;
constexpr ll mod = 1000000007;

int sum(int x) {
	if (x == 1)return 1;
	int a = sum(x - 1);
	return a + x;
}

int main() {
	int a, b; cin >> a >> b;
	int c = b - a;
	cout << sum(c) - b << "\n";

	return 0;
}

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

using namespace std;

typedef long long ll;

#define mod 1000000007
#define siz 100001

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	
	if(n >= 400 && n <= 599) cout << 8 << "\n";
	else if(n >= 400 && n <= 799) cout << 7 << "\n";
	else if(n >= 800 && n <= 999) cout << 6 << "\n";
	else if(n >= 1000 && n <= 1199) cout << 5 << "\n";
	else if(n >= 1200 && n <= 1399) cout << 4 << "\n";
	else if(n >= 1400 && n <= 1599) cout << 3 << "\n";
	else if(n >= 1600 && n <= 1799) cout << 2 << "\n";
	else if(n >= 1800 && n <= 1999) cout << 1 << "\n";
}

Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

#s=input().rstrip()
n,k=MI()
A=[0 for i in range(n)]
for i in range(k):
    d=I()
    u=LI()
    for s in u:
        A[s-1]+=1
count=0
for a in A:
    if a==0:
        count+=1
print(count)


    

        
    




Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll n;
  cin >> n;
  ll total = 0;
  vi a(n);
  rep(i, n){
    cin >> a[i];
  }
  vi b(n);
  rep(i,n){
    cin >> b[i];
    total += b[i];
  }
  vi c(n-1);
  rep(i,n-1){
    cin >> c[i];
  }
  for(ll i=1;i<n;i++){
    if(a[i]-a[i-1]==1){
      total += c[a[i - 1] - 1];
    }
  }
  print(total);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    int i, l = s.length();

    if (l % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < l; i+=2) {
        if (s[i] != 'h' || s[i+1] != 'i') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    int cnt = 0;
    bool flag = false;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        int p;
        cin >> p;
        if(p == i + 1){
            if(!flag)   flag = true;
            ++cnt;
        }
        else{
            flag = false;
            if(cnt > 0){
                ans += (cnt % 2 == 0) ? cnt / 2 : cnt / 2 + 1;
                cnt = 0;
            }
        }
    }
    if(cnt > 0) ans += (cnt % 2 == 0) ? cnt / 2 : cnt / 2 + 1;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	int r;
	while(r=a%b){
		a=b;
		b=r;
	}
	return b;
}

int main(){
	int n,k;cin>>n>>k;
	int a[n];
	rep(i,n) cin>>a[i];
	sort(a,a+n);
	int g=a[0];
	rep(i,n) g=gcd(g,a[i]);

	if(k%g==0&&k<=a[n-1]) cout<<"POSSIBLE"<<"\n";
	else cout<<"IMPOSSIBLE"<<"\n";
}

Measured memory_bytes: 640
N, K, Q = map(int, input().split())
Ai = list(map(int, [input() for i in range(Q)]))
 
scores = [K-Q for i in range(N)]
 
for i in range(Q):
    scores[Ai[i] - 1] += 1
    scores = scores
 
for k in range(len(scores)):
    if scores[k] > 0 :
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 13356
#include <cstdio>
#include <cctype>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

int n,sg[100100];
struct edge
{
    int v;
    edge *nxt;
} pool[200100],*tp=pool,*fst[100100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

void dfs(int x,int fa)
{
    for (edge *i=fst[x]; i; i=i->nxt)
        if (i->v!=fa)
            dfs(i->v,x),sg[x]^=sg[i->v]+1;
}

int main()
{
    n=getint();
    repu(i,2,n)
    {
        int u=getint(),v=getint();
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    dfs(1,0);
    puts(sg[1]?"Alice":"Bob");
    return 0;
}

Measured memory_bytes: 9088
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define ALL(c) c.begin(), c.end()
#define SCANF(x) scanf("%lld", &x)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, x;
	cin >> n >> x;
	
	int a[n];
	ll ans = 0;
	FOR1(n){
		int tmp;
		cin >> tmp;
		if(i == 0 && tmp > x){
			ans += tmp - x;
			tmp = x;
		}else if(i != 0 && tmp > x - a[i-1]){
			ans += tmp - (x - a[i-1]);
			tmp = x - a[i-1];
		}
		a[i] = tmp;
	}
	
	cout << ans;
}

Measured memory_bytes: 768
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        //N K
        char[] ifs = s.nextLine().toCharArray();
        char[] acts = s.nextLine().toCharArray();

        int ct = 0;
        for (int i = 0; i < ifs.length; i++) {
            if (ifs[i] == acts[i]) ct++;
        }

        System.out.println(ct);
    }
}

Measured memory_bytes: 23252
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    if (A <=8 && B <= 8){
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
/*;

THE BEST IS YET TO COME

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i,s,l) for(int i=s;i>=l;i--)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define vi vector<int>
#define vip vector<pair<int,int> >
#define endl "\n"
#define ln length()
#define sz size()
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
signed main()
{

    int n;
    cin>>n;
    vector<int> a(n);
    r(i,0,n)
    cin>>a[i];

    int x = 0;
    r(i,0,n)
        x ^= a[i];


    r(i,0,n)
        a[i] = x ^ a[i];

    r(i,0,n)
    cout<<a[i]<<" ";


	return 0;
}




Measured memory_bytes: 4752
from statistics import mean
def calc(way, city, result, dist_map):
    i_city=list(city)
    if len(city)==0:
        dis=0
        for i in range(1,num):
            if way[i-1]<way[i]:
                dis+=dist_map[way[i-1]][way[i]-way[i-1]-1]
            else:
                dis+=dist_map[way[i]][way[i-1]-way[i]-1]
        result.append(dis)
    else:
        for i in i_city:
            n_way=list(way)
            n_city=list(city)
            n_way.append(i)
            n_city.remove(i)
            calc(n_way, n_city, result, dist_map)
num = int(input())
points = []
result = []
dist_map = []
for _ in range(num):
    points.append(tuple(map(float, input().split())))
for i in range(num-1):
    new=[]
    for j in range(i+1, num):
        new.append(((points[i][0]-points[j][0])**2+(points[i][1]-points[j][1])**2)**0.5)
    dist_map.append(new)
way=[]
cite=list(range(num))
result=[]
calc(way, cite, result, dist_map)
print(mean(result))

Measured memory_bytes: 6556
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int INF = 1000000000;
int par[100005];//親
int rnk[100005];//木の深さ
void init(int n) {//初期化
	for (int i = 0; i <= n; i++) {
		par[i] = i;//自分の親が自分
		rnk[i] = 1;//上よりランクは0
	}
}
int find(int x) {//再帰で木の根を求める
	if (par[x] == x) {//根は親が自分自身
		return x;//return 親(自分）	
	}
	else {
		par[x] = find(par[x]);
		return par[x];
	}
}
void unite(int x, int y) {//木を合体
	int xa = find(x);
	int ya = find(y);
	if (xa == ya)return;
	
	if (rnk[xa] < rnk[ya]) { par[xa] = ya; rnk[ya] += rnk[xa]; }//大きい方に小さい木をつける
	else {
		par[ya] = xa;
		rnk[xa] += rnk[ya];
	//	if (rnk[x] == rnk[y])rnk[x]++;//どちらも同じ場合はｘに合体，+1
	}	
}
bool same(int x, int y) {
	return find(x) == find(y);
}
long long h[100005][3] = { 0 };
int main(){
	long long n, m;
	cin >> n >> m;
	for (int i = m; i > 0; i--) {
		cin >>h[i][1]  >> h[i][2] ;
	}
	init(n+1);
	for (int i = 1; i <= m; i++) {
		h[i][0] = h[i - 1][0];
		if (!same(h[i][1], h[i][2])) {
			h[i][0] = h[i - 1][0] + rnk[find(h[i][1])] * rnk[find(h[i][2])];
			//cout << " " << rnk[find(h[i][1])] << " " << rnk[find(h[i][2])] << endl;
			unite(h[i][1], h[i][2]);
		}
		
	
	}
	for (int i = m-1; i >= 0; i--) {
		cout<<n*(n-1)/2-h[i][0]<<endl;
	}
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 1666666
#define inf 9999999999999
int n;
int arr[N];
int f(int a,int b){
	if(b%a==0){
		return (2*(b/a)-1)*(a);
	}else{
		return ((2*a)*(b/a))+f(b%a,a);
	}
}
signed main(){
	int n,x;
	cin>>n>>x;
	int ans=n;
	ans+=f(x,n-x);
	cout<<ans;
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
using namespace std;

int n = 10;
vector< vector<int> > wf(vector< vector<int> > d){
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      for(int k = 0; k < n; k++){
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
      }
    }
  }
  return d;
}

int main(void) {

  int h, w; cin >> h >> w;
  vector< vector<int> > c(10, vector<int> (10));
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      cin >> c[i][j];
    }
  }
  vector< vector<int> > a(h, vector<int>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> a[i][j];
    }
  }

  c = wf(c);

  int tmp = 0;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if( a[i][j] == -1 ) continue;
      if( a[i][j] == 1 ) continue;
      tmp += c[ a[i][j] ][1];
    }
  }
  cout << tmp << endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public int count(int n, double d, int[][] coords) {
        int count = 0;
        for (int[] coord : coords) {
            double x = coord[0];
            double y = coord[1];

            if (Math.abs(x) > d || Math.abs(y) > d) {
                continue;
            } else {
                double dist = Math.sqrt(x * x + y * y);
                if (dist <= d) {
                    count++;
                }
            }
        }
        return count;
    }

    public static void main(String[] args) throws Exception {
        Main solution = new Main();

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int d = scanner.nextInt();

        int[][] coords = new int[n][2];
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            coords[i][0] = x;
            coords[i][1] = y;
        }

        int answer = solution.count(n, d, coords);
        System.out.println(answer);
    }
}

Measured memory_bytes: 64944
#include <stdio.h>
int main(void)
{
int a, b;
scanf("%d %d",&a ,&b );
if(a > b){
             printf("a > b\n");
          }
else if(a < b){
             printf("a < b\n");
}
else if(a == b){
     printf("a == b\n");
}        

return 0;
}

Measured memory_bytes: 2580
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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)*}
    };
}

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)*}
    };
}

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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!{
        a: i64,
        b: i64,
    }
    let acc = (a-b).abs();
    if acc % 2 == 0 {
        println!("{}", (min(a, b) + acc / 2).abs());
    } else {
        println!("IMPOSSIBLE");
    }
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
  int n,i;
  long long int sum=0;
  
  scanf("%d", &n);
  
  for(i=1;i<=n;i++){if(i%3!=0 && i%5!=0){sum += i;}}
  
  printf("%lld", sum);
  
  return 0;
}


Measured memory_bytes: 1732
n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
res = 0
p = 0
for i in a:
    x -= i
    if x < 0:
        x += i
        break
    res += 1
    p += 1
else:
    if x > 0:
        res -= 1
#print(p, a[p:])
print(res + (x in a[p:]))


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    
    char a,b;
    cin >> a >> b;
    
    if(a < b){
        cout << "<" << endl;
    }else if(b < a){
        cout << ">" << endl;
    }else{
        cout << "=" << endl;
    }
    
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) {
		String str = scn.next();
		boolean Fp = ispalindrome(str);
		if (Fp) {
			boolean Sp = ispalindrome(str.substring(0, str.length() / 2));
			if (Sp) {
				boolean Tp = ispalindrome(str.substring((str.length()) / 2 + 1));
				if (Tp)
					System.out.println("Yes");
				else
					System.out.println("No");
			} else
				System.out.println("No");
		} else
			System.out.println("No");

	}

	public static boolean ispalindrome(String str) {
		for (int i = 0; i < str.length() / 2; i++) {
			if (str.charAt(i) != str.charAt(str.length() - 1 - i))
				return false;
		}
		return true;
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define deb(x) cout<<#x<<" "<<x<<endl;
#define print(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
#define MOD 1000000007
#define finish return 0
using namespace std;
using namespace __gnu_pbds; 
typedef long long int ll;
typedef tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<int D, typename T> struct Vec : public vector<Vec<D - 1, T>> { static_assert(D >= 1, "Vector dimension must be greater than zero!"); template<typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) { }}; template<typename T> struct Vec<1, T> : public vector<T> { Vec(int n = 0, T val = T()) : vector<T>(n, val) { } };
inline ll mod(ll x) { return (x%MOD + MOD)%MOD; }
ll gcd(ll a, ll b, ll &x, ll &y){if(a == 0){x = 0, y = 1; return b;} ll x1, y1;  ll d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}
ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; } 
ll power(ll x,ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res*x); y = y>>1; x = (x*x);   } return res; } 
ll mod(ll num, ll den){ return mod(mod(num) * power(den,MOD-2,MOD)); }
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s;
    cin>>s;
    if(s[1] == 'B') s[1] = 'R';
    else s[1] = 'B';
    cout<<s<<endl;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n, W;
	cin >> n >> W;

	vector<pair<int, int>> item;
	ll mi = INF;
	for(int i=0; i<n; i++){
		int w, v;
		cin >> w >> v;
		item.pb(make_pair(w, v));
		if(mi > w){
			mi = w;
		}
	}
	vector<ll> wlist[4];
	vector<ll> sumlist[4];
	for(int i=0; i<n; i++){
		int w = item[i].first;
		int v = item[i].second;

		wlist[w-mi].pb(v);
	}

	for(int i=0; i<4; i++){
		sort(wlist[i].begin(), wlist[i].end(), greater<int>());
	}

	wlist[0].insert(wlist[0].begin(), 0);
	wlist[1].insert(wlist[1].begin(), 0);
	wlist[2].insert(wlist[2].begin(), 0);
	wlist[3].insert(wlist[3].begin(), 0);

	for(int i=0; i<4; i++){
		sumlist[i] = wlist[i];
	}

	/*
	puts("min");
	for(int i=0; i<4; i++){
		for(int j=0; j<wlist[i].size(); j++){
			printf("%d %d\n", i+mi, wlist[i][j]);
		}
	}
	*/

	//puts("sum");
	for(int i=0; i<4; i++){
		for(int j=1; j<wlist[i].size(); j++){
			sumlist[i][j] = sumlist[i][j-1] + wlist[i][j];
			//printf("%d ", sumlist[i][j]);
		}
		//puts("");
	}

	ll ans = 0;
	for(int j=0; j<wlist[0].size(); j++){
		for(int k=0; k<wlist[1].size(); k++){
			for(int l=0; l<wlist[2].size(); l++){
				for(int m=0; m<wlist[3].size(); m++){
					ll weight = j*mi + k*(mi+1) + l*(mi+2) + m*(mi+3);
					if(weight <= W){
						//printf("%d %d %d %d\n", j, k, l, m);
						ans = max(ans, sumlist[0][j] + sumlist[1][k] + sumlist[2][l] + sumlist[3][m]);
					}
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]

use std::io;
use std::io::prelude::*;
use std::collections::VecDeque;

fn main() {
    let sin = io::stdin();
    let mut l_iter = sin.lock().lines();
    let _n = l_iter.next().unwrap().unwrap().parse::<usize>().unwrap();

    let mut que = VecDeque::new();

    for line in l_iter {
        let l = line.unwrap();
        let mut ws = l.split_whitespace();
        match ws.next().unwrap() {
            "insert" => { 
                let d: u32 = ws.next().unwrap().parse().unwrap();
                que.push_front(d);
            },
            "delete" => { 
                let d: u32 = ws.next().unwrap().parse().unwrap();
                let mut res = None;
                for (i, v) in que.iter().enumerate() {
                    if d == *v {
                        res = Some(i);
                        break;
                    }
                }
                if let Some(idx) = res {
                    que.remove(idx);
                }
            },
            "deleteLast" => { 
                que.pop_back(); 
            },
            "deleteFirst" => { 
                que.pop_front(); 
            },
            _ => {;},
        }
    }

    let s = que.iter().map(|v| v.to_string())
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", s);
}



Measured memory_bytes: 17304
#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb
#include<bits/stdc++.h>
#define mp				make_pair
#define rep(i,n)		for(int i = 0; i < n; i++)
#define foreach(i,c)	for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF			0x7fffffff
#define INF				0x3f3f3f3f
#define LINF			3223372036854775807
#define END(s)			{cout<<s; return 0;}
#define CON(s)			{cout<<s; continue;}
#define BRE(s)			{cout<<s; break;}
#define pb				push_back
//#define int				long long
#define All(a)			a.begin(), a.end()  //with A in CAPITAL!!!
#define sz(a)			(int)a.size()
#define F				first
#define S				second
//#define usingFiles
using namespace std;

const int rp = 666666;
const bool debug = 1;

vector<int> a[100100];

priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq;
int tag[100100];

bool dfs(int now, int par){
	rep(i, a[now].size()){
		if(a[now][i] == par) continue;
		if(abs(tag[now] - tag[a[now][i]]) != 1){
			return false;
		}
		if(!dfs(a[now][i], now)){
			return false;
		}
	}
	return true;
}

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	rep(i, n - 1){
		int v, g;
		cin >> v >> g;
		v--, g--;
		a[v].pb(g);
		a[g].pb(v);
	}
	int m;
	cin >> m;
	rep(i, n) tag[i] = -1;
	rep(i, m){
		int v, g;
		cin >> v >> g;
		v--;
		tag[v] = g;
		pq.push(mp(g, v));
	}
	while(!pq.empty()){
		pair<int, int> p = pq.top();
		pq.pop();
		int v = p.S;
		rep(i, a[v].size()){
			if(tag[a[v][i]] == -1){
				tag[a[v][i]] = tag[v] + 1;
				pq.push(mp(tag[a[v][i]], a[v][i]));
			}
		}
	}
	if(!dfs(0, -1)) cout << "No\n";
	else{
		cout << "Yes\n";
		rep(i, n){
			cout << tag[i] << endl;
		}
	}
	return 0;
}
/*
5
1 2
3 1
4 3
3 5
2
2 6
5 7
*/

Measured memory_bytes: 13308
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    char n[3];
    
    scanf("%s", n);
    
    if (n[0]==n[2]) {
        printf("Yes");
    } else {
        printf("No");
    }
    
    return 0;
}



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

const int P = 10004;
int n, p, a[P];
string s;
long long fp, x, sn;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p >> s;
	s = "W" + s;
	if(p == 2 || p == 5) {
		for(int i = 1; i <= n; ++i) {
			if((int)(s[i] - '0') % p == 0) {
				fp += i;
			}
		}
	} else {
		x = a[0] = 1;
		for(int i = n; i > 0; --i) {
			(sn += x * (int)(s[i] - '0')) %= p;
			fp += a[sn];
			++a[sn];
			x = (x * 10) % p;
		}
	}
	cout << fp << endl;
	return 0;
}


Measured memory_bytes: 788
def Technique_often_used():    
    # enumerate: for i, a in enumerate(a_list):
    # q, mod = divmod(a, b)
    # Functional Programming: filter, map, reduce
    pass
def naming_conventions():
    # [s_1, s_2, s_3, ..., s_k] is named s_k
    # [[s_11, s_12, ..., s_1k], ..,[s_j1, s_j2, ..., s_jk] is named s_jk
    # [[b1,c1],[b2,c2],..,[bm,cm]] is named bc
    # if there is something strange in a list then I add _ to the list's name (ex:s_jk_)
    pass
def visual_studio_code_shortcut():    
    # visual studio code shortcut https://qiita.com/TakahiRoyte/items/cdab6fca64da386a690b
    # delete line: Ctrl+Shift+k
    # choose same words: Ctrl+Shift+l
    pass
import sys
from itertools import combinations, permutations # https://docs.python.org/ja/3/library/itertools.html
from collections import deque, Counter # https://docs.python.org/ja/3/library/collections.html#collections.deque
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
from functools import reduce
from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers): #
    return reduce(lcm, numbers, 1)

# set the inputs
    # open(0).read() is a convenient method: 
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
    # ex1) n, k = R()
    # ex2) v = list(R())
    # ex3) bc = [list(R()) for i in range(m)]

R = lambda: map(int, input().split())
q = int(input())
queries = [list(R()) for i in range(q)]

# q = 4
# queries=[[1,4,2],[1,5,3],[1,-9,5],[1,1,-8],[2]]

l = []
r = []
ans = 0
for query in queries:
    if query[0] == 1:
        a = heappushpop(l,-query[1])
        b = heappushpop(r, query[1])
        heappush(l,-b)
        heappush(r,-a)
        ans += abs(b+a) + query[2]
    else:
        print(-l[0],ans)


Measured memory_bytes: 70252
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,mm,a,b,in[100005],vis[100005],par[100005];
vl adj[100005],v,adj1[100005];
mll m;
void dfs(ll i)
{
    vis[i]=1;
    for(auto j:adj1[i])
    {
        if(!vis[j])
        {
            par[j]=i;
            dfs(j);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>mm;
    rep(i,0,n+mm-1)
    {
        cin>>a>>b;
        adj[a].pb(b);
        in[b]++;
    }
    queue<ll>q;
    rep(i,1,n+1)
    {
        if(in[i]==0)
            q.push(i);
    }
    while(!q.empty())
    {
        ll g=q.front();
        q.pop();
        v.pb(g);
        for(auto j:adj[g])
        {
            in[j]--;
            if(in[j]==0)
                q.push(j);
        }
    }
    rep(i,0,n)
    m[v[i]]=i;
    rep(i,1,n+1)
    {
        vector<pll>s;
        for(auto j:adj[i])
            s.pb({m[j],j});
        sort(all(s));
        for(auto j:s)
            adj1[i].pb(j.S);
    }
    dfs(v[0]);
    rep(i,1,n+1)
    cout<<par[i]<<"\n";
}


Measured memory_bytes: 24308
#include <cstdio>
using namespace std;
int main() {
    int x, y, r;
    scanf("%d%d", &x, &y);
    while (y > 0) {
    	r = x % y;
    	x = y;
    	y = r;
	}
	printf("%d\n", x);
	return 0;
}


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

using ll = long long int;
typedef long double ld;
typedef pair<ll,ll> pll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest element(0-based)=> cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X => cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

#define sz(v) (ll)v.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()

ll h[100010];
vector<ll> adj[100010];

bool check(ll n)
{
	vector<ll> t;
	ll maxi=-1;
	for(auto it:adj[n])maxi=max(maxi,h[it]);
	return h[n] > maxi;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,m,a,b,ans=0;
	cin>>n>>m;
	for(ll i=1;i<=n;i++)cin>>h[i];
	for(ll i=1;i<=m;i++)
	{
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	for(ll i=1;i<=n;i++)ans+=check(i);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 10232
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=300000+5,mod=1e9+7;
int par[N],rnk[N];
void I(int n){

  for(int i=1;i<=n;i++){
    par[i]=i;
    rnk[i]=1;
  }
}
int get_par(int n){

   if(par[n]==n) return n;
   return par[n]=get_par(par[n]);
}
void lnk(int a,int b){

  a=get_par(a);
  b=get_par(b);

  if(a==b){
    return ;
  }

  if(rnk[a]>rnk[b]){
    swap(a,b);
  }

  par[a]=b;
  rnk[b]+=rnk[a];
  rnk[a]=0;


}
int main(){
    GO();

    int T;
   // cin>>T;
   T=1;
    while(T--){
       int n,m;
       cin>>n>>m;
       I(n);
       for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        lnk(a,b);
       }
       int mx=0;
       for(int i=1;i<=n;i++) mx=max(mx,rnk[i]);
       cout<<mx<<"\n";
    }

}





































































Measured memory_bytes: 5144
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  cin >> n >> a >> b;

  int ans=0;
  for (int i = 1; i <= n; i++)
  {
    int num=i,sum=0;
    while(num!=0){
      sum+=num%10;
      num/=10;
    }
    if(sum>=a && sum<=b) ans+=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String str = sc.next();
        char c[] = str.toCharArray();
        char dir = c[0];
        
        int begin = 0;
        int end = n - 1;
        int flag = 0;
        for (int i = 0; i < n; i++) {
            if (dir != c[i]) {
                if (flag == 0) {
                    if (k == 0) {
                        break;
                    }
                    k--;
                    flag = 1;
                    c[i] = dir;
                } else {
                    c[i] = dir;                   
                }
            } else {
                if (flag == 0) {
                    
                } else {
                    flag = 0;
                }
            }
        }
        
        // for (char a : c) {
        //     System.out.print(a);
        // }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (c[i] == 'L') {
                if (i == 0) continue;
                if (c[i - 1] == c[i]) {
                    count++;
                }
            } else {
                if (i == n - 1) continue;
                if (c[i + 1] == c[i]) {
                    count++;
                }
            }
        }
        
        System.out.println(count);
    }
}


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

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define fill(a,p) memset(a,p,sizeof(a))
#define pb push_back
#define mod 1000000007
#define N 100005
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>
#define endl "\n"

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =2005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll minim(ll a, ll b){return a<b?a:b;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

ll power(ll x, ll y,ll p) 
{ 
    ll res = 1;      
     x = x % p;    
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
            y = y>>1;  
            x = (x*x) % p;   
    } 
    return res; 
}

ll modInverse(ll n,ll p) 
{ 
    return power(n, p-2, p); 
} 


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

bool comp(const point &p1,const point &p2){
	if(p1.first!=p2.first)return p1.first<p2.first;
	else return p1.second<p2.second;
}

string to(char x){
	string s(1,x);
	return s;
}

int main()
{
	fio;
	ll n;cin>>n;
	vl a(n);
	f(n)cin>>a[i];
	point dp[n][n];
	for(ll i=0;i<n;i++){
		dp[i][i].first=a[i];
		dp[i][i].second=0;
	}
	for(ll k=1;k<n;k++){
		for(ll i=0;i+k<n;i++){
			ll j=i+k;
			if(a[i]+dp[i+1][j].second>a[j]+dp[i][j-1].second){
				dp[i][j].first=a[i]+dp[i+1][j].second;
				dp[i][j].second=dp[i+1][j].first;
			}else{
				dp[i][j].first=a[j]+dp[i][j-1].second;
				dp[i][j].second=dp[i][j-1].first;
			}
		}
	}
	cout<<dp[0][n-1].first-dp[0][n-1].second<<endl;
}

Measured memory_bytes: 140928
N, M = map(int, input().split())
YP = [[] for _ in range(M)]
for i in range(M):
    p, y = map(int, input().split())
    YP[i] = [y, p, i]
    
YP = sorted(YP)

Num = [0 for _ in range(N+1)]
ID = []


for yp in YP:
    y = yp[0]
    p = yp[1]
    i = yp[2]
    
    Num[p] += 1
    id_p = str(p).zfill(6)
    id_c = str(Num[p]).zfill(6)
    ID.append([i, id_p + id_c])
ID = sorted(ID)
for id in ID:
    print(id[1])

Measured memory_bytes: 110832
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX + 1];
  int n, i, j;
  scanf("%d",&n);

  A = malloc(sizeof(short) * n + 1);
  B = malloc(sizeof(short) * n + 1);

  for(i = 0;i<= VMAX;i++){
    C[i] = 0;
  }

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

  for(i=1;i<=VMAX;i++){
    C[i] = C[i] + C[i-1];
  }

  for(j=1;j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1;i<=n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 9708
#include<bits/stdc++.h>
using namespace std;
int n;
double p[3000];
double mem[3000][3000];
double dp(int i,int num)
{
    if(num==0)
    {
        double res=1.0;
    for(int j=i;j<n;j++)
        res*=(1.0-p[j]);
        return res;
    }
    if(i==n)
        return 0.0;
    if(mem[i][num]!=-1.0)
        return mem[i][num];
    mem[i][num]=(1-p[i])*dp(i+1,num)+p[i]*dp(i+1,num-1);
    return mem[i][num];
}
int main()
{
    cin>>n;
    int i,j;
    for(i=0;i<=n;i++)
        for(j=0;j<=n;j++)
        mem[i][j]=-1.0;
    for(i=0;i<n;i++)
        cin>>p[i];
    double sum=0.0;
    for(i=n/2+1;i<=n;i++)
        sum+=dp(0,i);
        cout<<setprecision(10)<<fixed<<sum;
    return 0;
}


Measured memory_bytes: 70784
import java.util.Scanner;

public class Main {
	public static int N;
	public static int[] A;

	public static void main(String[] args) {
		init();
		boolean ans = true;
		for (int i = 0; i < A.length; i++) {
			if ((A[i] % 2 == 0) && (A[i] % 3 != 0 && A[i] % 5 != 0)) {
				System.out.println("DENIED");
				ans = false;
				break;
			}
		}
		if (ans) {
			System.out.println("APPROVED");
		}
	}

	public static void init() {
		Scanner sc = new Scanner(System.in);
		try {
			N = sc.nextInt();
			A = new int[N];
			for (int i = 0; i < N; i++) {
				A[i] = sc.nextInt();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 23252
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m,k,f=0;
	cin>>n>>m>>k;
	FORQ(i,0,n){
		FORQ(j,0,m){
			if(k==i*m+j*n-2*i*j)f=1;
		}
	}
	if(f){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    cout << C - min(A - B, C) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"


int32_t main()
{
	IOS;
	int n;
	cin>>n;
	string s;
	cin>>s;
	s="#"+s;
	int prew[n+5]={};
	for(int i=1;i<n+1;i++)
	{
		if(s[i]=='W')
			prew[i]+=prew[i-1]+1;
		else prew[i]=prew[i-1];
	}
	int ans=0;
	for(int i=1;i<n+1;i++)
	{
		int after=prew[n]-prew[i];
		int before=i-prew[i-1];
		ans=max(ans,after+before);
	}
	cout<<n-ans;

 	return 0;
} 


Measured memory_bytes: 3056
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	printf("%d %d %f\n", a / b, a%b, (double)a / (double)b);
	//cout << a / b << " " << a%b << " " << (double)a / (double)b << "\n";
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	int f[n][10];
	REP(i,n)
		REP(j,10)
			cin >> f[i][j];
	int p[n][11];
	REP(i,n)
		REP(j,11)
			cin >> p[i][j];
	int ans = -INF;
	for(int bit = 1; bit < 1 << 10; bit++){
		int sum = 0;
		REP(i,n){
			int cnt = 0;
			REP(j,10){
				if((bit & 1 << j) && f[i][j] == 1) cnt++;
			}
			sum += p[i][cnt];
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: AKIBA
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const string t("AKIHABARA");

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  int sn = s.size(), tn = t.size();

  int si = 0, ti = 0;
  for (; ti < tn ; ti++) {
    //printf("s[%d]=%c, t[%d]=%c\n", si, s[si], ti, t[ti]);
    if (si < sn && s[si] == t[ti]) si++;
    else if (t[ti] != 'A') break;
  }

  if (si == sn && ti == tn) puts("YES");
  else puts("NO");
  return 0;
}


Measured memory_bytes: 256