akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll n;
vl vec;
bool dfs(vvl &g,ll v,ll par=-1){
    if(v==n-1){
        vec.pb(n-1);
        return true;
    }
    for(auto nv:g[v]){
        if(nv==par)continue;
        if(dfs(g,nv,v)){
            vec.pb(v);
            return true;
        }
    }
    return false;
}
int main(){
    cin >> n;
    vvl g(n);
    vpl e(n);
    rep(i,n-1){
        cin >> e[i].fi >> e[i].se;
        e[i].fi--;e[i].se--;
        g[e[i].fi].pb(e[i].se);g[e[i].se].pb(e[i].fi);
    }
    dfs(g,0,-1);
    vl v=vec;
    rev(all(v));
    ll sz=v.size();
    ll a,b;
    if(sz%2==0){
        a=v[sz/2-1],b=v[sz/2];
    }
    else{
        a=v[sz/2],b=v[sz/2+1];
    }
    UnionFind uf(n);
    rep(i,n-1){
        ll x=e[i].fi,y=e[i].se;
        if((x==a&&y==b)||(x==b&&y==a))continue;
        if(!uf.same(x,y))uf.merge(x,y);
    }
    if(uf.size(a)<=uf.size(b))cout << "Snuke" <<endl;
    else cout << "Fennec" <<endl;
}

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

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pr pair<int,int>
#define endl "\n"
#define MOD 1000000007 // 10^9 + 7
#define sz(x) (int)(x).size()
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define all(c) (c).begin(), (c).end()

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
using namespace std;
int n,k,weight[110],value[110];
ll dp[110][100010];

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

    //freopen("addin.txt","r",stdin);
    //freopen("addout.txt","w",stdout);

    cin >> n >> k;
    weight[0] = 0; value[0] = 0;
    for(int i = 1;i <= n;i++) cin >> weight[i] >> value[i];
    for(int i = 1;i <= n;i++){
        for(int j = 1;j <= k;j++){
            if(j >= weight[i]) dp[i][j] = max(dp[i-1][j],dp[i-1][j-weight[i]] + value[i]);
            else dp[i][j] = dp[i-1][j];
        }

    }
    cout<<dp[n][k]<<endl;
    return 0;
}

Measured memory_bytes: 79360
//
// Created by yamunaku on 2020/06/28.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int d;
vi c;
mti s;

void score(vi sched){
    vi last(26, 0);
    int score = 0;
    rep(t, d){
        int x = sched[t];
        last[x] = t + 1;
        score += s[t][x];
        rep(i, 26){
            score -= c[i] * (t + 1 - last[i]);
        }
        cout << score << endl;
    }
}

