akhauriyash/Code-Regression huggingface dataset:
var R = mutableListOf<String>()
fun main(args: Array<String>) {
    val N = nextInt()
    val P = listOfInt().joinToString(separator = "")
    val Q = listOfInt().joinToString(separator = "")
    var A = mutableListOf<Int>()
    for (n in 1..N) A.add(n)
    permutation(A.toIntArray())
    var p = 0
    var q = 0
    for (a in R) {
        if (a == P) break;
        p += 1
    }
    for (a in R) {
        if (a == Q) break;
        q += 1
    }
    println(Math.abs(p - q))
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun permutation(seed: IntArray) {
    val perm = IntArray(seed.size)
    val used = BooleanArray(seed.size)
    buildPerm(seed, perm, used, 0)
}
fun buildPerm(seed: IntArray, perm: IntArray, used: BooleanArray, index: Int) {
    if (index == seed.size) {
        procPerm(perm)
        return
    }
    for (i in seed.indices) {
        if (used[i]) continue
        perm[index] = seed[i]
        used[i] = true
        buildPerm(seed, perm, used, index + 1)
        used[i] = false
    }
}
fun procPerm(perm: IntArray) {
    R.add(perm.joinToString(separator = ""))
}

Measured memory_bytes: 45232
#include <bits/stdc++.h>
using namespace std;
int N, M, a, b;
int main() {
	cin>>N>>M;
    vector<int> vec(51);
	for(int i=1; i<M+1; i++) {
      cin>>a>>b;
      vec.at(a) += 1;
      vec.at(b) += 1;
    }
  for(int i=1; i<N+1; i++) {
    cout<< vec.at(i) <<endl;}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int h,w;

    cin >> h >> w;

    while((h!=0)||(w!=0)){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if((i+j)%2==0)
                    cout <<'#';
                else
                    cout <<'.';
            }
            cout<<endl;
        }
        cout<<endl;
        cin >> h >> w;
    }


    return 0;
}



Measured memory_bytes: 3112
def main():
    from collections import defaultdict
    import sys
    # functions used
    r = lambda: sys.stdin.readline().strip()
    R = lambda: list(map(int, r().split()))

    N = int(r())
    Dic = defaultdict(list)
    V = 10**5 + 5
    Arrived = [False] * (2 * V)
    for _ in range(N):
        x, y = R()
        y += V
        Dic[x].append(y)
        Dic[y].append(x)

    ans = 0
    task = []
    for k, v in Dic.items():
        if Arrived[k]:
            continue
        Arrived[k] = True
        if k < V:
            cntx = 1
            cnty = 0
        else:
            cntx = 0
            cnty = 1
        cntdot = 0
        task.extend(v)
        cntdot += len(v)
        while task:
            s = task.pop()
            if Arrived[s]:
                continue
            if s < V:
                cntx += 1
            else:
                cnty += 1
            Arrived[s] = True
            task.extend(Dic[s])
            cntdot += len(Dic[s])
        ans += cntx * cnty - cntdot // 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 32012
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mod 1000000007
#define mk make_pair
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<vector<ll>> v;
    int n,k;
    cin>>n>>k;
    v.resize(n+1);
    for(int i=0;i<=n;i++)
    v[i].resize(k+1);
    ll a[n+1]={0};
    for(int i=1;i<=n;i++)
    cin>>a[i];
    for(int i=0;i<=n;i++)
    v[i][0]=1;
    for(int i=0;i<=k;i++)
    v[0][i]=1;
    ll b[k+1]={0};b[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i==1)
            {
                 if(j<=a[1])
                 v[i][j]=1;
            }
            else
            {
           
            b[j]=(b[j-1]+v[i-1][j])%mod;//cout<<b[j]<<" ";
            if(a[i]>j)
            v[i][j]=b[j];
            else if(a[i]<j)
           { v[i][j]=(b[j]-b[j-a[i]-1]);
               if(v[i][j]<0)
               v[i][j]+=mod;
           }
           else
           {
               v[i][j]=b[j];
           }
            }//cout<<v[i][j]<<" ";
        }//cout<<endl;
    }
    cout<<v[n][k]%mod;
    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

ull modpow(ll n,ll r){
  ll res = 1;
  while(r){
    if(r & 1)res = res*n%MOD;
    n = n*n %MOD;
    r >>= 1;
  }
  return res;
}

