akhauriyash/Code-Regression huggingface dataset:
class Main {
    
    public static void main(String args[]) {
        java.util.Scanner sc = new java.util.Scanner(System.in);
        PriorityQueue priorityQueue = new PriorityQueue();
        boolean isContinue = true;;
        while(isContinue){
           String order = sc.next();
           switch (order){
                case "insert":
                    priorityQueue.insert(Integer.parseInt(sc.next()));
                    break;
                case "extract":
                    priorityQueue.extract();
                    break;
                case "end":
                    isContinue = false;
                    break;
            default:
                System.out.println("unsupported error");
                break;
           }
            
        }
        sc.close();
    }
    static class PriorityQueue{
        static private final int MAX_ELEMENT = 2000000; 
        private int[] A = new int[MAX_ELEMENT+1];
        private int elemrntNum = 0;

        public void insert(int value){
            elemrntNum++;
            int current = elemrntNum;
            A[current] = value;
            int parent = current/2;
            while(parent >0 && A[current] > A[parent] ){
                this.swap(current, parent);
                current = parent;
                parent = current/2;
            }
        }
        // private 

        private void swap(int i, int j) {
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }

        public void extract(){
            if(this.elemrntNum < 1) return;
            int terminalValue = this.A[elemrntNum];
            this.A[elemrntNum] = 0;
            int max = this.A[1];
            this.A[1] = terminalValue;
            maxHeapify(1);
            this.elemrntNum--;
            System.out.println(max);
        }

        private void maxHeapify(int i) {
            int leftIndex = i * 2;
            int rightIndex = leftIndex + 1;
            int largerIndex = i;
            if (leftIndex < A.length && A[leftIndex] > A[i])
                largerIndex = leftIndex;
            if (rightIndex < A.length && A[rightIndex] > A[largerIndex])
                largerIndex = rightIndex;
    
            if (largerIndex != i) {
                swap(largerIndex, i);
                maxHeapify(largerIndex);
            }
        }
    }
}


Measured memory_bytes: 302604
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
	let N = parseInt(input[0][0], 10);
	let graph = Array.from({length: N}, () => []);
	let line;
	for  (let i = 0; i < N - 1; i++){
		line = input[i + 1].map(e => parseInt(e, 10));
		graph[line[0] - 1].push(line[1] - 1);
		graph[line[1] - 1].push(line[0] - 1);
	}
	let v_c = input[N].map(e => parseInt(e, 10));
	v_c.sort((a, b) => a - b);
	let tmp = v_c.pop();
	var sum  = function(arr) {
		var sum = 0;
		arr.forEach(function(elm) {
			sum += elm;
		});
		return sum;
	};
	console.log(sum(v_c));
	v_c.push(tmp);
	v_ans = [];
	let j = 0;
	while (j < N - 1){
		for  (let i = 0; i < N; i++){
			if (graph[i].length === 1) {
				// console.log("ij", i, j);
				tmp = graph[i].pop();
				graph[tmp].splice(graph[tmp].indexOf(i), 1);
				v_ans[i] = v_c[j];
				j ++;
				// console.log(v_ans);
				// console.log(graph);
			}
		}
	}

	for (let i = 0; i < N; i++){
		if (v_ans[i] == null) {v_ans[i] = v_c[N - 1]; break;}
	}
	
	console.log(v_ans.join(" "));

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));




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

typedef long long ll;
using namespace std;