int main(){
    //CFS;
    cin >> d;
    c = vi(26);
    s = mti(d, vi(26));
    rep(i, 26) cin >> c[i];
    rep(i, d){
        rep(j, 26) cin >> s[i][j];
    }
    vi v(d);
    rep(i, d) cin >> v[i], v[i]--;
    score(v);
    return 0;
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 200010
const int MOD = 1000000007;

int visited[maxn];
set<int> g[maxn];

int dfs(int u) {
    int cur = 1;
    visited[u] = true;
    for (auto x : g[u]) {
        if (!visited[x]) {
            cur += dfs(x);
        }
    }
    return cur;
}

void solve() {
    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;

        g[a].insert(b);
        g[b].insert(a);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (!visited[i])
            ans = max(ans, dfs(i));
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 42648
#include<iostream>
#include<climits>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;

int main(){
	ll N,K;

	cin >> N >> K;

	ll ans = (N/K)*(N/K)*(N/K);

	if(K%2 == 0 && N >= K/2){
		ll hoge = (N-K/2)/K + 1;
		ans += hoge * hoge * hoge;
	}
	cout << ans << endl;
	return 0;
}

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

int main () {

    int N;
    cin >> N;

    int B[N-1];
    for (int i = 0; i < N-1; i++) {
        cin >> B[i];
    }

    int A[N];
    A[0] = B[0]; A[1] = B[0];
    for (int i = 1; i < N-1; i++) {
        A[i+1] = B[i];
        A[i] = min(A[i], A[i+1]);
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += A[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;




int main()
{
  int a,b,n; //かっている数//最大100
  cin >> n >> a >> b;


  if (n==1){
    cout << "Hello World";
  }else{
    cout << a+b;
  }



  return 0;
}



























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

using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i,n) for (ll i = 0; i < (n); i++)
#define ru(a,b) (((a)+((b)-1)) / (b))   //切り上げ(a/b)
#define dump(x)  cout << #x << " = " << (x) << endl;

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

	string rev(s);
	reverse(rev.begin(), rev.end());

	if (s.compare(rev)) {
		cout << "No" << endl;
		return 0;
	}

	size_t size = ((s.length() - 1) / 2);
	string s2 = s.substr(0, size);
	string rev2(s2);
	reverse(rev2.begin(), rev2.end());

	if (s2.compare(rev2)) {
		cout << "No" << endl;
		return 0;
	}

	string s3 = s.substr(((s.length() + 3) / 2)-1);
	string rev3(s3);
	reverse(rev3.begin(), rev3.end());

	if (s3.compare(rev3)) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<Integer,Integer> map =new HashMap<Integer,Integer>();
		int N= sc.nextInt();
		for (int i=0;i<N;i++) {
			int b = sc.nextInt();
			if (map.containsKey(b)==true) {
				map.remove(b);
			} else {
				map.put(b, 0);
			}
		}
		System.out.println(map.size());
	}
}

Measured memory_bytes: 61360
#include <stdio.h>

int roop(int n,int k)
{
	int i, H, x = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &H);
		if (k <= H) {
			x++;
		}
	}
	return x;
}
int main()
{
	int N,K,a;

	//人数
	scanf("%d", &N);
	//制限
	scanf("%d", &K);
	
	a = roop(N,K);

	printf("%d", a);
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>

#include <vector>
#include <algorithm>
#include <limits>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <queue>

typedef long long ll;

using namespace std;


int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll m1 = a * c;
    ll m2 = a * d;
    ll m3 = b * c;
    ll m4 = b * d;
    cout << max(m1, max(m2, max(m3, m4))) << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  cin >>n ;
  if(n/100 == n%10) cout <<"Yes\n";
  else cout <<"No\n";
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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

public class Main {
    static class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

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


    public static void main(String args[]) throws IOException {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int T = in.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int c = in.nextInt();
            int t = in.nextInt();
            if (c < min && t <= T)  
                min = c;
        }
        if(min == Integer.MAX_VALUE){
            out.print("TLE");
        } else {
            out.print(min);
        }
        out.close();
    }
}

Measured memory_bytes: 21460
n,k=map(int,input().split())
p=list(map(int,input().split()))
sw=0
sum=0
for i in range(n):
    for j in range(n-1):
        if p[j]>=p[j+1]:
            sw=p[j]
            p[j]=p[j+1]
            p[j+1]=sw
for i in range(k):
    sum+=p[i]
print(sum)

Measured memory_bytes: 9056
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll 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 main(){
    string s;
    cin>>s;
    int score=0, me=0;

    rep(i,0,s.length()){
        int you= (s[i]=='g')?0:1;
        score+=(me-you);
        //cout<<me <<you << score<<"\n";
        me=1-me;
    }
    cout<<score<<endl;

    return 0;
}


Measured memory_bytes: 512
import random
import copy
D=int(input())                                          #コンテの日数
c=list(map(int,input().split()))                        #26タイプ(AAC~AZC)のコンテストの満足度低下度
s=[list(map(int,input().split())) for _ in range(D)]    #s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
#types=[int(input()) for _ in range(D)]                  #コンテタイプ(1~26)
#満足度低下はΣ(1<=i<=26)ci*(d-last(d,i))                  #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
#よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
#i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
#last=[0]*26                                             #typeごとに、最後に使われた日にちを記録するよ
typ=0
ans=0
#greedyに最大とりまーす
#D=365
types=[(i%26)+1 for i in range(D)]
#print(l)
sc = [0] * D
last=[0]*26
for i in range(D):
    typ = types[i] - 1
    score = s[i][typ]
    dwn = 0
    last[typ] = (i + 1)
    for j in range(26):
        dwn = dwn + c[j] * ((i + 1) - last[j])
    ans = score - dwn
    # print(score,last)
    sc[i] = min(ans+10**6,0)