int main(){
  
  string s;
  cin >> s;
  ull res = 0,cnt = 0;
  int n = s.size();
  rep(i,n){
    if(s[i] == '1'){
      (res += modpow(3,n-i-1)*modpow(2,cnt))%=MOD;
      cnt++;
    }
  }
  (res += modpow(2,cnt))%=MOD;
  cout << res << endl;


  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#define N 1000000
 
typedef struct node{
  int p;
  int right;
  int left;
}Node;
 
 
int main(){
   
  int n,i,j,l,c,k,id,P,depth,r;
  Node a[N],tmp;
   
  scanf("%d",&n);
   
  for(i=0;i<n;i++){
    a[i].p = -1;
    a[i].right = -1;
    a[i].left = -1;
  }
   
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
     
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0) a[id].left = c;
      else a[r].right = c;
      a[c].p = id;
      r=c;
    }
  }
   
  for(i=0;i<n;i++){
    depth = 0;
    P = a[i].p;
     
    while(P != -1){
      P = a[P].p;
      depth++;
    }
     
    if(a[i].p == -1){
      printf("node %d: parent = %d, depth = %d, root, [",
       i,a[i].p,depth);
    }
    else if(a[i].left == -1) printf("node %d: parent = %d, depth = %d, leaf, [",i,a[i].p,depth);
    else printf("node %d: parent = %d, depth = %d, internal node, [",i,a[i].p,depth);
     
    P = a[i].left;
    if(P != -1) printf("%d",P);
     
    while(P != -1){
      P = a[P].right;
      if(P != -1) printf(", %d",P);
    }
    printf("]\n");
  }
 
  return 0;
}

Measured memory_bytes: 3856
#include<iostream>

using namespace std;

