akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N);

    ll total = 0;
    REP(i, 0, N) {
        cin >> A[i];
        total += A[i];
    }

    ll x = 0, y, ans = 1LL << 60;
    REP(i, 0, N - 1) {
        x += A[i];
        ans = min(ans, abs(x - (total - x)));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
import math

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

rad_B = M * 6
rad_A = H * 30 + M * 0.5

if rad_A < rad_B:
    rad_C = rad_A - rad_B
elif rad_A > rad_B:
    rad_C = rad_B - rad_A
elif rad_A == rad_B:
    rad_C = 0

rad_C = abs(rad_C)

if rad_C > 180:
    rad_C = 360 - rad_C

#print(rad_A,rad_B,rad_C)

cos_C = math.cos(math.radians(rad_C))

C_2 = A ** 2 + B ** 2 - 2 * A * B * cos_C

C = math.sqrt(C_2)

#print(rad_A,rad_B,rad_C)
print(C)

Measured memory_bytes: 9580
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    String b = sc.next();

    char[] c = b.toCharArray();

    int k = (c[0]-'0')*100 + (c[2]-'0')*10 + (c[3]-'0');

    System.out.println(a*k/100);

  }

}


Measured memory_bytes: 35656
x = int(input())
if x >= 400 and x <= 599:
    print(8)
elif x >= 600 and x <= 799:
    print(7)
elif x >= 800 and x <= 999:
    print(6)
elif x >= 1000 and x <= 1199:
    print(5)
elif x >= 1200 and x <= 1399:
    print(4)
elif x >= 1400 and x <= 1599:
    print(3)
elif x >= 1600 and x <= 1799:
    print(2)
elif x >= 1800 and x <= 1999:
    print(1)

Measured memory_bytes: 61640
"use strict";
function reverseStr(s) {
    var rs = "";
    for (var i = 0, n = s.length; i < n; i++) {
        rs += s[n - i - 1];
    }
    return rs;
}

function checkPal(s) {
    return s === reverseStr(s);
}