all = sum(sc)
for _ in range(800):
    types2 = []
    mi=float("inf")
    ind=0
    for i in range(D):
        if mi>sc[i]:
            mi=sc[i]
            ind=i
    l=list(range(1,27))
    #print(l)
    #print(ind,types[ind]-1)
    lab1=l.pop(types[ind]-1)
    lab2=random.choice(l)
    spans=ind//26
    types2=copy.deepcopy(types)
    for i in range(spans*26,min((spans+1)*26,D)):
        if types[i]==lab2:
            types[i]=lab1
            types[ind]=lab2
            break
    sc2=[0]*D
    last=[0]*26
    for i in range(D):
        typ = types[i] - 1
        score = s[i][typ]
        dwn = 0
        last[typ] = (i + 1)
        for j in range(26):
            dwn = dwn + c[j] * ((i + 1) - last[j])
        ans = score - dwn
                # print(score,last)
        sc2[i] = min(ans+10**6,0)
    all2 = sum(sc2)
    if all2<=all:
        types=types2
    else:
        sc=sc2
        all=all2
        sc2=[]
        #print(114514)
    #print(max(all,all2))
    #input()
for i in range(D):
    print(types[i])



Measured memory_bytes: 80416
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using wgraph = vector<vector<pair<int, lint>>>;
const lint INF = 1001001001001001LL;
const lint MOD = 1000000007LL;
int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

void yes(){ cout << "yes" << endl; }
void Yes(){ cout << "Yes" << endl; }
void YES(){ cout << "YES" << endl; }
void no(){ cout << "no" << endl; }
void No(){ cout << "No" << endl; }
void NO(){ cout << "NO" << endl; }
void possible(){ cout << "possible" << endl; }
void Possible(){ cout << "Possible" << endl; }
void POSSIBLE(){ cout << "POSSIBLE" << endl; }
void impossible(){ cout << "impossible" << endl; }
void Impossible(){ cout << "Impossible" << endl; }
void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(int i = s; i < t; i++)
#define all(a) a.begin(),a.end()


// verified : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A
// 負辺があると動作しない?
// O(E log V)
template<typename T>
vector<T> dijkstra(vector<vector<pair<int, T>>> &g, int s){
     
    int n = g.size();
    // numeric_limits がうまく使えない場合は自分で INF を定義する.
    const auto inf = numeric_limits<T>::max();
    vector<T> dist(n, inf);
 
    using P = pair<T, int>;
    // 小さい順に取り出せる
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0;
    que.emplace(dist[s], s);
    while(!que.empty()){
        T cost;
        int node;
        tie(cost, node) = que.top();
        que.pop();
        if(dist[node] < cost) continue;
        for(auto &e : g[node]){
            auto next_cost = cost + e.second;
            int next_node = e.first;
            if(dist[next_node] <= next_cost) continue;
            dist[next_node] = next_cost;
            que.emplace(next_cost, next_node);
        }
    }
 
    return dist;
}

int main(){
  
  lint k; cin >> k;
  wgraph g(k);
  srep(i, 1, k){
    g[i].push_back({(i + 1) % k, 1});
    g[i].push_back({(i * 10) % k, 0});
  }

  cout << dijkstra(g, 1)[0] + 1 << endl;
  return 0;
}


Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

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

    if (d == 25) {
        cout << "Christmas" << endl;
    }
    else if (d == 24) {
        cout << "Christmas Eve" << endl;
    }
    else if (d == 23) {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (d == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }

    return 0;
}

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

