akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define pb push_back
#define INF (1e9+1)

double w[200][201];
void solve(int ind,vector<pii> v){
	double *t = w[ind];
	t[0]=0;
	int cap=0,s,h;
	rep(i,v.size()){
		tie(s,h)=v[i];
		for(int j=cap+1;j<=min(200,cap+s*h);j++){
			t[j] = t[j-1]+1.0/s;
		}
		cap+=s*h;
	}
}

int main(){
	rep(i,200)rep(j,201)w[i][j]=-INF;
	int n,m;
	cin>>n>>m;
	rep(i,n){
		int k;
		cin>>k;
		vector<pii> v(k);
		rep(j,k)cin>>v[j].first>>v[j].second;
		solve(i,v);
	}
	
	double dp[201][201];
	rep(i,201)rep(j,201)dp[i][j]=-INF;
	dp[0][0] = 0;
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<=m;j++){
			for(int k=0;k<=j;k++){
				dp[i][j] = max(dp[i][j],dp[i-1][k]+w[i-1][j-k]);
			}
		}
	}
	printf("%.10lf\n",dp[n][m]);
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
bool M[1001][1001][1001] = {};
 
int main(){
    int X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<long long> A(X),B(Y),C(Z);
    rep(i,X) cin >> A[i];
    rep(i,Y) cin >> B[i];
    rep(i,Z) cin >> C[i];
    sort(A.begin(),A.end(),greater<long long>());
    sort(B.begin(),B.end(),greater<long long>());
    sort(C.begin(),C.end(),greater<long long>());
    priority_queue<vector<long long>> que;
    vector<long long> V = {A[0] + B[0] + C[0],0,0,0};
    M[0][0][0] = true;
    que.push(V);
    int k = 0;
    while(!que.empty() && k < K){
        k++;
        vector<long long> v = que.top();
        que.pop();
        cout << v[0] << endl;
        if(v[1] < X-1 && !M[v[1]+1][v[2]][v[3]]){
            vector<long long> x = {A[v[1] + 1] + B[v[2]] + C[v[3]],v[1]+1,v[2],v[3]};
            que.push(x);
            M[v[1]+1][v[2]][v[3]] = true;
        }
        if(v[2] < Y-1 && !M[v[1]][v[2]+1][v[3]]){
            vector<long long> x = {A[v[1]] + B[v[2]+1] + C[v[3]],v[1],v[2]+1,v[3]};
            que.push(x);
            M[v[1]][v[2]+1][v[3]] = true;
        }
        if(v[3] < Z-1 && !M[v[1]][v[2]][v[3]+1]){
            vector<long long> x = {A[v[1]] + B[v[2]] + C[v[3]+1],v[1],v[2],v[3]+1};
            que.push(x);
            M[v[1]][v[2]][v[3]+1] = true;
        }
    }
 
    return 0;
}