int main() {
	int A, B, X;	cin >> A >> B >> X;

	if (A > X) {
		cout << "NO" << endl;
		return 0;
	}
	else if (A + B < X) {
		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

const int MAX = 1e3 + 5;
int id[MAX][MAX];
char arr[MAX][MAX];
bool vis[MAX][MAX];

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
void flood(int x, int y, int n, int m, int cnt)
{
    if(x <= 0 || y <= 0 || x > n || y > m || arr[x][y] == '#' || vis[x][y]) return;
    vis[x][y] = 1;
    id[x][y] = cnt;
    
    for(int i = 0; i < 4; i++)
    flood(x + dx[i], y + dy[i], n, m, cnt);
}
int main()
{
	boost;
	int n, m, i, j, i1, j1;
	cin >> n >> m;
	
	int ch, cw;
	cin >> ch >> cw;
	
	int dh, dw;
	cin >> dh >> dw;
	
	foe(i, 1, n) {
	    foe(j, 1, m)
	    cin >> arr[i][j];
	}
	
	int cnt = 0;
	foe(i, 1, n) {
	    foe(j, 1, m) {
	        if(arr[i][j] == '#' || vis[i][j]) continue;
	        ++cnt;
	        flood(i, j, n, m, cnt);
	    }
	}
	
	vector <int> adj[cnt + 1];
	foe(i, 1, n) {
	    foe(j, 1, m) {
	        if(arr[i][j] == '#') continue;
	        
	        foe(i1, max(1, i - 2), min(n, i + 2)) {
	            foe(j1, max(1, j - 2), min(m, j + 2)) {
	                if(arr[i1][j1] == '#' || id[i1][j1] == id[i][j]) continue;
	                int x = id[i][j], y = id[i1][j1];
	                adj[x].pb(y);
	                adj[y].pb(x);
	            }
	        }
	    }
	}
	
	int st = id[ch][cw], en = id[dh][dw];
	bool vs[cnt + 1];
	int dist[cnt + 1];
	fill(dist, dist + cnt + 1, inf);
	memset(vs, 0, sizeof vs);
	
	queue <int> q;
	dist[st] = 0;
	q.push(st);
	vs[st] = 1;
	
	while(!q.empty()) {
	    int p = q.front();
	    q.pop();
	    
	    for(int v : adj[p]) {
	        if(!vs[v]) {
	            vs[v] = 1;
	            dist[v] = dist[p] + 1;
	            q.push(v);
	        }
	    }
	}
	cout << (dist[en] == inf ? -1 : dist[en]);
}


Measured memory_bytes: 33232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int k,x; cin >> k >> x;
    for(int i = x-k+1;i < x+k;i++){
        cout << i << " ";
    }
}


Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
using namespace std;
double ans;
int ori[22],a[22],n;
void dfs(int i,double maxr)
{
    if (i==n){ans=maxr; return;}
    int add,sub,now=a[i];
    if (a[i]>a[i-1])
    {
        add=a[i-1]-now%a[i-1];
        sub=a[i]%a[i-1];
        while (true)
        {
            a[i]=now-sub;
            if (double(sub)/(double)ori[i] > ans || a[i]<a[i-1])break;
            dfs(i+1,max(maxr,double(sub)/(double)ori[i]));
            sub+=a[i-1];
        }
    }
    else add=a[i-1]-a[i];
    while (true)
    {
        a[i]=now+add;
        if ((double)add/(double)ori[i] > ans)break;
        dfs(i+1,max(maxr,(double)add/(double)ori[i]));
        add+=a[i-1];
    }
    a[i]=now;
}
void solve()
{
    ans=1e18;
    dfs(1,0);
    int add=1;
    double radio;
    while (true)
    {
        radio=(double)add/(double)ori[0];
        if (radio>ans)break;
        a[0]=ori[0]+add;
        dfs(1,radio);
        a[0]=ori[0]-add;
        dfs(1,radio);
        add++;
    }
}
int main()
{
    while (scanf("%d",&n)!=EOF)
    {
        for (int i=0;i<n;i++)
        {
            scanf("%d",&ori[i]);
            a[i]=ori[i];
        }
        solve();
        printf("%.10lf\n",ans);
    }
    return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e6 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 2e5 + 17;

int n, m;
vector<int> g[maxn];
vector< pair<int, int> > e;
bool used[maxn];

bool read() {
    if (scanf("%d %d", &n, &m) != 2)
        return false;

    forn (i, m) {
        int a, b;
        scanf("%d %d", &a, &b);
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
        e.push_back(make_pair(a, b));
    }

    return true;
}

int A, B;

void dfs(int v) {
    used[v] = true;

    for (auto to : g[v])
        if (!(v == A && to == B) && !(v == B && to == A) && !used[to])
            dfs(to);
}

void solve() {
    int ans = 0;

    for (auto ee : e) {
        A = ee.first - 1;
        B = ee.second - 1;
        fill(used, used + n, false);
        dfs(0);

        if (count(used, used + n, true) != n)
            ++ans;
    }

    cout << ans << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}

Measured memory_bytes: 6144
#include <stdio.h>
int main()
{
	char str[1001], meirei[10], p[1001], c;
	int q, i, j, k, a, b;
	scanf("%s", str);
	scanf("%d", &q);
	for(i=0; i<q; i++){
		scanf("%s", meirei);
		if(strcmp(meirei, "print")==0){
			scanf("%d %d", &a, &b);
			for(j=a; j<b+1; j++){
			printf("%c", str[j]);
			}
			printf("\n");
		} else if(strcmp(meirei, "reverse")==0){
			scanf("%d %d", &a, &b);
			for(j=0; j<b-a; j++){
				for(k=b-j; k>a; k--){
					c=str[a];
					str[a]=str[k];
					str[k]=c;
				}
			}
		} else if(strcmp(meirei, "replace")==0){
			scanf("%d %d %s", &a, &b, p);
			for(j=0; j<b-a+1; j++){
				c=str[a+j];
				str[a+j]=p[j];
			}
		}
	}
	return 0;
}

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

#define ll long long
#define ull unsigned long long

int n, ar[101];

void solve() {
    cin >> n;
    for(int i=1; i<=n; ++i)
        cin >> ar[i];
    int ans=0;
    for(int i=1; i<=n; i+=2) {
        if(ar[i]%2!=0)
            ans++;
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

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

struct p{
	long long x,y,idx;
	unsigned long long sqrdist(p b){
		return (x-b.x)*(x-b.x)+(y-b.y)*(y-b.y);
	}
	void read(){
		cin >> x >> y;
	}
	long long operator *(p b){
		return x*b.y - y*b.x;
	}
	bool operator ==(p b){
		return x == b.x && y == b.y;
	}
	void operator -=(p b){
		x -= b.x,y -= b.y;
	}
	bool operator >=(p b){
		return x >= b.x && y >= b.y;
	}
	bool operator <=(p b){
		return x <= b.x && y <= b.y;
	}
	p operator -(p b){
		return {x-b.x,y-b.y};
	}
	long long crossprod(p a , p b){
		a.x -= x , b.x -= x , a.y -= y , b.y -= y;
		return a*b;
	}
};

struct segment{
	p p1,p2;
	void equal(p a , p b){
		p1 = a , p2 = b;
	}
	void readseg(){
		p1.read(),p2.read();
	}
};

bool comp(p a , p b){
	return a.y < b.y;
	//
}

void convexhull(vector<p> v , vector<p> c){
	sort(v.begin(),v.end(),comp);
	for(long long q = 0 ; q < 2 ; q += 1){
		vector<p> g;
		g.push_back(v[0]);
		for(long long i = 1 ; i < v.size() ; i += 1){
			while(g.size() >= 2 && ((v[i] - g[g.size()-2])*(g.back() - g[g.size()-2]) <= 0)){
				g.pop_back();
			}
			g.push_back(v[i]);
		}
		if(q == 0){
			g.pop_back();
		}
		for(p i : g){
			c.push_back(i);
		}
		reverse(v.begin(),v.end());
	}
}

bool intersect(segment a , segment b){
	for(long long i = 0 ; i < 2 ; i += 1){
		p p1 = a.p1;
		long long v1 = (b.p1 - p1)*(a.p2 - p1) , v2 = (b.p2 - p1)*(a.p2 - p1);
		if(v1 * v2 > 0){
			return false;
		}else if(v1 == 0 && v2 == 0){
			if(max(a.p1.x,a.p2.x) < min(b.p1.x,b.p2.x) || max(a.p1.y,a.p2.y) < min(b.p1.y,b.p2.y)){
				return false;
			}
		}
		swap(a,b);
	}
	return true;
}

bool equal(vector<p> a , vector<p> b){
	if(a.size() != b.size()){
		return false;
	}
	for(long long i = 0 ; i < a.size() ; i += 1){
		if(a[i] == b[i]){
			continue;
		}
		return false;
	}
	return true;
}

int main(){
	char a;
	cin >> a;
	a += 1;
	cout << a;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;
 
const int mod=1000000007;
const int inf=1000000009;
 
typedef double db;
typedef long long ll;
typedef vector<int> VI;
typedef unsigned int uint;
typedef pair<int,int> pii;
 
int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}
 
const int N=515;
char s[N][N]; int n,Min=inf,l,ok[N],flag,Ans;
 
int main() {
	n=rd();
	For (i,1,n) {
		scanf("%s",s[i]+1);
		For (j,1,n) if (s[i][j]=='#') ok[j]=1;
	}
	For (i,1,n) {
		l=0;
		For (j,1,n) if (s[i][j]=='#') l++;
		if (l) Min=min(Min,n-l+1-ok[i]); 
	}
	if (Min==inf) return puts("-1"),0;
	
	Ans+=Min;
	For (j,1,n) {
		flag=0;
		For (i,1,n) if (s[i][j]!='#')
			{ flag=1; break; }
		Ans+=flag;
	}
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;


int main()
{
	const int MAX_N = 100000;
	int n, m;
	cin >> n >> m;
	int a[MAX_N] = {};
	priority_queue<long long> queueA;

	for (int i = 0; i < n; i++)
	{	
		int temp;
		cin >> temp;
		queueA.push(temp);
	}

	// 一番高いものから順々にチケットを使っていく
	for (int i = 0; i < m; i++)
	{
		int highest = queueA.top();
		queueA.pop();
		queueA.push(highest / 2);
	}

	// 合計の値段を計算
	long long sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += (long long)queueA.top();
		queueA.pop();
	}

	cout << sum;

	return 0;

}



Measured memory_bytes: 1400
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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

A, B, C = MAP()
if (A == B):
    print(C)
elif (A == C):
    print(B)
else:
    print(A)


Measured memory_bytes: 27216
#include <iostream>
using namespace std;
#define ll long long

ll n;
int main(){
    cin >> n;
    ll ans = n*(n+1)*(n+2);
    ans/=6;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin >> a>> b;
        ll sub =0;
        if(a>b){
            sub = (n+1-a)*(b);
        }
        else{
            sub = (n+1-b)*(a);
        }
        ans-=sub;
    }


    cout << ans << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i += 2) {
        cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 592
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n'
#define no cout<<"No"<<'\n'
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l;
    string s;
    cin>>s;

 cout<<s.substr(0,3)<<endl;




    return 0;
}





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

using namespace std;

struct I{I(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<VVV> VVVV;
typedef tuple<int,int> P;
typedef vector<P> VP;
typedef vector<VP> VVP;
int isLC(char c){
    if('a'<=c&&c<='z')return c-'a';
    else return -1;
}
int isUC(char c){
    if('A'<=c&&c<='Z')return c-'A';
    else return -2;
}
bool inner(int lb,int c,int ub){
    return lb<=c&&c<=ub;
}
int f(int rbg,int red,int cbg,int ced,vector<string>& s,VVVV &memo,VVP&U){
    if(memo[rbg][cbg][red][ced]!=-2)return memo[rbg][cbg][red][ced];
    //cout<<cbg<<" "<<ced<<endl;
    int R=1+red-rbg;
    int C=1+ced-cbg;
    VV dp(R,V(C,-1));
    dp[0][0]=0;
    int x=isLC(s[rbg][cbg]);
    int y=isUC(s[red][ced]);
    if(x==y){
        s[rbg][cbg]='.';
        s[red][ced]='.';
        dp[0][0]++;
    }
    for(int r=rbg;r<=red;r++){
        for(int c=cbg;c<=ced;c++){
            int i=r-rbg;
            int j=c-cbg;
            if(dp[i][j]==-1)continue;
            int id=isLC(s[r][c]);
            if(id>=0){
                for(auto &it:U[id]){
                    int nr,nc;
                    tie(nr,nc)=it;
                    if(inner(r,nr,red)&&inner(c,nc,ced)&&isLC(s[r][c])==isUC(s[nr][nc])){
                        int val=f(r,nr,c,nc,s,memo,U);
                        int ni=nr-rbg;
                        int nj=nc-cbg;
                        if(val!=-1)
                            dp[ni][nj]=max(dp[ni][nj],dp[i][j]+val);
                    }
                }            
            }
            if(r!=red&&s[r+1][c]!='#')dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
            if(c!=ced&&s[r][c+1]!='#')dp[i][j+1]=max(dp[i][j+1],dp[i][j]);
        }     
    }
    if(x==y){
        s[rbg][cbg]=x+'a';
        s[red][ced]=y+'A';
    }
    //cout<<rbg<<" "<<red<<" "<<dp[R-1][C-1]<<endl;
    return memo[rbg][cbg][red][ced]=dp[R-1][C-1];
}


int main(){
    for(int R,C;cin>>R>>C,R+C;){
        vector<string> s(R);
        for(auto &it:s)cin>>it;
        VVP uc(26);
        for(int i=0;i<R;i++)
            for(int j=0;j<C;j++){
                int id=isUC(s[i][j]);
                if(id>=0)uc[id].push_back(P(i,j));
            }
        VVVV memo(R,VVV(C,VV(R,V(C,-2))));
        cout<<f(0,R-1,0,C-1,s,memo,uc)<<endl;

    }

    return 0;
}

Measured memory_bytes: 32056
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 1e6+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

bool fl[N];

void solve(){
    int n; cin>>n;
    map<int, int> m;
    For(i, 0, n){
        int a; cin>>a;
        fl[a]=true;
        m[a]++;
    }
    int ans = 0;
    for(pii p: m){
        if(p.S == 0)
            continue;
        if(p.S == 1)
            ans++;
        for(int i=(p.F)*2; i<=N; i+=p.F){
            if(fl[i]){
                fl[i]=false;
                m[i]=0;
            }
        }
    }
    cout<<ans;
}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 16308
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> s;

	map<char, int> ma;

	n  = s.size();

	rep(i, n){
		ma[s[i]] += 1;
	}

	f = 1;
	rep(i, n){
		if(ma[s[i]] % 2 != 0){
			f = 0;
			break;
		}
	}
	if(f == 1) cout << "Yes" << endl;
	else cout << "No" << endl; 
}

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

using namespace std;
typedef long long ll;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;


int main(){
    int b1,b2;
    char c;
    unsigned long long a;
    cin>>a>>b1>>c>>b2;

    cout<<(unsigned long long)((a*(b1*100+b2))/100);
}



Measured memory_bytes: 3592
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int h1,h2,k1,k2,a,b,c,d,x,y,x1,x2,y1,y2;
	cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;
	x1=h1*a;
	x2=k1*a;
	y1=h2*b;
	y2=k2*b;
	h1=h1/10*c+x1;
	h2=h2/20*d+y1;
	k1=k1/10*c+x2;
	k2=k2/20*d+y2;
	x=h1+h2;
	y=k1+k2;
	if(x>y) cout<<"hiroshi"<<endl;
	else if(x<y) cout<<"kenjiro"<<endl;
	else cout<<"even"<<endl;
	
	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <unordered_map>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MOD 1000000007
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;


int main() {
	int n;
	scanf("%d", &n);
	vector<int> suki(n+1);
	REP(i, n) {
		scanf("%d", &suki[i]);
		suki[i]--;
	}
	int cou = 0;
	REP(i, n) {
		if (suki[suki[i]] == i) {
			cou++;
			suki[suki[i]] = n;
		}
	}
	printf("%d\n",cou);
	return 0;
}

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

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

const int M = 1e5 + 10;

struct P {
    int b;ll c;
    bool operator < (const P &rhs) const {
        return c > rhs.c;      
    }
} p[M];

int main() {
    int n = read(), m = read();
    priority_queue<ll, vector<ll>, greater<ll> > que;
    for (int i = 0; i < n; i++) {
        int x = read();
        que.push((ll)x);
    }    
    for (int i = 0; i < m; i++) p[i].b = read(), p[i].c = (ll)read();
    sort(p, p + m);
    for (int i = 0; i < m; i++) {
        int b = p[i].b;
        while (b--) {
            ll x = que.top(); que.pop();
            if (x < p[i].c) {
                que.push(p[i].c);
            } else {
                que.push(x);
                break;
            }
        }
    }
    ll sum = 0;
    while (!que.empty()) {
        int x = que.top(); que.pop();
        sum += x;
    }
    cout << sum << '\n';
    return 0;
}

Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>k){
        cout<<k;
    }else if(a+b>k){
        cout<<a;
    }else{
        cout<<a-(k-a-b);
    }
    
}


Measured memory_bytes: 3588
//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)

#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (ll)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0

typedef double db;
typedef long long ll;

const ll ary=1e5+5;
const ll mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
ll n;
string s;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>s;
	for(int i=0;i<len(s);i++){
		for(int j=0;j<n;j++){
			s[i]++;
			if(s[i]>'Z'){
				s[i]='A';
			}
		}
	}
	cout<<s;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.HashSet
import kotlin.math.*
fun main(){
    var fs = CodeForces.FastReader()
    var n = fs.nextInt()
    println(n + n*n + n*n*n)
}

class CodeForces {
    internal class FastReader {
        private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))
        private var st: StringTokenizer? = null

        operator fun next(): String {
            while (st == null || !st!!.hasMoreElements()) {
                try {
                    st = StringTokenizer(br.readLine())
                } catch (e: IOException) {
                    e.printStackTrace()
                }

            }
            return st!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }

        fun nextDouble(): Double {
            return java.lang.Double.parseDouble(next())
        }

        fun nextLine(): String {
            var str = ""
            try {
                str = br.readLine()
            } catch (e: IOException) {
                e.printStackTrace()
            }
            return str
        }

        fun readIntArray(n: Int): IntArray {
            val a = IntArray(n)
            for (i in 0 until n) a[i] = nextInt()
            return a
        }
        fun readLongArray(n: Int): LongArray {
            val a = LongArray(n)
            for (i in 0 until n) a[i] = nextLong()
            return a
        }

        fun readDoubleArray(n: Int): DoubleArray {
            val a = DoubleArray(n)
            for (i in 0 until n) a[i] = nextDouble()
            return a
        }
    }
}