int main(){
  long s,c; cin >> s >> c;
  long ans;
  if(s >= c){ //>=にしないと正解にならない
    ans = c/2;
  }else if(s != 0){
    ans = s + (c-2*s)/4;
  }else{
    ans = c/4;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m,d; cin >> m >> d;
    int ans = 0;
    REPP(i,m) REPP(j,d) {
        if(j/10>=2 && j%10>=2) ans += ((j/10) * (j%10) == i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// https://ei1333.github.io/luzhiled/
// http://beet-aizu.hatenablog.com/entry/2017/01/04/113233
// http://www.prefield.com/algorithm/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
using Graph = vector<vector<ll>>;
const ll INF = 1LL << 60;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << endl;} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#define in1(A) REP(i,A.size()) in(A[i]);
#define in2(A,B) REP(i,A.size()) in(A[i],B[i]);
#define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);}
#define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);}
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
struct Point{ ld x,y; };
ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // ２点間の距離 
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} 
ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗
inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ
template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
//-------------------------------------------------------------------------------------------------
int main(){
    init();
    ind(L);
    

    out(pow(L/3,3));
}

Measured memory_bytes: 256
//g++  5.4.0

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll min(ll a,ll b)
{
    return (a<=b?a:b);
}
int main(void)
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c);
    return 0;
}