function main(input) {
    let S = input.replace("\n", "");
    console.log(
        checkPal(S) && checkPal(S.slice(0, S.length / 2 | 0)) ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    int maxas = 0;
    int maxde = 0;
    int prev;
    cin >> prev;

    for (int j = 0; j < n - 1; ++j) {
      int hight;
      cin >> hight;
      int diff = hight - prev;
      if (diff >= 0) maxas = max(maxas, diff);
      else maxde = max(maxde, -diff);
      prev = hight;
    }
    cout << maxas << " " << maxde << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100001;
vector < int > edge[maxn];
int res[maxn], n, in[maxn], ans;
void dfs(int now){
	if(res[now])return;
	for(int &next : edge[now]){
		dfs(next);
		ans = max(ans, res[now] = max(res[now], res[next] + 1));
	}
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int m;
	cin >> n >> m;
	// fill(res, res + n, -1);
	for(int i = 0, a, b;i < m;++i){
		cin >> a >> b;
		edge[a].push_back(b);
		++in[b];
	}
	for(int i = 1;i <= n;++i){
		if(in[i] == 0)dfs(i);
	}
	cout << ans << '\n';
}

Measured memory_bytes: 9600
#include<iostream>
using namespace std;
int main()
{
    long long n,d,cnt=0;
    long long a,b;
    scanf("%lld %lld",&n,&d);
    d=d*d;
    while(n--)
    {
        scanf("%lld %lld",&a,&b);
        long long c=a*a+b*b;
        if(c<=d)
        {
            cnt++;
        }
    }
    printf("%lld\n",cnt);
    
    return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
  ll A;
  ll C = 0;
  cin >> A;
vector<ll> data(A);
  REP(i,A) {
    cin >> data[i];
  }
  REP(i,A-1){
    if(data[i] > data[i+1]){
      C += abs(data[i+1]-data[i]);
      data[i+1] = data[i];
    }
  }
  cout << C;
}

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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    string s; cin >> s;
    rep(i, s.size()) cout << "x";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int numA, numB, sumBall, sum, count = 0;
    scanf("%d %d", &numA, &numB);
    sumBall = numA + numB;
    int ball[sumBall];

    for(int i = 0; i < numA; i++)
    {
        ball[0] = 2;
        ball[i + 1] = ball[i] + 2;
    //    printf("%d\n", ball[i]);
    }

    for(int i = numA; i < sumBall; i++)
    {
        ball[numA] = 1;
        ball[i + 1] = ball[i] + 2;
    //    printf("%d\n", ball[i]);
    }

    for(int i = 0; i < sumBall; i++)
    {
        for(int j = i + 1; j < sumBall; j++)
        {
            sum = 0;
            //printf("%d + %d\n", ball[i], ball[j]);
            sum = ball[i] + ball[j]; 
            if (sum % 2 == 0) count++;
        }
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 1704
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

use std::collections::HashSet;
fn get_divisors(x: i64) -> Vec<i64> {
    let mut hs = HashSet::new();
    for i in 1.. {
        if x % i == 0 {
            hs.insert(i);
            hs.insert(x / i);
        }
        if i * i > x {
            break;
        }
    }
    hs.into_iter().collect()
}

fn main() {
    let v = read_vec::<i64>();
    let n = v[0];
    let m = v[1];

    let mut divisors = get_divisors(m);
    divisors.sort();
    for d in divisors.iter().rev() {
        if m  >= n * d {
            println!("{}", d);
            break;
        }
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include <functional>
#include <utility>
#include<algorithm>
using namespace std;
using ll = long long;
const static int MAX_N = 2000;
ll dp[2][MAX_N+5];

int main(){
	int N;
	scanf("%d", &N);
	pair<ll, int> A[N];
	for (int i = 0; i < N; ++i){
		ll tmp;
		scanf("%lld", &tmp);
		A[i] = make_pair(tmp, i);
	}
	sort(A, A + N, greater<pair<ll, int>>());
	dp[0][0] = 0;
	for (int i = 1; i <= N; ++i){
		dp[i&1][0] = dp[i&1^1][0] + A[i-1].first*abs(A[i-1].second - N + i);
		dp[i&1][i] = dp[i&1^1][i-1] + A[i-1].first*abs(A[i-1].second - i + 1);
		for (int j = 1; j < i; ++j){
			dp[i&1][j] = max(dp[i&1^1][j] + A[i-1].first*abs(A[i-1].second - N + i - j), dp[i&1^1][j - 1] + A[i-1].first*abs(A[i-1].second - j + 1));
		}
	}
	ll ans = 0;
	for (int i = 0; i <= N; ++i){
		if(dp[N&1][i] > ans) ans = dp[N&1][i];
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<string> w(n);
  rep(i,n) cin >> w[i];
  
  bool ans=true;//条件違反だったらfalseにする
  rep(i,n-1){
    if (w[i][w[i].length()-1]!=w[i+1][0]){
      ans=false;
    }
  }
  
  rep(i,n){
    for (int j=0;j<i;++j){
      if (w[i]==w[j]){
        ans=false;
      }
    }
  }
  if (ans) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    string s, t;
    cin >> s >> t;
    s.append(s);

    int len = t.length();

    rep(i, len){
        string a = s.substr(i, len);
        if(a == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


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

#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1)
#define MAXS 1e(18)
#define MOD 1000000007
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;



int main()
{

    _fastIO;

    int a[4];
    
    while(cin>>a[1]>>a[2]){
        for(int i=1; i<=3; i++){
            if(i!=a[1] && i!=a[2]){
                cout<<i<<endl;
                break;
            }
        }
        
    }

    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int bit[(1<<20)+1], n;
class BIT{
private:
public:
  BIT(int n_){
	n = n_;
	fill(bit, bit+n+1, 0);
  }

  // return bit[1] + ... + bit[i]
  int sum(int i){
	int s = 0;
	while(i > 0){
	  s += bit[i];
	  i -= i & -i;
	}
	return s;
  }

  // bit[i] += x
  void add(int i, int x){
	while(i <= n){
	  bit[i] += x;
	  i += i & -i;
	}
  }

  int lower_bound(int x){
	if(x <= 0) return 0;
	int i = 1;
	for(;i<=n;i<<=1);
	i >>= 1;
	int res = 0;
	for(;i>0;i>>=1){
	  if(res+i <= n && bit[res+i] < x){
		x -= bit[res+i];
		res += i;
	  }
	}
	return res+1;
  }
};

LL N;
LL f(VL& xs, LL bias){
  BIT bit(N + bias + 1);

  bit.add(bias, 1);
  LL res = 0;
  for(int i=1;i<=N;++i){
	res += i - bit.sum(xs[i]+bias);
	bit.add(xs[i]+bias, 1);
  }
  return res;
}

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

  cin >> N;
  VI xs(N);
  cin >> xs;

  LL mid = (N * (N-1) / 2 + N) / 2;
  int lb = 0, ub = 1e9+10;
  while(ub - lb > 1){
	int v = (lb + ub) / 2;

	VL acc(N+1);
	LL mn = 0;
	REP(i,N) {
	  acc[i+1] = acc[i] + (xs[i] < v ? -1 : 1);
	  mini(mn, acc[i+1]);
	}
	LL n1 = f(acc, -mn+1);
	/*
	mn = 0, acc[0] = 0;
	REP(i,N) {
	  acc[i+1] = acc[i] + (xs[i] <= v ? -1 : 1);
	  mini(mn, acc[i+1]);
	}
	LL n2 = f(acc, -mn+1);
	*/
	//cout<<v<<","<<n1<<","<<n2<<endl;

	if(n1 <= mid){
	  lb = v;
	}
	else{
	  ub = v;
	}
  }
  //cout << mid << endl;
  cout << lb << endl;

  return 0;
}


Measured memory_bytes: 2176
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        String s = sc.next();
        if (s.charAt(0) < 97) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

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

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


    }

}

Measured memory_bytes: 32736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int n;

void func(ll cur, int use, ll &cnt) {
  if (cur > n) return;
  if (use == 7) ++cnt;
  func(cur * 10 + 3, use | 1, cnt);
  func(cur * 10 + 5, use | 2, cnt);
  func(cur * 10 + 7, use | 4, cnt);
}

int main() {
  cin >> n;
  ll res = 0;
  func(0, 0, res);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
/*
        HELLO WORLD
        -----------
        SHUBHAM
        -----------
        :) CODING
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ff                                         first
#define ss                                         second
#define pb                                         push_back
#define int                                        long long
#define mp                                         make_pair
#define pii                                        pair<int,int>
#define vi                                         vector<int>
#define mii                                        map<int,int>
#define umii                                       unordered_map<int,int>
#define pqb                                        priority_queue<int>
#define pqs                                        priority_queue<int,vi,greater<int>>
#define setbits(x)                                 __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                        1000000007
#define inf                                        1e18
#define ps(x,y)                                    fixed<<setprecision(y)<<x
#define mk(arr,n,type)                             type *arr=new type[n]
#define test(t)                                    int t;cin>>t;while(t--)
#define rep(i,n)                                   for(int i=0;i<n;i++)
#define rep1(i,n)                                  for(int i=1;i<=n;i++)
#define fio                                        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SIZE                                       100001
#define all(x)                                     (x).begin(),(x).end()
#define sclk()                                     auto start_time = Clock::now()
#define eclk()                                     auto end_time = Clock::now();  cout << "\nTime Taken : " << chrono::duration_cast<chrono::milliseconds>(end_time    - start_time).count() << " ms"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef std::chrono::high_resolution_clock Clock;

int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}

void f_io()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
vector<pii> input;
int n,w;
int dp[SIZE][101];
int solve(int st,int curr)
{
    if(st==n or curr<0)
        return 0;
    if(dp[curr][st]==-1)
    {
        if(curr-input[st].ff>=0)
       dp[curr][st]=max(solve(st+1,curr),input[st].ss+solve(st+1,curr-input[st].ff));
        else
        dp[curr][st]=solve(st+1,curr);
    }
    return dp[curr][st];
}
int32_t main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>w;
    rep(i,n)
    {
        pii pp;
        cin>>pp.ff>>pp.ss;
        input.pb(pp);
    }
    cout<<solve(0,w);
    //cout<<*max_element(dp,dp+SIZE);
    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
#define lo long long
#define mid (start+end)/2
using namespace std;
int n,A[li],git[li],cev[li];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&A[i]);
	cev[n]=0;
	for(int i=n-1;i>=1;i--){
		if(A[i]<A[i+1]) cev[i]=0;
		else{
			cev[i]=cev[i+1]+1;
		}
	}
	int mx=0;
	for(int i=1;i<=n;i++) mx=max(mx,cev[i]);
	printf("%d\n",mx);
	return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

template<class T> inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

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

	ll n; cin >> n; if (n == 0) {cout << 0 << endl; return 0;}
	int isPositive = n > 0;
	n = abs(n);
	int k = log2(n)+3;
	vector<bool> ns(k,false);
	rep(i, k) {
		//cerr << (bitset<30>) n << endl;
		ll si = n >> i & 1;
		if (i % 2 == isPositive && si == 1) { 
		  si += 1;
			ns[i] = true; 
			n += si << i;
		}
	}

	rep(i, k) {
	  if (i % 2 == !isPositive && n >> i & 1) ns[i] = true;
	}

	reverse(all(ns));

	bool write = false;
	rep(i,k) { 
	  if (!write && ns[i]) write = true;
	  if (write) cout << ns[i]; 
	} cout << endl; 
}


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

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

	bool ok[31] = {};

	for(int i = 0; i < 28; ++i) {
		int id;
		cin >> id;
		ok[id] = true;
	}

	for(int i = 1; i <= 30; ++i)
		if(!ok[i])
			cout << i << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let (a,b,c,k) = scan "%d %d %d %d" Tuple4.make

let () =
  Printf.printf "%d\n" (if k <= a then k
                        else if k <= a +b then a
                        else a - (k-a-b))


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

int n, A[3], ans;
vector<int> l;
char tmp[8];
void check(void)
{
	vector<int> cnt(3, -1), sum(3, 0);
	int s = 0;
	rep(i, n)
	{
		sum[tmp[i] - 'A'] += l[i];
		cnt[tmp[i] - 'A']++;
	}
	rep(i, 3)
	{
		if (cnt[i] >= 0) 
			s += cnt[i] * 10;
		if (sum[i] > 0)
			s += abs(A[i] - sum[i]);
		else
			return;
	}
	ans = min(ans, s);
}

void dfs(int depth = -1, int e = -1)
{
	if (depth == n)
	{
		check();
		return;
	}	
	if (e != -1)
		tmp[depth] = 'A' + e;
	rep(i, 4)
	{
		dfs(depth + 1, i);
	}
}

signed main(void)
{
	cin >> n;
	rep(i, 3) cin >> A[i];
	l.resize(n);
	rep(i, n) cin >> l[i];
	ans = 1e9;
	dfs();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            int[] input = reader.readIntsSplitByDelimiter(" ");
            int numOfbill = input[0];
            int sumInput = input[1];

            for (int numOf1000 = 0; numOf1000 <= numOfbill; numOf1000++) {
                for (int numOf5000 = numOfbill - numOf1000; numOf5000 >= 0; numOf5000--) {
                    int numOf10000 = numOfbill - numOf1000 - numOf5000;
                    int sum = 1000 * numOf1000 + 5000 * numOf5000 + 10000 * numOf10000;
                    if (sum == sumInput) {
                        System.out.printf("%d %d %d%n", numOf10000, numOf5000, numOf1000);
                        return;
                    }
                }
            }
            System.out.println("-1 -1 -1");
        }
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.br.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.br.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.br.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    @Override
    public void close() throws IOException {
        br.close();
    }
}

Measured memory_bytes: 24020
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[20][20];
int pow3[13];
int mod=100000007;
int dp[12][12][60000][3];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%s",str[i]);
	}
	pow3[0]=1;
	for(int i=1;i<13;i++)pow3[i]=pow3[i-1]*3;
	dp[0][0][0][0]=1;
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			for(int k=0;k<pow3[b];k++){
				for(int l=0;l<3;l++){
					if(!dp[i][j][k][l])continue;
			//		printf("%d %d %d %d: %d\n",i,j,k,l,dp[i][j][k][l]);
					if(str[i][j]=='.'){
						if(k%3&&l)continue;
						dp[i][j+1][k/3+pow3[b-1]*(k%3)][l]=(dp[i][j+1][k/3+pow3[b-1]*(k%3)][l]+dp[i][j][k][l])%mod;
					}else{
						int rem=str[i][j]-'0'-l-k%3;
						if(rem<0)continue;
						for(int m=0;m<3;m++)for(int n=0;n<3;n++){
							if(rem==m+n){
								dp[i][j+1][k/3+pow3[b-1]*m][n]=(dp[i][j+1][k/3+pow3[b-1]*m][n]+dp[i][j][k][l])%mod;
							}
						}
					}
				}
			}
		}
		for(int j=0;j<pow3[b];j++){
			dp[i+1][0][j][0]=dp[i][b][j][0];
		}
	}
	printf("%d\n",dp[a][0][0][0]);
}

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

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=1,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld %lld",&n,&k);

        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a); u.push_back(a);
        }

        sort(u.begin(),u.end());

        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a);  v.push_back(a);

        }

        sort(v.begin(),v.end());

        long long lo,hi,mid;  lo=0;  hi=u[n-1]*v[n-1];

        while(lo<hi)
        {
            mid=(lo+hi)>>1;

            cnt=0;

            for(i=0,j=n-1; i<=n-1,j>=0; i++,j--)
            {
                fr=u[i];  sc=v[j];  tr=mid/sc;  cnt=cnt+max(0LL,fr-tr);

                if(cnt>k)break;
            }

            if(cnt<=k)hi=mid;
            else{ lo=mid+1;  }


        }



        printf("%lld\n",lo);








    return 0;
}





Measured memory_bytes: 8000
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt() - i - 1;
		}
		int mid;
		Arrays.sort(a);
		if (a.length % 2 == 0) {
			mid = (a[a.length / 2 - 1] + a[a.length / 2]) / 2;
		} else {
			mid = a[a.length / 2];
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += Math.abs(a[i] - mid);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 80496
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int main(){
    string s;
    cin>>s;
    string t,u,v;
    int l=0,r=s.size()-1;
    int cnt=0;
    while(l<r){
        if(s[l]==s[r]){
            l++;
            r--;
        }
        else if(s[l]=='x' && s[r]!='x'){
            l++;
            cnt++;
        }
        else if(s[l]!='x' && s[r]=='x'){
            r--;
            cnt++;
        }
        else if(s[l]!=s[r] && s[l]!=s[r]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
		var s = ReadLine().ToCharArray();
		s[n[1]] = s[n[1]].ToString().ToLower()[0];
		
		WriteLine(new string(s));
	}
}


Measured memory_bytes: 19124
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

typedef long long ll;

int main(){
	static int n;
	static int a[100010];
	static int b[100010];
	scanf("%d",&n);
	for(int i = 1 ; i <= n+1 ; i ++){
		scanf("%d",&a[i]);
	}
	for(int i = 1 ; i <= n ; i ++){
		scanf("%d",&b[i]);
	}
	
	ll cnt = 0;
	for(int i = 1 ; i <= n ; i ++){
		int x = min(a[i],b[i]);
		cnt += x;
		b[i] -= x;
		x = min(a[i+1],b[i]);
		cnt += x;
		a[i+1] -= x;
	}
	cout << cnt << endl;
}
	

Measured memory_bytes: 1024
#include <cstdio>

int main(){
    int a, b, c;
    scanf("%d %d %d\n",&a,&b,&c);
    if(c>100||a<0){
        printf("No\n");
    }else if(a < b && b< c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 2604
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  vector<vector<int>> c(3,vector<int>(3));
  REP(i, 3){
    REP(j, 3){
      cin >> c.at(i).at(j);
    }
  }
  
  if(c.at(0).at(1)-c.at(0).at(0)==c.at(1).at(1)-c.at(1).at(0)
  && c.at(0).at(1)-c.at(0).at(0)==c.at(2).at(1)-c.at(2).at(0)
  && c.at(0).at(2)-c.at(0).at(0)==c.at(1).at(2)-c.at(1).at(0)
  && c.at(0).at(2)-c.at(0).at(0)==c.at(2).at(2)-c.at(2).at(0)
  && c.at(1).at(0)-c.at(0).at(0)==c.at(1).at(1)-c.at(0).at(1)
  && c.at(1).at(0)-c.at(0).at(0)==c.at(1).at(2)-c.at(0).at(2)
  && c.at(2).at(0)-c.at(0).at(0)==c.at(2).at(1)-c.at(0).at(1)
  && c.at(2).at(0)-c.at(0).at(0)==c.at(2).at(2)-c.at(0).at(2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]
 
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)

Measured memory_bytes: 7712
#include<bits/stdc++.h>
using namespace std;
#define inf 1<<29

int n,m,r;
int d[201][201];
int a,b,c;
int res;

void warshall_floyd(int n) {
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) for (int k=0;k<n;k++) d[j][k]=min(d[j][k], d[j][i]+d[i][k]);
}

int main(){
    scanf("%d %d %d",&n,&m,&r);
    vector<int> w(r);
    for (int i=0;i<r;i++) scanf("%d",&w[i]);
    sort(w.begin(),w.end());
    for (int i=0;i<201;i++) for (int j=0;j<201;j++) d[i][j]=inf;
    for (int i=0;i<m;i++) {
        scanf("%d %d %d",&a,&b,&c);
        d[a][b]=c;
        d[b][a]=c;
    }
    warshall_floyd(n+1);
    int ans=inf;
    do {
        int p,chk=0;
        for (int i=0;i<r;i++) {
            if (i==0) {
                p=w[i];
            } else {
                chk+=d[w[i]][p];
                p=w[i];
            }
        }
        ans=min(ans,chk);
    } while (next_permutation(w.begin(),w.end()));
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 384
N, K = map(int, input().split())

count = 0
count2 = 0
for i in range(1, N+1):
    if i % K == 0:
        count += 1
    elif K % 2 == 0:
        if i % K == K // 2:
            count2 += 1

ans = 0
for i in range(3):
    if i == 0:
        ans += count
        ans += count2
    elif i == 1:
        # 3C1*count*count-1
        ans += 3*count*(count-1)
        ans += 3*count2*(count2-1)
    else:
        ans += count*(count-1)*(count-2)
        ans += count2*(count2-1)*(count2-2)


print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

class Main {

	public static final String LIGHT_FLY = "light fly";
	public static final String FLY = "fly";
	public static final String BANTAM = "bantam";
	public static final String FEATHER = "feather";
	public static final String LIGHT = "light";
	public static final String LIGHT_WELTER = "light welter";
	public static final String WELTER = "welter";
	public static final String LIGHT_MIDDLE = "light middle";
	public static final String MIDDLE = "middle";
	public static final String LIGHT_HEAVY = "light heavy";
	public static final String HEAVY = "heavy";

	public static void main(String[] args) {

		try (Scanner scanner = new Scanner(System.in)) {
			while (scanner.hasNextDouble()) {
				double weight = scanner.nextDouble();
				System.out.println(getWeightClass(weight));
			}
		}
	}

	private static String getWeightClass(double weight) {
		String weghitClass = null;

		if (weight <= 48.00) {
			weghitClass = "light fly";
		} else if (48.00 < weight && weight <= 51.00) {
			weghitClass = "fly";
		} else if (51.00 < weight && weight <= 54.00) {
			weghitClass = "bantam";
		} else if (54.00 < weight && weight <= 57.00) {
			weghitClass = "feather";
		} else if (57.00 < weight && weight <= 60.00) {
			weghitClass = "light";
		} else if (60.00 < weight && weight <= 64.00) {
			weghitClass = "light welter";
		} else if (64.00 < weight && weight <= 69.00) {
			weghitClass = "welter";
		} else if (69.00 < weight && weight <= 75.00) {
			weghitClass = "light middle";
		} else if (75.00 < weight && weight <= 81.00) {
			weghitClass = "middle";
		} else if (81.00 < weight && weight <= 91.00) {
			weghitClass = "light heavy";
		} else {
			weghitClass = "heavy";
		}
		return weghitClass;
	}
}

Measured memory_bytes: 27892
import java.util.*;

public class Main {

    public static void main(String args[]) {


        Scanner scan = new Scanner(System.in);

        int n = Integer.parseInt(scan.next());
        int k = Integer.parseInt(scan.next());

        Map<Integer, Boolean> map = new HashMap<>(k);

        for (int i = 1; i <= k; i++) {

            int d = Integer.parseInt(scan.next());

            for (int j = 1; j<= d; j++) {


                int a = Integer.parseInt(scan.next());

                if (!map.containsKey(a)) {
                    map.put(a, true);
                }
            }
        }
        scan.close();

       int x= n-  map.size();

       System.out.println(String.valueOf(x));
    }
}

Measured memory_bytes: 41636
#include <iostream>
#include<cmath>
#include<vector>
using namespace std;
#define ll long long
#define ld long double

int main(void){
 ll n;
 cin>>n;
 
 vector<vector<ll>> vec(n-1, vector<ll>(3));
 
 for(int i=0;i<n-1;++i){
     for(int j=0;j<3;j++)
     cin>>vec[i][j];
 }

ll time1=0;
for(int i=0;i<n-1;i++){
    time1= vec[i][1]+vec[i][0];
    for(int j=i+1;j<n-1;++j){
        if(vec[j][1]>=time1){
            time1= vec[j][1];
        }
        else{
            
            ll t1= (time1- vec[j][1])%vec[j][2];
            if(t1!=0){
                time1+=vec[j][2]-t1;
            }
        }
        time1+=vec[j][0];
    }
    cout<<time1<<endl;;
}
cout<<0<<endl;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;

struct edge { int to,cost; };
const int MOD=1e9+7;

int main() {
  int N,M;cin>>N>>M;
  string S;cin>>S;

  // 1が連続してK個並んでいたら無理
  
  // 1に止まらずに、Nにちょうどつく時の最短回数の辞書順
  // 最低でもN/M(+1)回必要
  // 可能な限り大きい目を使うようにしてすすむ
  // というか逆側から最大で進んで来たら必然的に辞書順になるのでは
  reverse(ALL(S));
  vector<int> res;
  // インデックスは0~N
  int i=0;
  while (i<N) {
    // もう一手でたどり着く
    if (N-i<=M) {
      res.push_back(N-i);
      break;
    }
    // それ以外
    bool checker = false;
    for (int j=M;j>=1;j--) {
      if (S[i+j]=='0') {
        res.push_back(j);
        i+=j;
        checker = true;
        break;
      }
    }
    if (!checker) {
      OUT(-1);
      return 0;
    }
  }
  reverse(ALL(res));
  DUMP(res);

  return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
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;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

int H,W;
int sx,sy,gx,gy;
char c[1005][1005];
int dis[1005][1005];
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>H>>W>>sx>>sy>>gx>>gy;
	sx--;sy--;gx--;gy--;
	rep(i,H)rep(j,W){cin>>c[i][j];dis[i][j]=inf;}
	dis[sx][sy]=0;
	deque<P>que;
	que.push_back({sx,sy});
	while(!que.empty()){
		P p=que.front();que.pop_front();
		rep(i,4){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			if(nx<0||ny<0||nx>=H||ny>=W||c[nx][ny]=='#')continue;
			if(dis[nx][ny]>dis[p.first][p.second]){
				dis[nx][ny]=dis[p.first][p.second];
				que.push_front({nx,ny});
			}
		}
		for(int i=-2;i<=2;i++){
			for(int j=-2;j<=2;j++){
				int nx=p.first+i,ny=p.second+j;
				if(nx<0||ny<0||nx>=H||ny>=W||c[nx][ny]=='#')continue;
				if(dis[nx][ny]>dis[p.first][p.second]+1){
					dis[nx][ny]=dis[p.first][p.second]+1;
					que.push_back({nx,ny});
				}
			}
		}
	}
	cout<<(dis[gx][gy]==inf?-1:dis[gx][gy])<<endl;
}

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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());

            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);

            str = Console.ReadLine().Split(' ');

            var a = new int[m];
            int sum = 0;
            for(int i = 0; i < m; i++)
            {
                a[i] = int.Parse(str[i]);
                sum += a[i];
            }

            if (sum > n) { Console.WriteLine(-1); }
            else Console.WriteLine(n - sum);

            //ここまで
        }

       
    }

}


Measured memory_bytes: 28500
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    string s = "";
    while(n!=0) {
        char ch;
        if(n%26 == 0) ch = 'z';
        else ch = 'a'-1+(n%26);
        string str(1, ch);
        s = str+s;
        n = (n-1)/26;
        //if(ch == )
    }
    cout << s << endl;
}


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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

int a,b,c;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    cin>>a>>b>>c;
    cout<<(a+b+c)-max(a,max(b,c));
}




Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        StringBuffer str = new StringBuffer(S);
        String S2 = str.reverse().toString();
        int i = 0;
        if ((S.length()%2) == 0) {
        		for (int j=0; j<(S.length()/2); j++) {
        			if (S.charAt(j)!=S2.charAt(j)) {
        				i ++;
        			}
        		}
        } else {
	        	for (int j=0; j<((S.length()-1)/2); j++) {
	    			if (S.charAt(j)!=S2.charAt(j)) {
	    				i ++;
	    			}
	        	}
        }
        System.out.println(i);
    }
} 

Measured memory_bytes: 23252
#include<iostream>
using namespace std;
int main() {
	int n, d;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0)
			cout << ' ' << i;
		else {
			d = i;
			while(d) {
				if (d % 10 == 3) {
					cout << ' ' << i;
					break;
				}
				else d /= 10;
			}
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1160
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        return mint(*this) /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int s;
    cin >> s;

    vector<mint> dp(s + 1, 0);
    dp[0] = 1;
//    REP(i, s + 1) {
//        FOR(j, 3, s + 1) {
//            if (i + j > s) break;
//            dp[i + j] += dp[i];
//        }
//    }

    FOR(i, 3, s + 1) {
        dp[i] += dp[i - 1] + dp[i - 3];
    }

    print(dp[s]);

}


Measured memory_bytes: 3676
N = int(input())
XY = [list(map(int,input().split())) for _ in range(N)]
uv = [[XY[i][0]+XY[i][1],XY[i][0]-XY[i][1]] for i in range(N)]

mod = [uv[i][0]%2 for i in range(N)]
if sum(mod)==N:
    print(40)
    print(*[2**i for i in range(40)])
    for i in range(N):
        u,v = uv[i]
        u += 2**40-1
        u //= 2
        v += 2**40-1
        v //= 2
        u = '{:040b}'.format(u)[::-1]
        v = '{:040b}'.format(v)[::-1]
        w = [0]*40
        for j in range(40):
            if (u[j],v[j])==('1','1'):
                w[j] = 'R'
            if (u[j],v[j])==('0','0'):
                w[j] = 'L'
            if (u[j],v[j])==('1','0'):
                w[j] = 'U'
            if (u[j],v[j])==('0','1'):
                w[j] = 'D'
        print(''.join(w))
elif sum(mod)==0:
    print(40)
    print(*([1]+[2**i for i in range(39)]))
    for i in range(N):
        u,v = uv[i]
        u += 2**39
        u //= 2
        v += 2**39
        v //= 2
        u = '{:039b}'.format(u)[::-1]
        v = '{:039b}'.format(v)[::-1]
        w = [0]*39
        for j in range(39):
            if (u[j],v[j])==('1','1'):
                w[j] = 'R'
            if (u[j],v[j])==('0','0'):
                w[j] = 'L'
            if (u[j],v[j])==('1','0'):
                w[j] = 'U'
            if (u[j],v[j])==('0','1'):
                w[j] = 'D'
        w = ['L'] + w
        print(''.join(w))
else:
    print(-1)

Measured memory_bytes: 46168