int main(void){
    string S;
    int N;
    cin >> S;
    N = S.length();
    if(S[N-1] == 's')
    {
        S = S + "es";
        cout << S << endl;
    }
    else
    {
        S = S + "s";
        cout << S << endl;
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, Q, T;
char str[MAXN];

int main() {
	int i, j;
	scanf("%d%s", &N, str);
	int cnt = 0;
	for (i = 0; i < N; ++i) {
		if (i == N - 1 || str[i + 1] != str[i]) {
			++cnt;
		}
	}
	
	printf("%d", cnt);
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
int dp[101][101][301]={};
ll w1[101]={};
int v1[101]={};
ll km[101]={};
int main() {
	int n;
	ll w;
	cin>>n>>w;
	for(int i=1;i<n+1;++i){
		cin>>w1[i]>>v1[i];
		km[i]=km[i-1]+w1[i]-w1[1];
	}
	int r=0;
	for(int i=1;i<=n;++i){
		for(int j=1;j<=i;++j){
			for(ll k=0;k<=km[i];++k){
				ll k1=w1[i]-w1[1];
				if(k1<=k){
					dp[i][j][k]=max(dp[i-1][j][k],dp[i-1][j-1][k-k1]+v1[i]);
				}else{
					dp[i][j][k]=dp[i-1][j][k];
				}
			}
		}
	}
	for(int i=1;i<=n;++i){
		for(ll k=0;k<=km[n];++k){
			if(w>=w1[1]*i+k)r=max(r,dp[n][i][k]);
		}
	}

	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 10368
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

a,b = FLI()

for i in range(a, b+1):
    if i%n == 0:
        print("OK")
        exit()

print("NG")

Measured memory_bytes: 27156
from itertools import product
s=input()
N=len(s)
res = 0
gen = [0,1]
for ls in product(gen, repeat=N-1):
    tmp = int(s[0])
    tmpsum = 0
    for i in range(1,N):
        if ls[i-1]==0:
            tmp = 10*tmp + int(s[i])
        else:
            tmpsum += tmp
            tmp = int(s[i])
    tmpsum += tmp
    res += tmpsum
print(res)


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

from itertools import accumulate

A = list(map(int,input().split()))
B = list(map(int,input().split()))
B.reverse()

A = list(accumulate(A))
B = list(accumulate(B))
B.reverse()

m = max(a+b for a,b in zip(A,B))
print(m)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int h,w,k;cin>>h>>w>>k;
    int si,sj,gi,gj;
    cin>>si>>sj>>gi>>gj;
    si--,sj--,gi--,gj--;
    string s[h];
    rep(i,h) cin>>s[i];

    int dis[h][w];
    rep(i,h)rep(j,w)dis[i][j]=INF;
    queue<pair<int,int>> que;
    dis[si][sj]=0;que.push({si,sj});
    
    auto check=[&](int i,int j){
        return 0<=i and i<h and 0<=j and j<w and s[i][j]!='@';
    };


    // 各頂点，各方向の一番近い場所からしか流入しないので間に合う
    while(!que.empty()){
        auto p=que.front();que.pop();
        int i=p.first,j=p.second;
        rep(t,4){
            for(int d=1;d<=k;d++){
                int ni=i+d*dx[t],nj=j+d*dy[t];
                if(!check(ni,nj)) break;
                if(dis[i][j]>=dis[ni][nj]) break;
                if(chmin(dis[ni][nj],dis[i][j]+1)) que.push({ni,nj});
            }
        }
    }
    cout<<(dis[gi][gj]==INF?-1:dis[gi][gj])<<endl;
    return 0;
}


Measured memory_bytes: 9440
h, w = map(int, input().split())

def split_into_two(x, y):
    if x % 2 == 0 or y % 2 == 0:
        return x*y//2, x*y//2
    else:
        if x > y:
            x, y = y, x
        return (y//2)*x, (y//2 + 1)*x

ans = h * w
for i in range(1, h//2+2):
    s0 = w*i
    s1, s2 = split_into_two(h - i, w)
    ans = min(ans, max(s0, s1, s2) - min(s0, s1, s2))

for i in range(1, w//2+2):
    s0 = h*i
    s1, s2 = split_into_two(h, w - i)
    ans = min(ans, max(s0, s1, s2) - min(s0, s1, s2))

print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

struct Trie {
  Trie* A[26];
  int B[26];
  Trie() {
    rep(i,26) {A[i] = nullptr;B[i] = 0;}
  }
};

int N;
vector<string> A;string a;

void insertStr(Trie* root, string &s, int i, vector<int> &C) {
  // debug(i);
  if(i == s.size()) {
    // debug(s);
    return;
  }

  if(root->A[s[i]-'a'] == nullptr) {
    root->A[s[i]-'a'] = new Trie();
  }
  insertStr(root->A[s[i]-'a'], s, i+1, C);
  C[s[i]-'a'] = 1;
  rep(j, 26) root->B[j] += C[j];
}

int getPairs(Trie* root, string &s, int i) {
  if(i == s.size() - 1) return root->B[s[i]-'a'];
  if(root->A[s[i]-'a'] == nullptr) return 0;
  return getPairs(root->A[s[i]-'a'], s, i+1);
}

int main() {

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

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 Trie* root = new Trie();
 vector<int> B(26, 0);

 cin>>N;
 rep(i,N) {
   cin>>a;
   reverse(a.begin(), a.end());
   A.pb(a);
 }
 sort(A.begin(), A.end(), [](const string &l, const string &r) {
   return l.size() > r.size();
 });

 ll ans = 0;

 insertStr(root, A[0], 0, B);
 for(int i = 1;i < N;i++) {
    ans += getPairs(root, A[i], 0);
    fill(B.begin(), B.end(), 0);
    insertStr(root, A[i], 0, B);
 }
 cout << ans << endl;


 return 0;
}


Measured memory_bytes: 359488
# coding: utf-8

A, B, T = map(int, input().split())

def biscuit_generator(a, b, t):
    biscuit = 0
    t -= a
    while (t+0.5) > 0:
      biscuit += b
      t -= a

    return biscuit

print(biscuit_generator(A, B, T))


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

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

int main(void) {
	string s;
	cin >> s;
	REP(i,s.size()) cout << 'x';
	cout << endl;
	return 0;
}


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

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

  int N; cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    ans += a - 1;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
 int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int ans=0;
  for(int i=0;i<n;i++){
    while(vec.at(i)%2==0){
      vec.at(i)=vec.at(i)/2;
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    auto getPositions = [&](){
        vector<int> res;
        for(int i=0; i < n && res.size() <k;){
            if(s[i] == 'o') {
                res.push_back(i);
                i += c+1;
            }else{
                ++i;
            }
        }
        return res;
    };

    vector<int> l, r;
    l = getPositions();
    reverse(s.begin(), s.end());
    r = getPositions();
    for(int i=0; i<k; ++i) r[i] = n-1-r[i];
    reverse(s.begin(), s.end());

    //一個前のoの位置を記録
    //left
    vector<int> lastL(n+1, -1);
    for(int i=0; i<k; ++i){
        lastL[ l[i]+1 ] = i;
    }
    for(int i=0; i<n; ++i){
        if(lastL[i+1] == -1){
            lastL[i+1] = lastL[i];
        }
    }
    //right
    vector<int> lastR(n+1, -1);
    for(int i=0; i<k; ++i){
        lastR[ r[i] ] = i;
    }
    for(int i=n-1; i>=0; --i){
        if(lastR[i] == -1){
            lastR[i] = lastR[i] = lastR[i+1];
        }
    }

    for(int i=0; i<n; ++i){
        if(s[i] == 'x') continue;
        int li = lastL[i];
        int ri = lastR[i+1];
        
        int cnt = 0;
        if(li != -1) cnt += li + 1;
        if(ri != -1) cnt += ri + 1;
        if(li != -1 && ri != -1 && r[ri] - l[li] <= c){
            cnt--;
        }
        if(cnt >= k) continue;
        printf("%d\n", i+1);
    }

}


Measured memory_bytes: 6712
import itertools
import math
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in itertools.permutations(xy):
    for j in range(len(i)-1):
        ans += math.sqrt((i[j][0] - i[j+1][0])**2 + (i[j][1] - i[j+1][1])**2)

print(ans/math.factorial(n))

Measured memory_bytes: 40684
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 30;
const int N = (int)3e5 + 7;
const int MAXN = (int)3e6 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e17;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

int n, m, x;
int c[N], a[12][12];
int ans = INF;

void solve() {
	cin >> n >> m >> x;
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	for (int i = 0; i < (1 << n); i++) {
		int cnt[12] = {}, cost = 0;
		for (int j = 0; j < n; j++) {
			int val = i & (1 << j);
			if (val == 0)
				continue;
			cost += c[j];
			for (int k = 0; k < m; k++)
				cnt[k] += a[j][k];
		}
		bool fl = true;
		for (int j = 0; j < m; j++)
			fl &= cnt[j] >= x;
		if (fl)
			uin(ans, cost);
	}
	cout << (ans == INF ? -1 : ans);
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3628
import java.util.*;

// ABC 27-C
// http://abc027.contest.atcoder.jp/tasks/abc027_c
 
public class Main {
	
	static int n;
	static int w;
	static int[] weights;
	static int[] values;
	static HashMap<String, Long> memo;
	
	public static void main (String[] args) throws java.lang.Exception {
		Scanner in = new Scanner(System.in);
		
		n = in.nextInt();
		w = in.nextInt();
		weights = new int[n];
		values = new int[n];
		
		for (int i = 0; i < n; i++) {
			weights[i] = in.nextInt();
			values[i] = in.nextInt();
		}
		memo = new HashMap<String, Long>();
		
		System.out.println(solve2(0, 0));
	}
	
	public static long solve2(int index, long weight) {
		String s = index + "," + weight;
		if (index == n) {
			return 0;
		} else if (memo.containsKey(s)) {
			return memo.get(s);
		}
		
		long temp = solve2(index + 1, weight);
		if (weight + weights[index] <= w) {
			temp = Math.max(temp, values[index] + solve2(index + 1, weight + weights[index]));
		}
		
		memo.put(s, temp);
		return temp;
	}
	
	public static long solve(int index, long weight, long value) {
		String s = index + "," + weight;
		if (w < weight) {
			return Integer.MIN_VALUE;
		} else if (index == n) {
			return value;
		} else if (memo.containsKey(s)) {
			return memo.get(s);
		}
		
		long temp = Math.max(
				solve(index + 1, weight, value),
				solve(index + 1, weight + weights[index], value + values[index])
		);
		memo.put(s, temp);
		
		return temp;
	}
}

Measured memory_bytes: 61916
fun main(args: Array<String>) {
    agc018a()
}

fun agc018a() {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val aSet = readLine()!!.split(" ").map { it.toLong() }.distinct()

    val max = aSet.max()!!
    val gcd = aSet.fold(aSet.first()) { acc, l -> gcd(acc, l) }

    val answer = if (k <= max && k % gcd == 0L) "POSSIBLE" else "IMPOSSIBLE"

    println(answer)
}

private tailrec fun gcd(a: Long, b: Long): Long {
    return if (b == 0L) a else gcd(b, a % b)
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n,m;cin>>n>>m;
	vii l(m);
	int R=1000000,L=0;
	rep(i,m){
		cin>>l[i].F>>l[i].S;
		R=min(R,l[i].S);
		L=max(L,l[i].F);
	}
	if(R-L+1<0)cout<<0<<endl;
	else cout<<R-L+1<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a > b) {
			System.out.println("a > b");
		}else if(a < b) {
			System.out.println("a < b");
		}else {
			System.out.println("a == b");
		}
	}

}



Measured memory_bytes: 26132
process = []
n, q = [int(i) for i in input().split(" ")]
for i in range(n):
    name, time = input().split(" ")
    time = int(time)
    process.append([name, time])

time = 0
while len(process) > 0:
    p = process.pop(0)
    if p[1] <= q:
        time += p[1]
        print(p[0], time)
    else:
        p[1] -= q
        time += q
        process.append(p)



Measured memory_bytes: 13016
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n;
	cin>>n;
	for(ll i=1; i<=n; i++){
		if(i*108/100==n){
			cout<<i;
			return 0;
		}
	}
	cout<<":(";
		
}

Measured memory_bytes: 3588
import sys

n=int(input())
if n<3:
  print(0)
  sys.exit()

m,a,r,c,h = 0,0,0,0,0

for i in range(n):
  s=input()
  s0=s[0]
  
  if s0=="M":
    m+=1
  elif s0=="A":
    a+=1
  elif s0=="R":
    r+=1
  elif s0=="C":
    c+=1
  elif s0=="H":
    h+=1

l=[m,a,r,c,h]


ans=0
for i in range(len(l)):
  for j in range(i+1,len(l)):
    for k in range(j+1,len(l)):
      ans+=l[i]*l[j]*l[k]

print(ans)



Measured memory_bytes: 9172
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<ll> par;
//     vector<ll> siz;
    
//     UnionFind(ll N): par(N), siz(N,1LL) {
//         for (ll i=0;i<N;i++) par[i] = i;
//     }

//     ll root(ll x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//         siz[ry] += siz[rx];
//     }

//     bool same(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         return rx == ry;
//     }

//     ll size(ll x) {
//         return siz[root(x)];
//     }
// };

int main(void) {
    int N;
    cin >> N;
    vector<ll> A(N,0);
    for (int i=0;i<N;i++) cin >> A[i];
    sort(A.begin(), A.end());
    A.erase(unique(A.begin(), A.end()),A.end());

    if (A.size() < N) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
//#include <stdlib.h>
//#include <limits.h>
//#include <math.h>
#include <stdbool.h>

#define N 100001

typedef struct UnionFindTree{
  int size;
} uft;

uft t[N];
int parent[N];
bool boo[N];
int ans = 0;

void init(int n) {
  for (int i=0; i<n; i++) {
    t[i].size = 1;
    parent[i] = i;
    boo[i] = false;
  }
}

int root(int a) {
  if (parent[a] == a) return a;
  else return parent[a] = root(parent[a]);
}

void unite(int a, int b) {
  int ra=root(a), rb=root(b);
  if (ra == rb) return ;
  if (t[ra].size > t[rb].size) {
    parent[rb] = ra;
    t[ra].size += t[rb].size;
  } else {
    parent[ra] = rb;
    t[rb].size += t[ra].size;
  }
  return ;
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  init(n);
  int x, y, z;
  for (int i=0; i<m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    x--;
    y--;
    unite(x, y);
  }
  for (int i=0; i<n; i++) {
    int p = root(i);
    if (boo[p]) continue;
    ans++;
    boo[p] = true;
  }
  printf("%d\n", ans);
  return 0;
}


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

const string YES = "Yes";
const string NO = "No";

int main(void)
{
    int W, H, x, y, r;
    string answer = YES;
    cin >> W >> H >> x >> y >> r;
    if(x - r < 0) answer = NO;
    if(y - r < 0) answer = NO;
    if(W < x + r) answer = NO;
    if(H < y + r) answer = NO;

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;

 
void solve(){
	string s;
    cin>>s;
    set<char>ss;
    rep(i,26)ss.insert('a'+i);
    if(s.size()!=26){
        rep(i,s.size()){
            ss.erase(s[i]);
        }
        s+=*ss.begin();
        cout<<s<<"\n";
    }
    else {
        int memo=-1;
        set<char>t;
        for(int i=s.size()-2;i>=0;--i){
            if(s[i]<s[i+1]){
                memo=i;
                break;
            }
            //後ろから見て、降順となっているところは変更不可
        }
        if(memo==-1){
            cout<<-1<<"\n";
            return ;
        }
        else {
            set<char>sss;
            rep(i,memo+1)sss.insert(s[i]);
            s[memo]++;
            while(sss.count(s[memo]))s[memo]++;
            string t="";
            rep(i,memo+1)t+=s[i];
            cout<<t<<"\n";
        }
    }
}
 
signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 256
lst = []
time = 0
for i in range(5):
    t = input()
    if int(t[-1]) == 0:
        lst.append([int(t), 9])
    else:
        lst.append([int(t), int(t[-1])])
l = sorted(lst, key = lambda lst:lst[1])
for i in range(5):
    if i == 0:
        time += l[i][0]
    else:
        time += l[i][0]//10 * 10
        if l[i][0]%10 != 0:
            time += 10
print(time)

Measured memory_bytes: 3064
while True:
    try:
        n, k = map(int, input().split())
        ans = 0
        for num in range(1, n+1):
            count = 0
            while True:
                if num >= k:
                    break
                else:
                    num *= 2
                    count += 1
            ans += 1 / 2**count
        print(ans/n)
    except:
        break

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

int main() {
	int n, x; cin >> n >> x;
	vector<int>a(n); for (auto&& xx : a)cin >> xx;
	long long ans = 0;
	if (a[0] > x) { long long dif = a[0] - x; a[0] -= dif; ans += dif; }
	for (int i = 0; i < n - 1; i++) {
		if (a[i] + a[i + 1] > x) {
			long long dif = a[i] + a[i + 1] - x;
			ans += dif; a[i + 1] -= dif;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
d=deque(list(e.split())for e in s[1:])
t=0
while d:
 k,v=d.popleft();v=int(v)
 if v>q:v-=q;t+=q;d.append([k,v])
 else:t+=v;print(k,t)


Measured memory_bytes: 18124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct line{
    ll a, b;
    line(ll aa, ll bb){a = aa; b = bb;}
    line(){}
    ll get(ll x){return a*x + b;}
};

int left(int u){return (u << 1);}
int right(int u){return (u << 1) + 1;}

ll v[1000005], dp[1000005];
line tree[4000005];

void update(int u, int L, int R, line aux){
    ll a = aux.get(L);
    ll b = tree[u].get(L);
    ll c = aux.get(R);
    ll d = tree[u].get(R);
    if(a <= b and c <= d){ //aux is better than the tree[u] in the whole interval [L,R]
        tree[u] = aux;
        return;
    }
    if(a >= b and c >= d) //aux is worse than the tree[u] in the whole interval [L,R]
        return;
    // we will update at max O(log n) intervals
    // because, if the best interval for the aux line is some interval [x, y]
    // then we know by definition from segtree that we can break the interval [x, y]
    // into O(log n) nodes and update those nodes
    int mid = (L+R)/2;
    update(left(u), L, mid, aux);
    update(right(u), mid+1, R, aux);
}

ll query(int u, int L, int R, int pos){
    ll res = tree[u].get(pos);
    if(L == R) return res;
    int mid = (L+R)/2;
    if(pos <= mid) res = min(res, query(left(u), L, mid, pos));
    else           res = min(res, query(right(u), mid+1, R, pos));
    return res;
}

int main(){

    ll n, k; cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    for(int i = 1; i <= 4*n; i++)
        tree[i] = line(0, 1e18);
    
    
    update(1, 1, n, line(-2*v[1], v[1]*v[1]));
    for(int i = 2; i <= n; i++){
        // for every j < i
        // dp[i] = min(dp[i], EQ)
        // EQ = dp[j] + (v[i] - v[j])² + k
        // EQ = dp[j] + k + v[i]² -2.v[i].v[j] + v[j]²
        // EQ = v[i]² + k + (-2.v[j].v[i] + v[j]² + dp[j])
        // (-2.v[j].v[i] + v[j]² + dp[j]) is the equation of
        //      a line Y = -2.v[j] + v[j]² + dp[j] evaluated at point v[i]
        //      see that Y(v[i]) = -2.v[j].v[i] + v[j]² + dp[j]
        // we want to find the line that evaluates the minium at point v[i]
        ll val = query(1, 1, 1e6, v[i]);
        dp[i] = v[i]*v[i] + k + val;
        line aux(-2*v[i], v[i]*v[i] + dp[i]);
        update(1, 1, 1e6, aux);
    }
    cout << dp[n] << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int v[n],c[n];
  for(int i = 0; i < n; i++){
      cin >> v[i];
  }
  for(int i = 0; i < n; i++){
      cin >> c[i];
  }
  int ans=0;
  for(int i = 0; i < n; i++){
    if(v[i] - c[i] > 0){
      ans += v[i] - c[i];
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
signed main(){
    //freopen("in","r",stdin);
    long long int a,b;
    int count1=0;
    int count2=0;
    long long int n;
    cin>>n;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0){
            a=i;
            b=n/i;
        }
    }
    for(;a>0;a/=10)
        count1++;
    for(;b>0;b/=10)
        count2++;
    cout<<max(count1,count2);
    return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        BigDecimal bd1 = BigDecimal.valueOf(b / x).setScale(0, BigDecimal.ROUND_DOWN);
        BigDecimal bd2 = BigDecimal.valueOf(a / x).setScale(0, BigDecimal.ROUND_DOWN);
        int add = 0;
        if (a % x == 0) {
            add = 1;

        }
        System.out.println(bd1.subtract(bd2).longValue() + add);
    }
}

Measured memory_bytes: 22868
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORN(i, n, s) for (int i = s; i < n; i++)
#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;
#define PACK(a, n) \
  for (int i = 0; i < n; i++) cin >> a[i];
#define PACKN(a, n, s) \
  for (int i = s; i < n; i++) cin >> a[i];
#define LIST(a, n) \
  for (int i = 0; i < n; i++) cout << "[" << i << "] " << a[i] << endl;

using namespace std;

int N;

int main() {
  IN(N);
  OUT(floor(N / 3));
  return 0;
}

Measured memory_bytes: 256
n = int(input())
lst1 = [0] + list(map(int, input().split()))# + [0]
lst0 = []
for i in range(n):
  if lst1[i] != lst1[i + 1]:
    lst0.append(lst1[i + 1])
lst0.append(0)
#print(n)
if lst0[0] < lst0[1]:
  phase = 'u'
else:
  phase = 'd'
lst0 = [10000] + lst0
#print(lst0)
n = len(lst0)
lst2 = []
for i in range(n - 2):
  if lst0[i] < lst0[i + 1] and lst0[i + 1] > lst0[i + 2]:
    lst2.append(lst0[i + 1])
  elif lst0[i] > lst0[i + 1] and lst0[i + 1] < lst0[i + 2]:
    lst2.append(lst0[i + 1])
#print(lst2)
kane = 1000
kabu = 0
for i in range(len(lst2)):
  if i % 2 == 0:
    x = kane // lst2[i]
    kane %= lst2[i]
    kabu += x
  else:
    kane += (lst2[i] * kabu)
    kabu = 0
print(kane)

Measured memory_bytes: 9292
/*
    给n个s,m个c,两个c组成一个s,最多组成几个scc.
    先利用s组成scc,再利用剩下的c组成
    注意数据范围
*/
#include<cstdio>
using namespace std;
typedef long long ll;
int main(){
    ll n, m, ans = 0;
    scanf("%lld%lld", &n, &m);
    if(2*n<=m){
        ans += n;
        m -= 2*n;
        ans += m / 4;
    }else{
        ans += m/2;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 128
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
B = LIST()
C = LIST()

A.sort()
B.sort()
C.sort()

ans = 0
for i in range(N):
	ans += bisect_left(A, B[i]) * (N - bisect(C, B[i]))

print(ans)



Measured memory_bytes: 32416
{-# LANGUAGE BangPatterns, FlexibleContexts #-}

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Array
import Data.Array.ST
import Data.List
import Debug.Trace (traceShow, traceShowM)
import qualified Data.ByteString.Char8 as B

readi b | Just (n, _) <- B.readInt b = n

main :: IO ()
main = do
    x <- readLn :: IO Int
    case x of
        7 -> putStrLn "YES"
        5 -> putStrLn "YES"
        3 -> putStrLn "YES"
        _ -> putStrLn "NO"

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

int main() {
  int N;
  scanf("%d", &N);
  int a[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a[i]);
  }

  long long b[N];
  for (int i = 0; i < N; ++i){
    b[i] = a[i]-i;
  }

  sort(b,b+N);
  
  long long med;
  if(N%2==0) med = (b[N/2-1]+b[(N/2)])/2;
  else med = b[(N+1)/2-1];

  long long ans = 0;
  for (int i = 0; i < N; ++i){
    ans += abs(b[i]-med);
  }

  cout << ans << endl;

}



Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;
#define REP(i,n) for(int i = 0;i < n;i++)
#define INF 100000000
typedef long long ll;

ll d[110][110];
int V;
int N,M,L,K,A,H;
bool cold[110];

void WF()
{
	REP(k,N)REP(i,N)REP(j,N)
	d[i][j] = min(d[i][j] , d[i][k] + d[k][j]);
}

int main()
{
	while(cin >> N >> M >> L >> K >> A >> H, N)
	{
		REP(i,110)REP(j,110)d[i][j] = INF;
		REP(i,110)cold[i] = false;
		
		cold[A] = cold[H] = true;
		int tmp;
		REP(i,L) {cin >> tmp; cold[tmp] = true;}
		
		REP(i,K)
		{
			int a,b,l;
			cin >> a >> b >> l;
			d[a][b] = d [b][a] = l;
		}
		
		WF();
		REP(i,N)REP(j,N)
		{
			if(!(cold[i] & cold[j]) || d[i][j] > M)
			{
				d[i][j] = INF;
			}
		}
		
		WF();
		
		if(d[A][H] >= INF)
		{
			cout << "Help!" << endl;
		}
		else
		{
			if(d[A][H] > M)
			{
				cout << d[A][H]*2 - M << endl;
			}
			else
			{
				cout << d[A][H] << endl;
			}
		}
	}
	
	return 0;
	

}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX =  2e5+5;
int N, M, p[MAX], w[MAX];

int find(int a) { return (p[a] == a) ? a : p[a] = find(p[a]); }

int main(int argc, char ** argv) {
	int u, v, ans = 1;
	rep(i, 0, MAX) p[i] = i;
	rep(i, 0, MAX) w[i] = 1;
	scanf("%d%d", &N, &M);
	rep(i, 0, M) {
		scanf("%d%d", &u, &v);
		if((u = find(u)) != (v = find(v))) {
			w[u] = w[v] = (w[u]+w[v]);
			ans = max(ans, w[u]);
			p[u] = v;
		}
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 5400
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;

signed main() {
    vll n(2);
    cin >> n[0] >> n[1];
    
    Sort(n);
    
    if (n[0] == 1 && n[1] == 1) {
        mes(1);
        re0;
    }
    if (n[0] == 1) {
        mes(n[1]-2);
        re0;
    }
    
    mes((n[0]-2) * (n[1]-2));
    
    
    
    
    

}
    
    
    
    
    


Measured memory_bytes: 3588
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn solve(i: usize, sum: usize, len: usize, s: &String) -> usize {
    if i == len {
        sum
    } else {
        let mut r = 0;
        for j in i+1 .. len+1 {
            r += solve(j, sum + s[i..j].parse::<usize>().unwrap(), len, s);
        }
        r
    }
}

fn main() {
    let s = get!(String);
    println!("{}", solve(0, 0, s.len(), &s));
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <math.h>
int
main (void)
{
  int n = 1000000;
  int i,j;
  int *list;
  list = (int *) calloc (sizeof (int), n + 1);
  list[0] = list[1] = 0;
  for (i = 2; i <= sqrt (n); i++)
    {
      if (list[i] == 0)
	{
	  for (j = i + 1; j <= n; j++)
	    if (j % i == 0)
	      list[j] = -1;
	}
      else
	continue;
    }
  while (scanf ("%d", &n) != EOF)
    {
      list[0] = 0;
      for (i = 2; i <= n; i++)
	if (list[i] == 0)
	  list[0]++;
      printf ("%d\n", list[0]);
    }
  free (list);
  return 0;
}

Measured memory_bytes: 4256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define pb push_back
#define ll long long
#define vi vector<long long>
#define pi pair<long long, long long>
#define mp make_pair
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e18;
const ll N = (1<<5);
const double PI = 3.1415926535897;

ll n;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("C.txt", "r", stdin);
    #endif
    cin >> n;
    for(ll i = sqrt(n); i>0; i--){
        if(n%i==0){
            cout << i + n/i - 2;
            return 0;
        }
    }
}




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

int main() {
  long long N,K,i,j,k,l,m;
  cin >> N >> K;
  long long x[N],y[N];
  for(i=0;i<N;i++) cin >> x[i] >> y[i];
  long long area = -1;
  for(i=0;i<N;i++) {
    for(j=i;j<N;j++) {
      for(k=0;k<N;k++) {
	for(l=k;l<N;l++) {
		int ans = 0;
		for(m=0;m<N;m++) {
			if(x[m]>=min(x[i],x[j])&&x[m]<=max(x[i],x[j])&&y[m]>=min(y[k],y[l])&&y[m]<=max(y[k],y[l])) ans+=1;
		}
		if (ans>=K) {
		  if (area==-1) area = abs((x[i]-x[j])*(y[k]-y[l]));
		  else area = min(area,abs((x[i]-x[j])*(y[k]-y[l])));
		}
	}
      }
    }
  }
  cout << area << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    FAST
    string s;
    cin>>s;
    int a=0,z=0;
    int len=s.length();
    for(int i=0;i<len;i++){
       a++;
       if(s[i]=='A')break;
    }    
    for(int i=0;i<len;i++){
       z++;
       if(s[len-i-1]=='Z')break;
    }
    cout<<len-z+2-a;
    
    return 0;
}

Measured memory_bytes: 720
MOD = 1_000_000_007

nn,mm = gets.chomp.split(' ').map(&:to_i)

a = []
0.step(mm-1) do |i|
  k = gets.chomp.to_i
  a[k] = 1
end

dp = []

dp[0] = 1
dp[1] = a[1] ? 0 : dp[0]

2.step(nn) do |i|
  dp[i] = a[i] ? 0 : (dp[i-1] + dp[i-2])%MOD
end

p dp[nn]


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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, n);
  int sn = 0;
  for (int i = n; i > 0; i /= 10) sn += i % 10;
  wt(n % sn == 0 ? "Yes" : "No");
}


Measured memory_bytes: 3624
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

f s = f' 0 0 s
  where
    f' j i (x:xs@('O':'I':_)) = if x=='J' then f' (j+1) i xs else if x=='I' then f' j (i+1) xs else f' j i xs
    f' j i (_:xs) = f' j i xs
    f' j i [] = [j, i]

main = getContents >>= mapM_ (mapM_ print) . map f . lines

Measured memory_bytes: 4124
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

ri()
a = rl()
d = collections.Counter(a)
ans = 0
for k, v in d.items():
    if k <= v:
        ans += (v-k)
    else:
        ans += v
print(ans)
















Measured memory_bytes: 39428
dp = {}

n = int(input())
h = [int(x) for x in input().split()]

dp[0] = 0
dp[1] = abs(h[1] - h[0])

for x in range(2, n):
  dp[x] = min(
    dp[x - 1] + abs(h[x] - h[x - 1]),
    dp[x - 2] + abs(h[x] - h[x - 2])
  )

print(dp[n-1])

Measured memory_bytes: 23148