Measured memory_bytes: 256
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main(void){
    ll n;
    ll ans = 0;
    cin >>n;
    rep(i,n+1){
        if(i%3 !=0 &&i%5 != 0)ans +=i;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  bool kisu = false;
  for (int i = 0; i < N; i ++) {
    int a;
    cin >> a;
    if (a % 2) kisu = true;
  }
  cout << (kisu ? "first" : "second") << endl;
}

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

int main()
{
    int r;
    cin >> r;
    if (r < 1200)
        cout << "ABC" << endl;
    else if (r < 2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;
    return 0;
}

Measured memory_bytes: 3560
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		Map<Integer,Long> map = new TreeMap<Integer,Long>();
		for(int i=0;i<n;i++){
			int ai = sc.nextInt();
			long bi = sc.nextLong();
			if(map.get(ai)!=null){
				bi += map.get(ai);
				map.remove(ai);
			}
			map.put(ai,bi);
		}
		int ans = 0;
		//Object[] mapkey = map.keySet().toArray();
		//Arrays.sort(mapkey);
		for(Integer key : map.keySet()){
			long b = map.get(key);
			k -= b;
			ans = key;
			if(k<=0) break;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 95620
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll k, t; cin >> k >> t;
    vi a(t);
    rep(i, t) cin >> a[i];
    sort(all(a), greater<ll>());

    ll left = a[0];
    for(ll i=1; i<t; i++){
        if(left >= a[i]) left -= a[i];
        else left = a[i]-left;
    }
    cout << max(0LL, left-1) << endl;
}

Measured memory_bytes: 3616
<?php
[$price, $kirai_num] = explode(' ', trim(fgets(STDIN)));
$kirai_list = explode(' ', trim(fgets(STDIN)));

$not_kirai_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
foreach ($kirai_list as $kirai) {
    unset($not_kirai_list[(int)trim($kirai)]);
}
$not_kirai_list = array_values($not_kirai_list);

$min_not_kirai = min($not_kirai_list);
$nonzero_min_not_kirai = $min_not_kirai === 0 ? $not_kirai_list[1] : $min_not_kirai; // 0のみは考慮しない

for ($i = 0, $cnt_i = strlen($price); $i<$cnt_i; $i++) {
    $p     = (int)(substr($price, $i, 1));
    $pay_p = null;
    foreach ($not_kirai_list as $not_kirai) {
        if ($p === $not_kirai) {
            $pay_p = $not_kirai;
            break;
        }
        if ($p < $not_kirai) {
            echo $not_kirai;
            echo str_repeat($min_not_kirai, $cnt_i - $i - 1);
            echo "\n";
            exit;
        }
    }
    if (is_null($pay_p)) {
        // 桁上げ処理
        echo $i === 0 ? $nonzero_min_not_kirai : $min_not_kirai;
        echo str_repeat($min_not_kirai, $cnt_i - $i);
        echo "\n";
        exit;
    } else {
        echo $pay_p;
    }
}
echo "\n";


Measured memory_bytes: 16188
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <string>
#include <limits.h>
#include <iomanip>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <set>
#include <bitset>
#include <unordered_map>
#include <string.h>
#define fastIo                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define MOD 1000000007

using namespace std;
int main()
{
    fastIo;
    int x;
    cin>>x;
    if(x>=30)
        cout<<"Yes";
    else
    {
            cout<<"No";
    }
    

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int n;
  cin>>n;
  vector<int> a(n+1),b(n);
  for(ll i=0;i<=n;i++){cin>>a.at(i);}
  for(ll i=0;i<n;i++){cin>>b.at(i);}
  ll ans=0;
  for(ll i=1;i<=n;i++){
    if(b.at(i-1)<=a.at(i-1)){
      ans+=b.at(i-1);
    }else if(b.at(i-1)<=a.at(i-1)+a.at(i)){
      ans+=b.at(i-1);
      a.at(i)-=b.at(i-1)-a.at(i-1);
    }else{
      ans+=a.at(i-1)+a.at(i);
      a.at(i)=0;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
  int N, X;
  vector<int> x;

  cin >> N >> X;
  x.resize(N);
  for(auto& val : x){
    cin >> val;
  }

  int D;

  // 初期地点をリストに追加する
  x.push_back(X);

  // 最も差の小さい2地点間の距離を,探索する最大数とする
  sort(x.begin(), x.end());
  vector<int> distanceList;
  for (int i = 0; i < N ;i++){
    distanceList.push_back(x[i + 1] - x[i]);
  }

  // 2点間の距離の最小値を求める
  int min = -1;
  for (auto val : distanceList){
    if(min==-1 || val <min){
      min = val;
    }
  }

  // 最小値をDの上限として,ループ開始
  for (int i = min; i >= 1; i--){
    // 点xの全てに対して,mod i の値が X にmod iをした場合と一致すれば解
    int mem = X % i;
    bool success = true;
    for (auto val : x){
      if (val % i != mem){
        success = false;
      }
    }
    if(success == true){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int i,k=0,l;
int j=0;
string s;
cin>>s;
cin>>i;

for( j;j<100;j++)
{if(s[j]=='1')
k++;
if(s[j]!='1')
break;

}
if(k>=i)
cout<<1;
else
cout<<s[j];
}


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


using namespace std;


#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = long double;
const ld EPS = 1e-8;
const ll MOD = 1e9 + 7;
const ld PI = 3.141592653589793;
const int maxn = 10001;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

signed main() {
#ifdef zxc
    mt19937 mt(228);
//    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
//            freopen("", "r", stdin);
//        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(10);
    cout << fixed;
    auto start = chrono::steady_clock::now();

    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i - 1];
    }
    int mx = 0;
    for (int i = 0; i < n; ++i) {
        mx = max(mx, (a[(i + 1) % n] + k - a[i]) % k);
    }
    cout << k - mx;
    auto end = chrono::steady_clock::now();
    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



Measured memory_bytes: 1152
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, a: usize, b: usize};

    let s1 = n / (a + b);
    let s2 = n % (a + b);
    let s3 = if s2 > a { a } else { s2 };

    println!("{}", s1 * a + s3);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

template <class T> using vec_alias = ::std::vector<T>;
template <template <class> class Container> class union_find {
  protected:
    class node_type;

  public:
    using container_type = Container<node_type>;
    using size_type = typename container_type::size_type;

  protected:
    class node_type {
      public:
        typename union_find::size_type parent;
        typename union_find::size_type size;
    };

    container_type tree;

  public:
    union_find() : tree() {}
    explicit union_find(const size_type size) : tree(size, {0, 1}) {
        for(size_type i = 0; i < size; ++i)
            tree[i].parent = i;
    }

    bool empty() const { return tree.empty(); }
    size_type size() const { return tree.size(); }

    size_type find(size_type x) {
        assert(x < size());
        while(tree[x].parent != x)
            x = tree[x].parent = tree[tree[x].parent].parent;
        return x;
    }
    bool same(const size_type x, const size_type y) {
        assert(x < size());
        assert(y < size());
        return find(x) == find(y);
    }
    size_type size(const size_type x) {
        assert(x < size());
        return tree[find(x)].size;
    }

    ::std::pair<size_type, size_type> unite(size_type x, size_type y) {
        assert(x < size());
        assert(y < size());
        x = find(x);
        y = find(y);
        if(x != y) {
            if(tree[x].size < tree[y].size) ::std::swap(x, y);
            tree[x].size += tree[y].size;
            tree[y].parent = x;
        }
        return {x, y};
    }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    union_find<vec_alias> uf(N);
    vector<set<int>> co(N);

    int a, b;
    rep(i, M) {
        cin >> a >> b, a--, b--;
        co[a].insert(b);
        co[b].insert(a);
        uf.unite(a, b);
    }
    rep(i, K) {
        cin >> a >> b, a--, b--;
        if(uf.same(a, b)) {
            co[a].insert(b);
            co[b].insert(a);
        }
    }
    rep(i, 0, N) {
        int k = 0;
        cout << uf.size(i) - co[i].size() - 1 << " ";
    }
    cout << endl;
}

Measured memory_bytes: 28252
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X;
  cin>>X;
  if(X==1||X==2||X==3) cout<<1<<endl;
  else{
    int N[X+1]={0};
    for(int i=2;i<10;i++){
      for(int j=2;pow(j,i)<=X;j++) N[int(pow(j,i))]++;
    }
    int ans=X;
    for(int i=X;;i--){
      if(N[i]!=0){
        ans=i;
        break;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
def solve(i,m):
	if m == 0:
		return True
	if i >= n:
		return False
	res = solve(i+1,m) or solve(i+1,m-A[i])
	return res

n = int(input())
A = input()
A = [int(s) for s in A.split()]
q = int(input())
m = input()
m = [int(s) for s in m.split()]

ans = []
s = sum(A)
for mm in m:
	if s < mm:
		ans.append('no')
	else:
		ans.append({True:'yes',False:'no'}[solve(0,mm)])
#ans = [{True:'yes',False:'no'}[solve(0,mm)] for mm in m]
print('\n'.join(ans))

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

vector<vector<ll>> dp(22,vector<ll>(101,0));
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,nums[101];
  cin >> n ;
  rep(i,n){
    cin >> nums[i] ;
  }
  dp[nums[0]][0] = 1;
  rep(j,n){
    rep(i,21){
        if(i - nums[j+1] >= 0){
          dp[i-nums[j+1]][j+1] += dp[i][j];
        }
        if(i + nums[j+1] <= 20){
          dp[i+nums[j+1]][j+1] += dp[i][j];
        }
    }
  }
//   rep(i,n){
//     rep(j,20){
//       cout << dp[j][i]<<" ";
//     }
//     cout << endl;
//   }
  cout << dp[nums[n-1]][n-2] << endl;
  return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool p(int x){
    if (x>=1&&x<=9)return 1;
    return 0;
}
int main(){
    scanf("%d%d",&n,&m);
    if (p(n)&&p(m))printf("%d\n",n*m);
    else printf("-1\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
int main(void) {
    ll x;
    cin >> x;
    ll ans = 0;
    ans += x/500*1000;
    ll t = x%500;
    ans += t/5*5;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

plus_a = [0] * n
minus_a = [0] * n
ans = 0
for i in range(n):
    if a[i] > 0:
        plus_a[i] = a[i]
    else:
        minus_a[i] = a[i]
    ans += plus_a[i]

ruiseki_plus = [0] * (n + 1)
ruiseki_minus = [0] * (n + 1)
for i in range(n):
    ruiseki_plus[i+1] = ruiseki_plus[i] + plus_a[i]
    ruiseki_minus[i+1] = ruiseki_minus[i] + minus_a[i]

min_decreasing = -float("inf")
for i in range(n-k+1):
    #黒で塗る場合
    tmp_plus = ruiseki_plus[i+k] - ruiseki_plus[i]
    tmp_minus = ruiseki_minus[i+k] - ruiseki_minus[i]
    min_decreasing = max(min_decreasing, -tmp_plus, tmp_minus)

print(ans + min_decreasing)

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

int main() {
  const int inf = 100000000;
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) cin >> s.at(i);
  vector<vector<int>> cost(n, vector<int>(n, inf));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        cost.at(i).at(j) = 0;
      } else if (s.at(i).at(j) == '1') {
        cost.at(i).at(j) = 1;
      }
    }
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int d0 = cost.at(i).at(j), d1 = cost.at(i).at(k) + cost.at(k).at(j);
        if (d0 < inf && d1 < inf && abs(d1 - d0) % 2 == 1) {
          cout << -1 << endl;
          return 0;
        }
        cost.at(i).at(j) = min(d0, d1);
      }
    }
  }
  int dmax = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dmax = max(dmax, cost.at(i).at(j));
    }
  }
  cout << dmax + 1 << endl;
}

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

using namespace std;

int main(){

    int n,k;
    cin >> n >> k;

    vector<int> h(n);
    for(int i=0;i<n;i++)cin >> h.at(i);

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

    int diff = -1;
    for(int i=0;i<=n-k;i++){
        if((diff == -1) || (diff > (h.at(i+k-1)-h.at(i))))diff = h.at(i+k-1)-h.at(i);
    }

    cout << diff << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> v(n);//, v1(n);
    for (int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        v[i] = a;
    }
 //   v1 = v;
    int q;
    std::cin >> q;
    while(q--){
        int b, e, t;
        std::cin >> b >> e >> t;
        for (int i = b; i < e; i++){
            int tmp = v[i];
            v[i] = v[t + i - b];
            v[t + i - b] = tmp;
        }
//        v1 = v;
    }
    for (int i = 0; i < n; i++){
        std::cout << v[i];
        if (i < n - 1) std::cout << " ";
    }
    std::cout << std::endl;
}


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

class Main {
    
    static boolean go(int x) {
        String a = "" + x;
        StringBuffer sb = new StringBuffer(a);
        sb = sb.reverse();
        return a.equals(sb.toString());
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().trim().split(" ");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        int c = 0;
        for(int i=a; i<=b; i++) {
            if(go(i)) {
                c++;
            }
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 38980
#include <stdio.h>
#include <string.h>

#define LEN_WORD 100

int main (void)
{
	/* variables for main process */
	char buffer_word[LEN_WORD];
	int  len_target_word;

	// STEP.01
	// read out the targe word
	scanf( "%s", buffer_word );

	// STEP.02
	// get the length of the target word
	len_target_word = strlen( buffer_word );

	// STEP.03
	// output the shortened word
	printf( "%c%d%c\n", buffer_word[0], len_target_word-2, buffer_word[ len_target_word-1 ] );

	// STEP.TRUE_END
	return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
class Atcoder
{
    static void Main()
    {
        int b = 0;
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if (a[0] <= a[1]) b=1;
        for(int c = 0; c < a[b]; c++)
        {

            if (b == 0) Console.Write(a[1]);
            else Console.Write(a[0]);
        }
    }
}

Measured memory_bytes: 13268
#include "bits/stdc++.h"

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll LL_INF = LLONG_MAX;
const long double PI = (acos(-1));
const ull MOD = 1000000007;


struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    int X;
    cin >> X;
    for(int i = X; ;i++){
        if(IsPrime(i)){
            cout << i << endl;
            return 0;
        }
    }
}

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

using namespace std;

short checker[8][8][8][8][8][8][8];

struct Puzzle{

  short p[2][4];
  short lastorder;//1 ???  3?????? 5 ??????
  short ordernum;

};




int main(){

    queue<Puzzle> q;

    for(int a=0;a<8;a++){
      for(int b=0;b<8;b++){
        for(int c=0;c<8;c++){
          for(int d=0;d<8;d++){
            for(int e=0;e<8;e++){
              for(int f=0;f<8;f++){
                for(int g=0;g<8;g++){
                  checker[a][b][c][d][e][f][g] = -1;
                }
              }
            }
          }
        }
      }
    }

    checker[0][1][2][3][4][5][6] = 0;

    Puzzle Start;

    for(int i=0;i<2;i++){
      for(int j=0;j<4;j++){
        Start.p[i][j] = i*4 + j;
      }
    }

    Start.lastorder = 8;
    Start.ordernum = 0;

    q.push(Start);

    while(!q.empty()){

      Puzzle tmp;
      tmp = q.front();

      q.pop();

      short x,y;

      for(short i=0;i < 2; i++){
        for(short j=0;j < 4; j++){
          if(tmp.p[i][j] == 0){
            x = j;
            y = i;
          }
        }
      }

      tmp.ordernum++;

      short Beforeorder = tmp.lastorder;

      Puzzle puzzle = tmp;
      short t;

      if(x != 3 && Beforeorder != 3){

        swap(puzzle.p[y][x],puzzle.p[y][x+1]);

        if((checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]]) == -1){
          puzzle.lastorder = 1;
          q.push(puzzle);
          checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]] = tmp.ordernum;
        }
        swap(puzzle.p[y][x],puzzle.p[y][x+1]);
      }

      if(x != 0 && Beforeorder != 1){
        swap(puzzle.p[y][x],puzzle.p[y][x-1]);

        if((checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]]) == -1){
          puzzle.lastorder = 3;
          q.push(puzzle);
          checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]] = tmp.ordernum;
        }
        swap(puzzle.p[y][x],puzzle.p[y][x-1]);
      }

      if(Beforeorder !=  5){
        swap(puzzle.p[0][x],puzzle.p[1][x]);

        if((checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]]) == -1){
          puzzle.lastorder = 5;
          checker[puzzle.p[0][0]][puzzle.p[0][1]][puzzle.p[0][2]][puzzle.p[0][3]][puzzle.p[1][0]][puzzle.p[1][1]][puzzle.p[1][2]] = tmp.ordernum;
          q.push(puzzle);
        }
      }

    }

    short answer[8];

    while(1){
      cin >> answer[0];
      if(cin.eof())
        break;
      for(int i=1;i<8;i++){
        cin >> answer[i];
      }
      cout << checker[answer[0]][answer[1]][answer[2]][answer[3]][answer[4]][answer[5]][answer[6]] << endl;;

    }

    return 0;
}