Measured memory_bytes: 34284
#include<bits/stdc++.h>
using namespace std;int64_t N,P,a,c[1<<20],i,j;string S;main(){cin>>N>>P>>S;if(10%P)for(c[0]=j=1;N--;i+=(S[N]-48)*(j=j*10%P),a+=c[i%=P]++);else for(;i<N;a+=(S[i++]-8)%P?0:i);cout<<a;}

Measured memory_bytes: 644
fun main() = ABC162A.main()

object ABC162A {
    fun log(message: Any?) {
        println(message)// TODO: ←消す
    }

    fun main() {
        val str = readString()
        val ans = str.contains('7')
        println(ans.yesOrNo())
    }


    /*####################################################################################*/

    fun readString() = readLine()!!
    fun readStrings() = readLine()!!.split(" ")
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }
    fun readLong() = readLine()!!.toLong()
    fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
    fun readMatrixRows(height: Int) = (1..height).map { readLine()!!.toList() }

    fun Boolean.yesOrNo() = if (this) "Yes" else "No"
    fun Double.toNaturalExpr() = println("%f".format(this))
}

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

using namespace std;

using ll = long long;

int main(){
    ll n;
    cin >> n;
    vector<ll>v;
    ll ans = 0;
    for(ll i = 0; i < n; ++i){
        ll tmp; cin >> tmp;
        v.push_back(tmp);
    }
    ll odz = 0;
    for(ll i = 0; i < n - 1; ++i){
        odz += min(v[i], v[i + 1]);
    }
    cout << accumulate(v.begin(), v.end(), 0) - odz;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//1-2-3-4-5-6-7
//    3-------7

int main(){
  ll N,X,Y; cin>>N>>X>>Y;
  vector<vector<ll>> path(N+1, vector<ll>(N+1,1e6));
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      path[i][j]=abs(i-j);
    }
  }
  path[X][Y]=1;
  path[Y][X]=1;
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      path[i][j]=min(path[i][j],path[i][X]+path[X][Y]+path[Y][j]);
      path[i][j]=min(path[i][j],path[i][Y]+path[Y][X]+path[X][j]);
    }
  }
  vector<ll> ans(N+1,0);
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++) ans[path[i][j]]++;
  }
  for(int i=1; i<N; i++)
    cout<<ans[i]/2<<endl;
}