Measured memory_bytes: 411008
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,K=rl()
print(N-K+1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  int sum = 1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a = sum * 2;
    int b = sum + k;
    if (a > b) sum = b;
    else sum = a;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
void main()
{
    long n, q;
    rdVals(n, q);

    bool[] ball = new bool[n];
    ball[0] = ball[1] = true;
    long now;
    foreach (i; 0 .. q)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        if (now == a) now = b;
        else if (now == b) now = a;
        swap(ball[a], ball[b]);
        if (now) ball[now-1] = true;
        if (now < n - 1) ball[now+1] = true;
    }

    ball.count(true).writeln;
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 3452
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    ll t=0;
    while (A>0 && C>0)
    {
        if(t%2==0)
        {
            C-=B;
        }
        else
        {
            A-=D;
        }
        t++;
    }
    if(A>0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3808
def a_multiple_array_(N, A, B):
    ans = 0  # ボタンを押した回数
    for k in range(N - 1, -1, -1):  # 末尾から貪欲に決めていく
        remainder = (A[k] + ans) % B[k]  # A[k]+ansが現在のA[k]の値
        if remainder != 0:  # 定義の仕方より、reminderは非負整数
            ans += B[k] - remainder
    return ans

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
print(a_multiple_array_(N, A, B))

Measured memory_bytes: 11096
n,m=list(map(int,input().split()))
N=[list(input()) for _ in range(n)]
M=[list(input()) for _ in range(m)]

for i in range(n-m+1):
  for j in range(n-m+1):
    count = 0
    for k in range(m):
      for l in range(m):
        if N[i+k][j+l] == M[k][l]:
          count += 1
    if count == m**2:
      print("Yes")
      exit()
    
print("No")

Measured memory_bytes: 9208
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll       long long
#define DS       pair<ll, ll>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e6 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //brute();
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}


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

int main() {
    int x, y = 0;
    while(true) {
        cin >> x >> y;
        if (x == 0 && y == 0) {
            break;
        }
        if (y > x) {
            cout << x << ' ' << y << endl;
        } else {
            cout << y << ' ' << x << endl;
        }
    }

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  bool is_prime[101];
  fill(is_prime,is_prime+101,true);
  is_prime[0] = false;
  is_prime[1] = false;
  vector<int> P;
  for(int i = 2; i*i <= 100; ++i){
    if(not is_prime[i]) continue;
    for(int j = i; j*i <= 100; ++j){
      is_prime[i*j] = false;
    }
  }
  for(int i = 2; i <= 100; ++i){
    if(is_prime[i]) P.push_back(i);
  }
  int p = P.size();
  vector<int> C(p,0);
  for(int i = 2; i <= N; ++i){
    int t = i;
    for(int j = 0; j < p; ++j){
      while(t%P[j] == 0) ++C[j], t/=P[j];
    }
  }
  vector<int> DP(76,0);
  DP[1] = 1;
  for(int i = 0; i < p; ++i){
    vector<int> DP_(76,0);
    for(int j = 0; j <= 75; ++j){
      if(not DP[j]) continue;
      for(int k = 0; k <= C[i]; ++k){
        if(j*(k+1)>75) break;
        DP_[j*(k+1)] += DP[j];
      }
    }
    DP = DP_;
  }
  cout << DP[75] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int k;
int main() {
  ios::sync_with_stdio(false);
  cin>>k;
  set<pair<LL,int>>q;
  if(k<=9)return cout<<k<<endl,0;
  for(int i=1;i<=9;i++){
    q.insert({i,i});
  }
  while(k){
    auto x=q.begin();
    --k;
    int l=(*x).se;
    LL r=(*x).fi;
    if(!k)return cout<<r<<endl,0;
    if(l-1>=0)q.insert({r*10+l-1,l-1});
    q.insert({r*10+l,l});
    if(l+1<=9)q.insert({r*10+l+1,l+1});
    q.erase(x);
  }
  return 0;
}

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

namespace AtCoder.DP
{
    class EDPC_G
    {
        public static void Main()
        {
            var nm = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var n = nm[0];
            var m = nm[1];

            var nodes = new List<int>[n];
            var inN = new int[n];

            for (int i = 0; i < m; i++)
            {
                var xy = Console.ReadLine().Split(' ').Select(s => int.Parse(s) - 1).ToArray();
                if (nodes[xy[0]] == null)
                    nodes[xy[0]] = new List<int>();
                if (nodes[xy[1]] == null)
                    nodes[xy[1]] = new List<int>();
                nodes[xy[0]].Add(xy[1]);
                inN[xy[1]]++;
            }

            var queue = new Queue<int>();
            for (int i = 0; i < n; i++)
                if (nodes[i] != null && inN[i] == 0)
                    queue.Enqueue(i);

            int startN = queue.Count;

            var sorted = new List<int>();
            while (queue.Any())
            {
                var i = queue.Dequeue();
                sorted.Add(i);

                foreach (var j in nodes[i])
                {
                    inN[j]--;
                    if (inN[j] == 0)
                        queue.Enqueue(j);
                }
            }

            var longestParitial = new int[n];
            for (int i = sorted.Count - 1; i >= 0; i--)
            {
                if (!nodes[sorted[i]].Any())
                    continue;
                longestParitial[sorted[i]] = nodes[sorted[i]].Max(j => longestParitial[j]) + 1;
            }

            var longest = 1;
            for (int i = 0; i < startN; i++)
                if (longest < longestParitial[sorted[i]])
                    longest = longestParitial[sorted[i]];

            Console.WriteLine(longest);
        }
    }
}


Measured memory_bytes: 24764
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}

int main(){
    int a, b;
    cin >> a >> b;

    if(a >= 10 || b >= 10){
        cout << -1 << endl;
        return 0;
    }

    cout << a * b << endl;

    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


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

  int n, a, b;
  cin >> n >> a  >> b;
  ll ans = 0;
  REP(i,n+1) {
    int tmp = digsum(i);
    if(a <= tmp && tmp <= b) ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def ngcd(li):
    temp=gcd(li[0], li[1])
    if len(li)-3 >=0:
        for i in range(2, len(li)):
            temp=gcd(temp, li[i])
    return temp


n=int(input())
a=[int(i) for i in input().split()]

l=[]
l.append(0)
for i in range(len(a)):
  l.append(gcd(l[i], a[i]))
r=[]
r.append(0)
for i in range(len(a)):
  r.append(gcd(r[i], a[n-i-1]))
#print(l)
#print(r)

ans=[]
for i in range(len(a)):
  ans.append(gcd(l[i], r[n-i-1]))

print(max(ans))


Measured memory_bytes: 14524
def solve(n, m):
    res_list = []
    if n % 2 == 1:
        for i in range(m):
            res_list.append([i + 1, 2 * m - i])
    else:
        k = (m + 1) // 2
        for i in range(k):
            res_list.append([i + 1, 2 * k - i])
        for i in range(m - k):
            res_list.append([2 * k + i + 1, 2 * m + 1 - i])
    return res_list


def main():
    n, m = map(int, input().split())
    res = solve(n, m)
    for r in res:
        print(" ".join([str(a) for a in r]))


def eval_res(n, ab_list):
    eval_dict = dict()
    for a, b in ab_list:
        d = (a - b) % n
        if d in eval_dict.keys():
            return False
        eval_dict[d] = 1
        d = (b - a) % n
        if d in eval_dict.keys():
            return False
        eval_dict[d] = 1
    return True


def test():
    assert eval_res(4, solve(4, 1))
    assert eval_res(7, solve(7, 3))


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 22140
# -*- coding: utf-8 -*-
# get a integer
n = int(raw_input())

ls_t = map(int, raw_input().split())
ls_a = map(int, raw_input().split())

max_m1 = max(ls_t)
max_m2 = max(ls_a)

if max_m1 != max_m2 or ls_t.index(max_m1)  + list(reversed(ls_a)).index(max_m2) >= n or sorted(ls_t) != ls_t or sorted(ls_a) != list(reversed(ls_a)):
    print '0'
else:
    idx = ls_t.index(max_m1)
    def get_same_ls(ls):
        if len(ls) == 0:
            return []
        prev = ls[0]
        out = []
        for i in ls[1:]:
            if i == prev:
                out.append(i)
            else:
                prev = i
        return out
    ls_mult = get_same_ls(ls_t[:idx]) + get_same_ls(list(reversed(ls_a))[:n-idx-1])
    mult = 1
    m = pow(10, 9) + 7
    for i in ls_mult:
        mult = mult * i % m
    print mult


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y;
    cin >> x >> y;
    if(y%2==0 && y>=2*x && y<=4*x) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }
const int N = 100 + 5,M = 1050,P = 1e9 + 7;
int n,m;

int f[N][M],g[N][M];
inline void upd(int &x,int y){ x+=y; x>=P?x-=P:0; x<0?x+=P:0; }
inline void DP(int L){
	int i,j,k;
//	cout <<"DP " << endl;
//	for (i = 1; i <= n; ++i,cout << endl)
//	for (j = 1; j <= m; ++j) cout <<f[i][j] << ' ';
	
	for (i = 1; i <= n; ++i)
	for (j = 1; j <= m; ++j) g[i][j] = f[i][j],f[i][j] = 0;
	for (i = 1; i <= n; ++i)
	for (j = 1; j <= m; ++j) if (g[i][j]>0){
		upd(f[i+1][j+L],1ll*(i+1)*g[i][j]%P);
		upd(f[i][j],1ll*g[i][j]*(P+j-i*(L-1))%P);
		for (k = 1; k < L; ++k) upd(f[i][j+k],2ll*g[i][j]%P*i%P);
		for (k = 0; k < L-1; ++k) upd(f[i-1][j+k],1ll*g[i][j]*(L-k-1)%P*(i-1)%P);
	}
}
int a[N];
int main(){
	int i,j;
	int rm;
	read(n),read(m); for (i = 1; i <= n; ++i) read(a[i]),++a[i]; rm = m; m += 1;
	sort(a+1,a+n+1); reverse(a+1,a+n+1);
	memset(f,0,sizeof(f)); f[1][a[1]] = 1;
	for (i = 2; i <= n; ++i) DP(a[i]);
	
//	cout <<"DP " << endl;
//	for (i = 1; i <= n; ++i,cout << endl)
//	for (j = 1; j <= m; ++j) cout <<f[i][j] << ' ';
	int ans = 0;
	for (i = 1; i <= 1; ++i) ans += f[i][rm+i],ans %= P;
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1152
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import deque
K = ii()

#l = deque([1,2,3,4,5,6,7,8,9])
l = [1,2,3,4,5,6,7,8,9]
for i in range(K-9):
    a = l[i]
    b = int(str(a)[-1])
    if b!=0 and b != 9:
        for k in range(b-1, b+2):
            l.append(int(str(a)+str(k)))
    elif b==0:
        for k in range(b, b+2):
            l.append(int(str(a)+str(k)))
    else:
        for k in range(8, 10):
            l.append(int(str(a)+str(k)))

print(l[K-1])

Measured memory_bytes: 14588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[100010];
int main(){
  cin >> n;
  for (int i = 0 ; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  ll sum = a[0];
  int now = 0;
  for (int i = 1 ; i < n; i++ ) {
    if (sum * 2 < a[i]) {
      now = i;
    }
    sum += a[i];
  }
  cout << n - now << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;

//const int MAXN = (int)1e5 + 5;


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n;
    cin >> n;
    set<int> st;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        st.insert(x);
    }

    if (st.size() == n) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}

Measured memory_bytes: 12980
package main

import(
	"os"
	"bufio"
	"strconv"
	"fmt"
)

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	b, _ := strconv.Atoi(sc.Text())
	if a == b{
		fmt.Println("a == b")
	} else if a < b{
		fmt.Println("a < b")
	} else if a > b{
		fmt.Println("a > b")
	}
}


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

// 左に落ちたら-1, 右に落ちたら1, 落ちなかったら0
int trace(string s, const vector<char> &t, const vector<char> &d, int k){

    char current_masu = s[k];
    for(int i = 0; i < t.size(); i++){
        if(current_masu == t[i]){
            if(d[i] == 'L') k--;
            else k++;
            current_masu = s[k];
        }     
    }
    
    if(k < 0) return -1;
    else if(k >= s.length()) return 1;
    else return 0;
}

int main(){

    int N, Q;
    cin >> N >> Q;
    string s;
    cin >> s;
    vector<char> t(Q), d(Q);
    for(int i = 0; i < Q; i++) cin >> t[i] >> d[i];

    int min = 0, max = N;
    int left = min;
    while(min <= max){
        int half = (min + max + 1) / 2;
        if(trace(s, t, d, half) == -1){
            min = half + 1;
            left = std::max(left, half);
        }else{
            max = half - 1;
        }
    }

    min = 0, max = N;
    int right = max;
    while(min <= max){
        int half = (min + max + 1) / 2;
        if(trace(s, t, d, half) == 1){
            max = half - 1;
            right = std::min(right, half);
        }else{
            min = half + 1;
        }
    }

    if(right - left - 1 < 0) cout << 0 << endl;
    else cout << right - left - 1 << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

const int MAXN = 100010;

int n;
char s[MAXN];

char t[MAXN];

int calc(char c)
{
	int tn = n;
	for (int i = 1; i <= n; ++ i)
		t[i] = s[i];
	
	for (int cur = 0; cur <= n; ++ cur)
	{
		int flag = 0;
		for (int i = 1; i <= tn; ++ i)
			if (t[i] != c) flag = 1;
		if (!flag) return cur;
		for (int i = 1; i < tn; ++ i)
		{
			if (t[i] != c)
				t[i] = t[i+1];
		}
		tn --;
	}
}

int main()
{
	
	scanf("%s", s+1);
	n = strlen(s+1);
	set<char> H;
	for (int i = 1; i <= n; ++ i)
		H.insert(s[i]);
	int ans = n-1;
	for (auto c : H)
	{
		ans = min(ans, calc(c));
	}
	cout << ans << endl;
	
	return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;

int n;

const int maxn = 2e5 + 5;
bool vis[maxn];
int a[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    multiset<int> s;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        s.insert(a[i]);
    } 
    int cnt = 0;
    while(!s.empty()){
        auto it = s.end();
        it--;
        int val = *it;
        s.erase(it);
        for(int p = 31;p >= 1;p--){
            int x = (1LL << p) - val;
            if(s.find(x) != s.end()){
                auto it = s.find(x);
                s.erase(it);
                cnt++;
                break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n;
    cin >> n;
    int j=0;
    for (int i=1; i<=n; ++i)
    {
        int f;
        cin >> f;
        if (i%2==1 && f%2==1)
            j+=1;
    }
    cout << j << endl;
}


Measured memory_bytes: 3632
import sys


def input():
    return sys.stdin.readline()[:-1]


N = int(input())
P = []
for _ in range(N):
    x, y, h = list(map(int, input().split()))
    P.append([x, y, h])

for i in range(N):
    x, y, h = P[i]
    for cx in range(101):
        for cy in range(101):
            H = h + abs(x-cx)+abs(y-cy)
            if all(h == max(H - abs(x - cx) - abs(y - cy), 0) for x, y, h in P):
                print(cx, cy, H)
                exit(0)


Measured memory_bytes: 3188
K = int(input())
A = list(map(int, input().split()))
d=A[1]-A[0]+1
ok=0

for i in range(d):
    if A[0]%K==0:
        print("OK")
        ok+=1
        break
    else:
        a=A[0]
        A[0]=a+1

if ok==0:
    print("NG")


Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
char s[1005];

int main() {
  scanf("%s",s);
  printf("%s",s);
  int b=strlen(s)-1;
  if(s[b]=='s') {
    printf("es");
  }else {
    printf("s");
  }
  return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

ll gcd(ll a, ll b)
{
	if (a < b) swap(a, b);
	return (a%b ? gcd(a%b, b) : b);
}

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

void extgcd(ll a, ll b, ll& x, ll& y)
{
	if (b != 0) { extgcd(b, a % b, y, x); y -= a / b * x; }
	else { x = 1; y = 0; }
}


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll n, m; cin >> n >> m;
	ll l = lcm(n, m);
	string s, t; cin >> s >> t;
	map<ll, char > mp;
	REP(i, n)
	{
		mp[l / n * i] = s[i];
	}
	REP(i, m)
	{
		int p = l / m * i;
		if (mp.count(p) && mp[p] != t[i])
		{
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 6144
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let mut nowmax = 0;
    let mut ans = 0;
    for &ai in &a {
        if nowmax <= ai {
            nowmax = ai;
        } else {
            // nowmax > ai
            ans += nowmax - ai;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 5584
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  int a=0,b=0,c=0;
  for(int i = 0;i < S.size();i++) {
    if(S.at(i) == 'a') a++;
    if(S.at(i) == 'b') b++;
    if(S.at(i) == 'c') c++;
  }

  while(a!=0&&b!=0&&c!=0) {
    a--;
    b--;
    c--;
  } 

  int maxi = max(a,max(b,c)),mini = min(a,min(b,c));
  int mid = a+b+c-maxi-mini;
  if(maxi > 1 || mini > 1) {
    cout << "NO" << endl;
  }else {
    cout << "YES" << endl;
  }
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b; 
  cin >> a >> b;
  /* (a + b) /2 :整数部
     (a + b) % 2 :~.5となるときあまり1となるのでこれで切り上げる */
  cout << (a + b) /2 + (a + b) % 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100
int n,M[N][N];
int color[N],d[N],f[N],tt;
void dfs_b(int u){
        int i,j,v;
        color[u]=GRAY;
        d[u]= ++tt;
        for(v=0; v<n; v++) {
                if(M[u][v]==0) {
                        continue;
                }
                if(color[v]==WHITE) {
                        dfs_b(v);
                }
        }
        color[u]=BLACK;
        f[u]=++tt;
}
void dfs_a(){
        int u;
        for(u=0; u<n; u++) {
                color[u]=WHITE;
        }
        tt=0;
        for(u=0; u<n; u++) {
                if(color[u]==WHITE) {
                        dfs_b(u);
                }
        }
        for(u=0;u<n;u++){
          printf("%d %d %d\n",u+1,d[u],f[u]);
        }

}
int main(){
        int u,k,v;
        int i,j;


        scanf("%d",&n);
        for(i=0; i<n; i++) {
                for(j=0; j<n; j++) {
                        M[i][j]=0;
                }
        }
        for(i=0; i<n; i++) {
                scanf("%d%d",&u,&k);
                u--;
                for(j=0; j<k; j++) {
                        scanf("%d",&v);
                        v--;
                        M[u][v]=1;
                }
        }
        dfs_a();
        // for(i=0; i<n; i++) {
        //         for( j=0; j<n; j++) {
        //                 printf("%d",M[i][j]);
        //                 if(j==n-1)
        //                         printf("\n");
        //                 else
        //                         printf(" ");
        //         }
        //
        // }
        return 0;
}

Measured memory_bytes: 636
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;
// Sol 2A
// forward dp
// enumerating items from beginning (z = 0..N)
// inner loop is looping items
long long solve(int N, int W, int *v, int *w) {
  // items are 0 indexed, 0..N-1'th items
  // dp[a][b] = solution for a knapsack of weight a,
  // only can use items until and excluding b'th item
  long long dp[W + 1][N + 1];
  memset(dp, 0, sizeof(long long) * (W + 1) * (N + 1));

  for (int q = 0; q < W; ++q) {
    for (int z = 0; z < N; ++z) {
      dp[q + 1][z + 1] = max( //
          dp[q + 1][z],       //
          q + 1 - w[z] >= 0 ?     //
              (v[z] + dp[q + 1 - w[z]][z])
                        : 0);
    }
  }

  return dp[W][N];
}

int main() {
  int N, W;
  cin >> N >> W;
  int v[N], w[N];
  for (int q = 0; q < N; ++q)
    cin >> w[q] >> v[q];

  long long ans = solve(N, W, v, w);
  cout << ans << '\n';
}


Measured memory_bytes: 79104
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    int[] l = na(n);
    Arrays.sort(l);


    int ptr = 0;

    long ret = 0;
    for (int i = 0; i < n; i++) {
      ptr = i;
      for (int j = i + 1; j < n; j++) {
        int a = l[i];
        int b = l[j];
        // a <= b <= c
        // a + b > c

        while (ptr < n && a + b > l[ptr]) {
          ptr++;
        }
        int cnt = Math.max(0, ptr - j - 1);
        ret += cnt;
      }
    }
    System.out.println(ret);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 22868
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int a = sc.nextInt();
		int h[] = new int[n];
		for(int i= 0;i<h.length;i++){
			h[i] = sc.nextInt();
		}
		double tmp[] = new double[n];
		double tm=1000;
		int number=-1;
		for(int i=0;i<tmp.length;i++){
			tmp[i]=(double)t-(double)h[i]*0.006;
			if(tm>Math.abs(tmp[i]-a)){
				tm=Math.abs(tmp[i]-a);
				number = i;	
			}
		}
		number += 1;
		System.out.println(number);
	}
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main () {
  
 	 ll A , B ;
  	cin >> A >> B ;

  	if((ll)abs(A+B)%2 == 0) cout<<((ll)abs(A + B)/2)<<endl;
  	else cout<<"IMPOSSIBLE" ;
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int n,i,j,ans;
    ans=0;
    n=s.size();
    for(i=n-2;i>=0;i--){
       int l=i;
      if(i%2==1){
       for(j=i/2;j>=0;j--){
         if(j==0&&l==(i/2)+1&&s[j]==s[l]){
           ans=i;
           break;
         }
         if(s[j]==s[l]){
           l--;
         }else{
           break;
         }
       }
      }
      if(ans!=0){
        break;
      }
    }
  cout<<ans+1<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main()
{
  int setcount;
  float x1, y1, x2, y2, x3, y3;
  float nx1, ny1, nx2, ny2;
  float nr1, nr2;
  float xp, yp, r;
  float tmp;
  int i;

  scanf("%d", &setcount);
  for(i=0; i<setcount; i++){
    scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
    nx1=x2-x1; ny1=y2-y1;
    nx2=x3-x1; ny2=y3-y1;
    nr1=nx1*nx1+ny1*ny1; nr2=nx2*nx2+ny2*ny2;
    nr1*=0.5f; nr2*=0.5f;

    if(nx1==0.0f){
      nr1/=ny1; ny1=1.0f;
      nr2-=nr1*ny2; ny2=0.0f;
      nr2/=nx2; nx2=1.0f;
      tmp=nr1; nr1=nr2; nr2=tmp;
    }
    else if(nx2==0.0f){
      nr2/=ny2; ny2=1.0f;
      nr1-=nr2*ny1; ny1=0.0f;
      nr1/=nx1; nx1=1.0f;
    }
    else if(ny2==0.0f){
      nr2/=nx2; nx2=1.0f;
      nr1-=nr2*nx1; nx1=0.0f;
      nr1/=ny1; ny1=1.0f;
      tmp=nr1; nr1=nr2; nr2=tmp;
    }
    else {
      //normalize
      ny1/=nx1; nr1/=nx1; nx1=1.0f;
      //subtraction
      ny2-=ny1*nx2; nr2-=nr1*nx2; nx2=0.0f;
      //normalize
      nr2/=ny2; ny2=1.0f;
      //subtraction
      nr1-=nr2*ny1; ny1=0.0f;
    }

    xp=nr1+x1; yp=nr2+y1;
    r=sqrt(nr1*nr1+nr2*nr2);
    printf("%.3f %.3f %.3f\n", xp, yp, r);
  }

  return 0;
}

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

int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int low=max(a,c);
	int high=min(b,d);
cout<<max(0,high-low)<<"\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD = 1000000007;
#define INF (1e9)
#define print(x) cout << x << endl;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc") {
        print("Yes");
    } else print("No");
    return 0;
}


Measured memory_bytes: 256
# vim: fileencoding=utf-8


def main():
    n = int(input())
    li = [0] * 102
    for i in range(n):
        d = int(input())
        li[d] = 1
    ans = 0
    for i in range(102):
        if li[i] == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62512
//Author: AnandRaj uux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	string s;
	cin>>s;
	int n=s.length();
	bool one=true,two=true;
	int k=n/2;
	int l=(n+1)/2;
	int len=n/2;
	for(int i=0;i<k;i++)
	{
		if(s[i]!=s[len-1-i]) one=false;
	}
	if(one)
	{
		for(int i=0;i<k;i++)
		{
			if(s[i]!=s[l+i]) two=false;
		}
		if(two)
		{
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
	else cout<<"No"<<endl;
}		

Measured memory_bytes: 256
import sys
N, M = map(int, sys.stdin.readline().rstrip().split())

bridge = [
    tuple(map(int,
              sys.stdin.readline().rstrip().split())) for _ in range(M)
]
bridge = sorted(bridge, key=lambda x: x[1])

ans = 0
t = 0
for a, b in bridge:
    if a >= t:
        ans += 1
        t = b
print(ans)

Measured memory_bytes: 57820
#include<bits/stdc++.h>
#define int long long
const int inf=8938103643641919514ll;
const int mod=1000000007ll;
const int dd[]={0,-1,0,1,0};
using namespace std;
int a,b,c,d;
signed main(){
	int i,j;
	cin>>a>>b>>c;
	if(b>c){
		cout<<0<<endl;
		return 0;
	}
	if(b==c){
		cout<<1<<endl;
		return 0;
	}
	if(a==1){
		cout<<0<<endl;
		return 0;
	}
	cout<<(c-b)*(a-1)+(b-c)+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
bool inline isPalindromicNew(int n)
{
    string s = to_string(n);
    if (s[0] == s[4] and s[1] == s[3])
    {
        return true;
    }

    return false;
}
bool inline isPalindromic(int n)
{
    vi digits(5);
    rep(i, 0, 5)
    {
        digits[i] = n % 10;
        n /= 10;
    }
    if (digits[0] == digits[4] and digits[1] == digits[3])
    {
        return true;
    }
    return false;
}
int main()
{
    //freopen("B.01.in","r",stdin);
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    int a, b, all = 0,temp;
    scanf("%d %d", &a, &b);
    rep(i, 1, 10)
    {
        rep(j, 0, 10)
        {
            rep(k, 0, 10)
            {
                temp=i*10000+j*1000+k*100+j*10+i;
                if(temp<=b and temp >= a){
                    all++;
                }
            }
        }
    }
    printf("%d\n", all);
    return 0;
}
// int main()
// {
//     //freopen("B.01.in","r",stdin);
//     // ios_base::sync_with_stdio(false);
//     // cin.tie(NULL);
//     vi digits(5);
//     int a, b, all = 0;
//     // cin >> a >> b;
//     scanf("%d %d", &a, &b);
//     rep(i, a, b + 1)
//     {
//         if (isPalindromicNew(i))
//         {
//             all++;
//         }
//     }
//     // cout << all << endl;
//     printf("%d\n", all);
//     return 0;
// }

Measured memory_bytes: 3824
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>

using namespace std;

#define rep(i,N) for(int i=0;i<N;i++) //0から


typedef long long ll;




ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    //a>=b
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

#define MOD ((ll)1e+9 + 7)



//cout<<fixed<<setprecision(10);
int main(){
    ll a;
    string s;
    cin>>a>>s;
    
    ll b=100*(s[0]-'0') + 10*(s[2]-'0') + s[3]-'0';
    ll ans=a*((ll)b);
    ans/=100;
    cout<<ans<<endl;



    return 0;
}



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		String[] nl = n.split("");
		if (nl[0].equals(nl[2])) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 21844
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    s = S()
    a = []
    t = 0
    for c in s:
        if c == '#':
            t += 1
        a.append(t)
    b = []
    t = 0
    for c in s[::-1]:
        if c == '.':
            t += 1
        b.append(t)
    b = b[::-1]
    r = inf
    for i in range(n):
        t = a[i] + b[i]
        if r > t:
            r = t

    return r - 1


print(main())



Measured memory_bytes: 17232
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef vector<xy_t> polygon;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b-=a, c-=a;
	if(cross(b, c) > 0) return 1;
	if(cross(b, c) < 0) return -1;
	if(dot(b, c) < 0) return 2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

bool intersectSS(const line &l, const line &m){
	return ccw(l.first, l.second, m.first) * ccw(l.first, l.second, m.second) <= 0 &&
		ccw(m.first, m.second, l.first) * ccw(m.first, m.second, l.second) <= 0;
}

bool intersectPOP(const polygon &pol, const xy_t &p){
	bool in = false;
	int n = pol.size();
	rep(i, n){
		xy_t a = pol[i] - p, b = pol[(i+1)%n] - p;
		if(imag(a) > imag(b)) swap(a, b);
		if(imag(a) < EPS && 0 < imag(b) && cross(a, b) < 0) in = !in;
		if(abs(cross(a, b)) < EPS && dot(a, b) < EPS) return true;
	}
	return in;
}

int intersectPOPO(const polygon &p1, const polygon &p2){
	int n = p1.size();
	int m = p2.size();
	rep(i, n) rep(j, m) if(intersectSS(line(p1[i], p1[(i+1)%n]), line(p2[j], p2[(j+1)%m]))) return 1;
	rep(i, n) if(intersectPOP(p2, p1[i])) return 2;
	rep(i, m) if(intersectPOP(p1, p2[i])) return 3;
	return 0;
}

polygon pols[200];
bool g[200][200];
bool used[200];

void dfs(int v){
	used[v] = true;
	rep(i, 200){
		if(g[v][i] && !used[i]){
			used[i] = true;
			dfs(i);
		}
	}
}

int main(){
	int n, m;
	int x, y;
	while(cin >> n && n){
		rep(k, n){
			cin >> m;
			memset(g, false, sizeof(g));
			memset(used, false, sizeof(used));
			rep(i, m){
				rep(j, 4){
					cin >> x >> y;
					pols[i].push_back(xy_t(x, y));
				}
			}
				
			rep(i, m){
				rep(j, m){
					if(intersectPOPO(pols[i], pols[j])){
						g[i][j] = true;
						g[j][i] = true;
					}
				}
			}
			int res = 0;
			rep(i, m) if(!used[i]){
				res++;
				dfs(i);
			}
			cout << res << endl;
			rep(i, 200) pols[i].clear();
		}
	}
	return 0;
}

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

map<ll, ll> PrimeFactorization(ll n) {
  map<ll, ll> m;
  for (int i = 2; i*i <= n; i++) {
    while (n%i == 0) {
      m[i]++;
      n /= i;
    }
  }
  if (n != 1) m[n]++;
  return m;
}

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

  int n;
  cin >> n;

  map<ll, ll> m;
  rep(i, n) {
    for (auto&& j : PrimeFactorization(i+1)) {
      m[j.first] += j.second;
    }
  }

  ll ans = 1;
  const int MOD = (int)1e9+7;
  for (auto&& i : m) {
    ans = ans*(i.second+1)%MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256