Measured memory_bytes: 7260
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, p;
    cin >> n >> p;
    ll odd_num = 0;
    ll even_num = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if ( a&1 ) {
            ++odd_num;
        }
        else {
            ++even_num;
        }
    }
    ll ans = 0;
    if ( even_num == n ) {
        if ( p ) cout << 0 << endl;
        else     cout << (1LL<<n) << endl;
    }
    else {
        cout << (1LL<<n-1) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
const f = (function *F([W,H,x,y,r]) {
    yield {S: W, z : x + r};
    yield {S: W, z : x - r};
    yield {S: H, z : y + r};
    yield {S: H, z : y - r};
})(require('fs').readFileSync('/dev/stdin', 'utf8').split(' ').map(Number))

while (!(res = f.next()).done){
    if ([...Array(res.value.S+1).keys()].indexOf(res.value.z) === -1){
        console.log('No');
        return;
    }
}
console.log('Yes')


Measured memory_bytes: 15452
use std::io;

fn main() {
    let mut S = String::new();
    let mut N = String::new();
    io::stdin().read_line(&mut N);
    io::stdin().read_line(&mut S);
    let vecS :Vec<&str> = S.trim().split_whitespace().collect();
    let n :usize = N.trim().parse().unwrap();
    let mut total :u128 = 1;
    let mut a :u128 = 0;
    for i in 0..n{
        if vecS[i].parse::<u128>().unwrap() == 0{
            println!("0");
            return ();
        }    
    }
    for i in 0..n{
        a = vecS[i].parse().unwrap();
        total = total*a;
        if total > 1000000000000000000 {
            println!("-1");
            return ();
        }
    }
    println!("{}",total);
}


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
#define rep(i,n) for(i=0;i<n;i++)
#define repr(i,n) for(i=n-1;i>=0;i--)
#define FAST    ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
#define modd 998244353 

int main(){
FAST;
ll a,b,c,k; cin>>a>>b>>c>>k;
if(a>=k)cout<<k;
else if(a+b>=k)cout<<a;
else {
    ll g=k-(a+b);
    cout<<a-g;
}
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
char s[100010]={};
int Ans1,Ans2;
int main(){
	scanf("%s",s);
	for(int i=0;s[i]=='0'||s[i]=='1';i++){
	    if((i%2==0&&s[i]!='0')||(i%2==1&&s[i]!='1')) Ans1++;
	    if((i%2==0&&s[i]!='1')||(i%2==1&&s[i]!='0')) Ans2++;
    }
    printf("%d\n",min(Ans1,Ans2));
    return 0;
}

Measured memory_bytes: 384