Measured memory_bytes: 31616
#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 t(5);
    ll m = 9;
    bool f = false;
    ll sum = 0;
    rep(i, 5) {
        cin >> t[i];
        if (t[i] % 10 != 0) {
            m = min(t[i] % 10, m);
            t[i] = t[i] + (10-t[i]%10);
            f = true;
        }
        
        sum += t[i];
    }
    if(f) sum -= (10-m);
    mes(sum);
    
    
    
    
    
    
    
    
}

Measured memory_bytes: 3628
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int T=sc.nextInt();
        int ans=1<<28;
        for (int i=0; i<n; i++) {
            int c=sc.nextInt(),
            t=sc.nextInt();
            if(t<=T)ans=min(ans,c);
        }
        if(ans==1<<28)
        out.println("TLE");
       else

        out.println(ans);
        out.flush();
        // out.println(ans);
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  

    static long gcd(long a, long b){
        if(min(a,b) == 0)return max(a,b);
        return gcd(max(a,b) % min(a,b),min(a,b));
    }
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 22740
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

vector<string> v;
string t;
bool used[26];

void dfs(string s) {
  int n = s.size();
  if(n == t.size()) {
    v.PB(s);
    return;
  }
  if(t[n] == 'a' || used[t[n]-'a']) {
    dfs(s+t[n]);
  }
  if(t[n] != 'z' && !used[t[n]-'a'+1]) {
    used[t[n]-'a'+1]=true;
    dfs(s+(char)(t[n]+1));
    used[t[n]-'a'+1]=false;
  }
}

signed main(void)
{
  while(true) {
    cin >> t;
    if(t == "#") break;
    v.clear();
    REP(i, 26) used[i] = false;
    
    dfs("");
    if(v.size() <= 10) {
      cout << v.size() << endl;
      for(string i: v) {
        cout << i << endl;
      }
    } else {
      cout << v.size() << endl;
      REP(i, 5) cout << v[i] << endl;
      FOR(i, v.size()-5, v.size()) cout << v[i] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 4320
#include <iostream>
#include <string>
 
using namespace std;
int main(){
      string s;
     cin >> s;
     bool findC = false;
     bool findF = false;
     for(int i = 0; i < s.size(); i++){
         if(s[i] == 'C')
                findC = true;
         else if(s[i] == 'F' && findC )
                findF = true;
     }
     if(findC && findF)
        cout << "Yes" << endl;
    else
         cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int i,n,c=1,m;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);}
m=a[0];
for(i=1;i<n;i++){
if(a[i]<=m){c++;m=a[i];}}
printf("%d\n",c);
}



 

Measured memory_bytes: 2848
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AOneOutOfThree solver = new AOneOutOfThree();
        solver.solve(1, in, out);
        out.close();
    }

    static class AOneOutOfThree {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] arr = new int[201];
            arr[in.nextInt() + 100]++;
            arr[in.nextInt() + 100]++;
            arr[in.nextInt() + 100]++;
            for (int i = 0; i < arr.length; i++) {
                if (arr[i] == 1) {
                    out.print(i - 100);
                    return;
                }
            }
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 23380
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        TreeSet<Integer> set = new TreeSet<>();
        for (int i = 1; i <= 30; i++) {
            set.add(i);
        }
        for (int i = 0; i < 28; i++) {
            set.remove(sc.nextInt());
        }
        StringBuilder sb = new StringBuilder();
        for (int x : set) {
            sb.append(x).append("\n");
        }
        System.out.print(sb);
    }
}



Measured memory_bytes: 26380
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<long>num(N,0);
  
  for(int i=0;i<N;i++){
    cin >> num[i];
  }
  
  for(int i=0;i<N;i++){
    num[i]--;
  }
  
  long ans = 0;
  
  for(int i=0;i<N;i++){
    ans += num[i];
  }
  
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

int
main(int argc, const char *argv[])
{
    string str;    
    while (getline(cin, str)) {
        if (str == ".") break;     
        stack<char> sc;
        bool is_balanced = true;
        for (decltype(str.size()) i = 0; i != str.size(); ++i) {
            if (str[i] == '(' || str[i] == '[') sc.push(str[i]);
            else if (str[i] == ')') {
                if (!sc.empty()) {
                    char c = sc.top();
                    sc.pop();
                    if (c != '(') is_balanced = false;
                } else is_balanced = false;
            } else if (str[i] == ']') {
                if (!sc.empty()) {
                    char c = sc.top();
                    sc.pop();
                    if (c != '[') is_balanced = false;
                } else is_balanced = false;
            }
        }
        if (!sc.empty()) is_balanced = false;
        if (is_balanced) cout << "yes";
        else cout << "no";
        cout << endl;
    }

    return 0;
}

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

int main(void){
    int n, d, x, cnt; 
    cin >> n >> d >> x;
    int ans = x;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    for (int i=0; i<n; i++){
        cnt = 0;
        while (true){
            if (cnt*a[i]+1 <= d) cnt++;
            else break;
        }
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt();
		int max = -101, min = 101;
		for (int i = 0; i < n; i++) {
			max = Math.max(sc.nextInt(), max);
		}
		for (int i = 0; i < m; i++) {
			min = Math.min(sc.nextInt(), min);
		}
		for (int z = x + 1; z <= y; z++) {
			if (max < z && min >= z) {
				System.out.println("No War");
				return;
			}
		}
		System.out.println("War");
	}

}

Measured memory_bytes: 27208
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <climits> 

int main()
{
    long a,b,x;
    std::cin >> a >> b >> x;
    long result=b/x-a/x;
    if(a%x==0){
        result++;
    }
    std::cout << result <<std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Dice {
    int[] dn = new int[6];

    Dice(int[] d) {
        for (int i = 0; i < 6; i++) {
            dn[i] = d[i];
        }
    }

    void turnN() {
        int x = dn[0];
        dn[0] = dn[1];
        dn[1] = dn[5];
        dn[5] = dn[4];
        dn[4] = x;
    }

    void turnS() {
        int x = dn[0];
        dn[0] = dn[4];
        dn[4] = dn[5];
        dn[5] = dn[1];
        dn[1] = x;
    }

    void turnW() {
        int x = dn[0];
        dn[0] = dn[2];
        dn[2] = dn[5];
        dn[5] = dn[3];
        dn[3] = x;
    }

    void turnE() {
        int x = dn[0];
        dn[0] = dn[3];
        dn[3] = dn[5];
        dn[5] = dn[2];
        dn[2] = x;
    }

    static boolean judge(Dice d1, Dice d2) {
        boolean a = true;

        if (d1.dn[1] == d2.dn[2] || d1.dn[1] == d2.dn[3])
            d2.turnW();

        for (int i = 0; i < 3; i++) {
            if (d2.dn[1] == d1.dn[1])
                break;
            d2.turnS();
        }
        if (d2.dn[1] != d1.dn[1])
            a = false;

        for (int i = 0; i < 3; i++) {
            if (d2.dn[0] == d1.dn[0])
                break;
            d2.turnW();
        }
        if (d2.dn[0] != d1.dn[0])
            a = false;

        for (int i = 2; i < 6; i++) {
            a = a && d2.dn[i] == d1.dn[i];
        }

        return a;
    }
}

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] num = new int[6];
        Dice[] dc = new Dice[2];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 6; j++) {
                num[j] = sc.nextInt();
            }
            dc[i] = new Dice(num);
        }
        if (Dice.judge(dc[0], dc[1])) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}



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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {

	ll x;
	cin >> x;
	ll a = 100;

	int ans = 0;

	while (x > a) {
		a += a / 100;
		ans++;
	}
	cout << ans << endl;

	
}


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int score[100000];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, q;
  cin >> n >> k >> q;
  vi a(q);
  for (int i = 0; i < q; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < q; i++) {
    score[a[i] - 1]++;
  }
  // cout << endl;
  // for (int i = 0; i < n; i++) {
  //   cout << score[i] << endl;
  // }
  // cout << endl;
  for (int i = 0; i < n; i++) {
    if ((k - (q - score[i])) > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        long w , h , x ,y;
        cin >> w >> h >> x >> y;
        double ans;
        ans = w * h * 1.0;
        ans = ans / 2.0;
        
        
        cout << setprecision(9) << fixed << ans;
        cout << " ";
        if(2 * x == w && 2 * y == h){
            cout << 1 << endl;
        }else{
            cout << 0 << endl;
        }
        return 0;
    }

Measured memory_bytes: 256