akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000
#define VMAX 100000

int P(int * , int , int);

int main(){
    int *A;
    int n, i, q;

    scanf("%d", &n);

    A = malloc(sizeof(int)*(n+1));

    /* your code */
    for(i = 1; i <= n; i++){
        scanf("%d",&A[i]);

    }

    q = P(A, 1, n);

    for(i = 1; i < n; i++){
        if(i == q) printf("[%d] ",A[i]);
        
        else printf("%d ",A[i]);
    }


    if(i == q) printf("[%d]\n",A[i]);
    else printf("%d\n",A[i]);

    free(A);




  return 0;
}

int P(int *A, int p, int r){
    int x, i, j, k, a;

    x = A[r];
    i = p-1;

    for(j = p; j < r; j++){
        if(A[j] <= x){
            i++;
            a = A[j];
            A[j] = A[i];
            A[i] = a;
        }
    }

    a = A[r];
    A[r] = A[i+1];
    A[i+1] = a; 

    return i+1;
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdint>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t N, P, Q;
    std::cin >> N;

    auto getValue = [&](){
        int64_t value = 0;
        for (int64_t i = 0; i < N; ++i) {
            if (i != 0) value *= 10;
            int64_t v;
            std::cin >> v;
            value += v;
        }
        return value;
    };

    P = getValue();
    Q = getValue();

    std::vector<int64_t> perm(N);
    std::iota(perm.begin(), perm.end(), 1);
    int64_t P_pos = 0;
    int64_t Q_pos = 0;
    int64_t count = 1;
    do {
        int64_t value = 0;
        for (int64_t i = 0; i < perm.size(); ++i) {
            if (i != 0) value *= 10;
            value += perm.at(i);
        }
        if (P == value) P_pos = count;
        if (Q == value) Q_pos = count;
        count++;
    } while( next_permutation(perm.begin(), perm.end()) );

    std::cout << (std::abs(P_pos - Q_pos)) << std::endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
ans=deque()
ans.append(str(input()))
q=int(input())
l=[list(map(str,input().split())) for i in range(q)]
#print(l)
c=0
for i in range(q):
	if l[i][0]=='1':
		c+=1
	else:
		if c%2==0:
			if l[i][1]=='1':
				ans.appendleft(l[i][2])
			else:
				ans.append(l[i][2])
		else:
			if l[i][1]=='2':
				ans.appendleft(l[i][2])
			else:
				ans.append(l[i][2])
A="".join(map(str,list(ans)))
if c%2==1:
	print(A[::-1])
else:
	print(A)





Measured memory_bytes: 126328
#include<bits/stdc++.h>
using namespace std ;
string s ;
int main()
{

	cin >> s ;
	long long ans = 0 , j= s.size()-1 , sum = 0;
	for ( int i =s.size()-1 ; i>=0 ; i--)
		if ( s[i] == 'B' ) 
			sum += j-i , j-- ;
	cout << sum << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
vector<long long> tree(1e6,0);

long long getit(int ss,int se, int p, int l, int r){
    if(ss > se || ss > r || se < l)
        return (long long)0;
    if(l<= ss && se <= r)
        return tree[p];
    int mid = (ss+se)/2;
    return max(getit(ss,mid, 2*p, l, r), getit(mid+1,se, 2*p + 1,l,r));
}

void update(int ss,int se, int p, int l, long long val){
    if(ss > se)
        return ;
    if(ss == se)
    {
        tree[p] += val;
        return;
    }
    int mid = (ss+se)/2;
    if(l > mid)
        update(mid+1,se, 2*p+1 , l, val);
    else update(ss, mid, 2*p, l, val);
    tree[p] = max(tree[2*p],tree[2*p+1]);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    std::vector<int> h(n), bb(n);
    for(auto &x : h)
        cin>>x;
    for(auto &x : bb)
        cin>>x;
    long long ans = 0;
   for(int a= 0; a<n;a++){
        int l = h[a];
       
        long long tt = getit(1,n,1,1,l);
       // cout<<tt<<" "<<l<<endl;
        update(1,n,1,l,bb[a] + tt);
        ans = max(ans,(long long)bb[a]+(long long)tt);
   }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; 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 FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
//zaki_UnionFind
class UnionFind
{
    std::vector<int> data;

  public:
    UnionFind(int size) : data(size, -1) {}
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (data[y] < data[x])
                std::swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y)
    {
        return root(x) == root(y);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x)
    {
        return -data[root(x)];
    }
};

struct edge{
  	ll from, to, cost;
};

bool comp(const edge& e1, const edge& e2){
  	return e1.cost < e2.cost;
}

bool num(const edge& e1, const edge& e2){
  	return e1.from < e2.from;
}

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

  	ll n;
  	cin >> n;
    ll x, y;
    vector<edge> px, py;
    REP(i, n){
        cin >> x >> y;
        px.push_back(edge{x, y, i});
        py.push_back(edge{y, x, i});
    }
    sort(px.begin(), px.end(), num);
    sort(py.begin(), py.end(), num);
  	ll ax, bx, cx, ay, by, cy;
  	vector<edge> es;
  	REP(i, n - 1){
        ax = px[i + 1].cost, bx = px[i].cost;
        cx = min(abs(px[i + 1].from - px[i].from), abs(px[i + 1].to - px[i].to));
    	ay = py[i + 1].cost, by = py[i].cost;
        cy = min(abs(py[i + 1].from - py[i].from), abs(py[i + 1].to - py[i].to));
        es.push_back((edge){ax, bx, cx});
        es.push_back((edge){ay, by, cy});
  	}
  	sort(es.begin(), es.end(), comp);
  	ll res = 0;
  	UnionFind uf(n);
  		for(auto e : es){
    		if(!uf.find(e.from, e.to)){
      			uf.unite(e.from, e.to);
      			res += e.cost;
    		}
  		}
  	cout << res << endl;
  	return 0;
}


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

int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	int n; cin >> n;
	if (n == 7 or n == 5 or n == 3)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;   
}  


Measured memory_bytes: 256
i = input().split()
a = int(i[0])
b = int(i[1])
k = int(i[2])
c = a 
d = b

if k >= a+b:
  c = d = 0

elif k == a:
  c = 0

elif k > a:
  c = 0
  d = b - (k - a)

else:
  c = a - k
  
print(c,d)

Measured memory_bytes: 3064
N, M = (int(x) for x in input().split())
H = [int(x) for x in input().split()]
#AB = []
Nn = []
for i in range(1,N+1):
  Nn.append(i)
for i in range(M):
  A,B = (int(x) for x in input().split())
  if H[A-1] == H[B-1]:
      Nn[A-1] = 0
      Nn[B-1] = 0
  elif H[A-1] > H[B-1]:
      Nn[B-1] = 0
  else:
      Nn[A-1] = 0
n = set(Nn)
n.remove(0)
print(len(n))

Measured memory_bytes: 23708
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const int TLE=1000000000;

signed main(){
	int n,t;
	cin>>n>>t;
	string s;
	cin>>s;
	vi d;
	rep(i,0,s.size()){
		if('0'<=s[i] && s[i]<='9') d.push_back(s[i]-'0');
	}
	int ans=0,m;
	for(m=0;m<10;m++) if(pow(n,m)*t>TLE) break;
	rep(i,0,d.size()){
		if(d[i]>=m){
			ans=-1; break;
		}
		ans+=pow(n,d[i])*t;
	}
	if(ans>TLE) ans=-1;
	if(ans==-1) o("TLE");
	else o(ans);
}

Measured memory_bytes: 1268
n = int(input())
a = [int(x) for x in input().split()]

save = 1
ans = -1
tmp = []
for i in range(1,200000):
    tmp.append(i)

flag = False

for i in a:
    if save == i:
        if i == 1:
            ans += 1
            flag = True
        save += 1
    else:
        ans += 1
if a == tmp[:len(a)]:
    print(0)
else:
    if flag:
        print(ans)
    else:
       print(-1)

Measured memory_bytes: 26268
let () = Scanf.scanf "%d" @@ fun n ->
  Printf.printf "%d\n" @@ List.length @@
    List.filter (fun x -> ( = ) 8 @@
      List.length @@
        List.filter (fun i -> x mod i = 0) @@
          Array.to_list @@ Array.init x (( + ) 1)) @@
      List.filter (fun x -> x mod 2 = 1) @@
        Array.to_list @@ Array.init n (( + ) 1)

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using mint = modint998244353;

struct S {
    mint x, w;
    S(mint x = 0, mint w = 1): x(x), w(w){}
};

S op(S a, S b){ return S(a.x * b.w + b.x, a.w * b.w); }

S e() { return S(); }

S mapping(int f, S a){
    if(f == 0) return a;
    return S((a.w - 1)/9 * f, a.w);
}

int composition(int f, int g){
    if(f == 0) return g;
    return f;
}

int id(){ return 0; }

void Main(){
    int n, q; cin >> n >> q;
    lazy_segtree<S, op, e, int, mapping, composition, id> t(n);
    rep(i, n) t.set(i, S(1,10));
    while(q--){
        int l, r, d; cin >> l >> r >> d;
        l--;
        t.apply(l,r,d);
        S ans = t.all_prod();
        printf("%d\n", ans.x.val());
    }
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

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

  int main() {

    int N;
    cin >> N;
    unsigned long long int S = 1;
    unsigned long long int M = pow(10, 18);
    int zero = 0;
    int yaba = 0;

    vector<unsigned long long int> A(N);
    for (int i; i < N; i++)
    {
      cin >> A.at(i);
      if (A.at(i) == 0)
      {
        zero = 1;
        break;
      }   
      if (S > M / A.at(i))
       {
         yaba = 1;
       }
      S *= A.at(i);
    }


    if (zero == 1)
    {
      cout << "0" << endl;
    }
    else if (yaba == 0)
    {
      cout << S << endl;
    }
    else
    {
      cout << "-1" << endl;
    }
    


  }


Measured memory_bytes: 3964
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();


        out.println(a == b && b == c ? "Yes" : "No");
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

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

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 23380
int main(){
int W,H,x,y,r;
scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
if (x+r<=W && y+r<=H && y-r>=0 && x-r>=0){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
using namespace std;

int main(){
	int m,n;
	while(cin>>m>>n){
		cout<<(m-1)*(n-1)<<endl;
	}
	return 0;

}

	


		

	





		

	




Measured memory_bytes: 256
#include<stdio.h>
int main(){
        int a,b,c;
        int a2,b2,c2;
        int k;
        int i=0;
        int max=0;
        scanf("%d %d %d",&a,&b,&c);
        scanf("%d",&k);
        a2=a;
        for(i=k;i>0;i--){
                a2=a2*2;
        }
        max=a2+b+c;
        b2=b;
        for(i=k;i>0;i--){
                b2=b2*2;
        }
        if(max<a+b2+c)max=a+b2+c;
        c2=c;
        for(i=k;i>0;i--){
                c2=c2*2;
        }
        if(max<a+b+c2)max=a+b+c2;
        printf("%d\n",max);
        return 0;
}

Measured memory_bytes: 128
N = int(input())
count = 0
if 105 <= N <= 106:
  count = 1
elif N < 105:
  count = 0
else:
  count = 1
  for i in range(107, N + 1, 2):
    prime_count = 0
    for j in range(1, int(i ** (1/2)) + 1):
      if i % j == 0:
        prime_count += 1
        if i / j != j:
          prime_count += 1
    if prime_count == 8:
      count += 1
print(count)

Measured memory_bytes: 38768
n, k = map(int, input().split())


def Base_10_to_n(X, n):
    X_dummy = X
    out = ''
    while X_dummy > 0:
        out = str(X_dummy % n)+out
        X_dummy = int(X_dummy/n)
    return out

print(len(Base_10_to_n(n, k)))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int mo2 = 998244353;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
string str;
int main(){
    int n;
    cin>>n;
    vector<int> A(n),B(n);
    for(auto && a : A) cin>>a;
    for(auto && b : B) cin>>b;
    priority_queue<pair<int,int>> q;
    for(int i=0;i<n;++i)q.push({B[i],i});
    ll ret = 0ll;
    while(!q.empty()){
        auto cur = q.top();
        q.pop();
        int i=cur.second;
        if(B[i] < A[i]) break;
        if(A[i] == B[i]) continue;
        int l = (i+n-1)%n,r = (i+1)%n;
        int sum = B[l] + B[r];
        if(!sum) break;
        int num = (B[i] - A[i])/sum;
        ret += num;
        B[i] -= sum*num;
        if(num){
            q.push({B[i],i});
        }
    }
    
    for(int i=0;i<n;++i){
        if(A[i] != B[i])ret = -1;
    }
    cout << ret << endl;
    return 0;
}



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

int main(){
  string S, T, U; cin >> S >> T;
  int A, B; cin >> A >> B;
  cin >> U;
  if(S==U) cout << A-1 << ' ' << B;
  else cout << A << ' ' << B-1;
  return 0;
}

Measured memory_bytes: 256
def findNum(a, b, k):
    for i in range(a, b+1):
        if i % k == 0:
            return True
    return False
K = int(input())
A, B = list(map(int, input().split()))
# m = (K - (A % B)) % K
print('OK' if findNum(A, B, K) else 'NG')

Measured memory_bytes: 61668
n,w=map(int,input().split())
WV=[list(map(int,input().split())) for i in range(n)]
#WV[i][0]が重さ、WV[i][1]が価値
#配るDP
dp=[[0 for i in range(w+1)] for i in range(n+1)]
#dp[i][j]はi回目(0,n-1)に重さjまで入るmax value
for i in range(n):
    for j in range(w+1):
        if WV[i][0]+j<=w and i <=n-1:
            dp[i+1][j+WV[i][0]]=max(dp[i][j+WV[i][0]], dp[i][j]+WV[i][1])
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])
        else:
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])
print(max(dp[n]))

Measured memory_bytes: 172040
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

ll combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

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

	int a[100005];
	rep(i,n) cin >> a[i];
	sort(a, a+n);

	int mm = a[n-1];
	double target = mm / 2.0;

	if(n == 2){
		cout << mm << " " << a[0] << endl;
		return;
	}

	auto l = lower_bound(a, a+n, target);

	if(*l == mm){
		l--;
	}

	cout << mm << " ";

	if(abs(*l - target) > abs(*(--l) - target)){
		cout << *l << endl;
	}else{
		cout << *(++l) << endl;
	}

}

int main(){
	solve();
	return 0;
}





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

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

    string res = "EQUAL";
    if (a.size() > b.size()) {
        res = "GREATER";
    } else if (a.size() < b.size()) {
        res = "LESS";
    } else {
        for (int i = 0; i < a.size(); i++) {
            if (a.at(i) > b.at(i)) {
                res = "GREATER";
                break;
            } else if (a.at(i) < b.at(i)) {
                res = "LESS";
                break;
            }
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 1e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll n;
string s;
void solve();

void input() {
    cin >> n >> s;
}

void solve() {
    if (s[0] == 'W') {
        std::cout << 0 << endl;
        return;
    }
    
    ll ans = 1;
    ll cnt = 1;
    bool left = 1;
    for (ll i = 1; i < sz(s); i++) {
        if (s[i] == s[i-1]) {
            left = !left;
        }
        if (left) {
            cnt++;
        } else {
            ans = (ans * cnt) % MOD;
            cnt--;
        }
    }
    if (cnt != 0) {
        std::cout << 0 << endl;
        return;
    }
    for (ll i = 2; i <= n; i++) ans = (ans * i) % MOD;
    std::cout << ans << endl;
}

int main(int argc, char *argv[]){
    input();
    solve();
    return 0;
}


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

int main(){
int si;
int si_0=0,si_1=0;  
int ans;
//int A,B,K;

string test;
cin >> test;
  
  si = test.size();
  
  for(int i = 0;i<si;i++){
  if(test.at(i) == '0'){
  si_0 ++;
  }else if(test.at(i) == '1'){
  si_1++;
  }
  }
  if(si_0 >= si_1){
    ans = si_1*2;
  }else{
    ans = si_0*2;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main() {
  ll i, j, k;
  
  ll K;
  cin >> K;
  queue<ll> q;
  
  for(i=1; i<10; i++) q.push(i);
  
  
  for(i=0; i<K-1; i++) {
    ll t=q.front(); q.pop();
    if(t%10!=0) q.push(t*10+t%10-1);
    q.push(t*10+t%10);
    if(t%10!=9) q.push(t*10+t%10+1);
  }
  
  pt(q.front());
  
}




Measured memory_bytes: 1792
use std::collections::*;
use std::io::*;
struct StdinReader<R: BufRead> {
    pub reader: R,
    pub buf: String,
}
impl<R: BufRead> StdinReader<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf: String::new(),
        }
    }
}
macro_rules! get {
    ($r:expr, $t:ty) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($r:expr, $($t:ty),*) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($r:expr, $t:ty; $n:expr) => {
        // items in n lines
        (0..$n).map(|_|
                    get!($r, $t)
                   ).collect::<Vec<_>>()
    };
    ($r:expr, $($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($r, $($t),*)
                   ).collect::<Vec<_>>()
    };
    ($r:expr, $t:ty ;;) => {
        // items in a line
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($r:expr, $t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($r, $t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let reader = stdin();
    let mut reader = StdinReader::new(reader.lock());
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let s = get!(reader, String);
    let t = get!(reader, String);
    let s = &s.as_bytes();
    let t = &t.as_bytes();
    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    writeln!(out, "{}", ans);
}


Measured memory_bytes: 2556
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println((a + b >= c) ? "Yes" : "No");
	}
	
}

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

int main()
{
  int N;
  int64_t D, X, Y;
  cin >> N >> D;
  D = D * D;
  int c = 0;
  for (int i = 0; i < N; i++) {
    cin >> X >> Y;
    X = abs(X);
    Y = abs(Y);
    int64_t root;
    root = (X * X) + (Y * Y);
    if (D >= root) {
      c++;
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 3636
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define SIZE(a) (int)((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

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

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}


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

  if (SIZE(S) % 2 == 1) {
    int m = SIZE(S)/2;
    rep(i, 1, m+1) {
      if (S[m-i] != S[m] || S[m+i] != S[m]) {
        cout << SIZE(S) - (m - (i-1)) << endl;
        return 0;
      }
    }
    cout << SIZE(S) << endl;
  } else {
    int m = SIZE(S)/2 - 1;
    rep(i, 0, m+1) {
      if (S[m-i] != S[m] || S[m+1+i] != S[m]) {
        cout << SIZE(S) - (m - (i-1)) << endl;
        return 0;
      }
    }
    cout << SIZE(S) << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n,h[100005],dp[100005],k;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> k;
    for(int i=1;i<=n;i++){
        cin >> h[i];
        if(i>1){
            dp[i]=INF;
            for(int j=i-1;j>=max(1,i-k);j--){
                dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
            }
        }
    }
    cout << dp[n];
}


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

#define ll long long

int main(){
    ll n,k,c=0;
    vector<int> a;
    cin >> n >> k;
    for(int i=0; i<n; i++){
        int data;
        cin >> data;
        a.push_back(data);
    }
    sort(a.rbegin(),a.rend());
    for(int i=k; i<n; i++){
        c+=a[i];
    }
    cout << c;
}

Measured memory_bytes: 4260
N = int(input())
H = [int(i) for i in input().split()]

i = 0
while i < len(H) - 1:
    if H[i] > H[i + 1]:
        del H[i + 1]
    else:
        i += 1
        if i >= len(H) - 1:
            break

print(len(H))

Measured memory_bytes: 3060
n = int(input())
A = list(map(int,input().split()))

law_ans = 0
absminA = float('inf')
for a in A:
    law_ans += abs(a)
    absminA = min(absminA, abs(a))


cnt_neg = 0

for a in A:
    if a < 0:
        cnt_neg += 1

cnt_0 = A.count(0)

if cnt_0 == 0:
    if cnt_neg%2 == 0:
        print(law_ans)
    else:
        print(law_ans-2*absminA)
else:
    print(law_ans)


Measured memory_bytes: 20044
n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
ans = 0
for i in range(n+1):
    if a[i]>k:
        break
    for j in reversed(range(m+1)):
        if a[i]+b[j]<=k:
            ans = max(ans, i+j)
            m=j
            break
print(ans)

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int plun1 = A * N;
  int plun2 = B;
  if ( plun1 <= plun2 ) {
    cout << plun1 << endl;
  }
  if ( plun1 > plun2 ) {
    cout << plun2 << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
count = [[0 for _ in range(10)] for _ in range(10)]
for i in range(1, N + 1):
    st, ed = int(str(i)[0]), int(str(i)[-1])
    count[st][ed] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += count[i][j] * count[j][i]
print(ans)

Measured memory_bytes: 40556
if __name__ == "__main__":
    a, b, k = map(int, input().split())
    ans_a = max(a - k, 0)
    ans_b = b
    if ans_a == 0:
        k = k - a
        ans_b = max(b - k, 0)           
    print(ans_a,ans_b)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second  
#define endl '\n'
#define pb push_back
#define t_case ll tt; cin>>tt; while (tt--)
#define all(v) v.begin(),v.end()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define fr(a,b,c) for (ll a=b;a<c;a++)
#define take(xx,n) for (int i=0;i<n;i++) cin>>xx[i];
#define take1(xx,n) for (int i=1;i<=n;i++) cin>>xx[i];
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
const auto inf=LLONG_MAX; 
ll mod=1e9+7;
int main() 
{
	fastio
	//t_case
	{
		ll sum=0,ans=0,n,m=0,mx=-inf,mn=inf,p,f ;cin>> n ;
		ll a[n+1],pref[n+2]={}; take1 (a,n);
		for(int i=n;i>0;i--){
			pref[i]=(pref[i+1]+a[i])%mod;
			//cout<<pref[i]<<endl;
		}
		fr(i,1,n) {
			ans=(ans+(a[i]*(pref[i+1]%mod))%mod) % mod;
			//cout<<ans<<" "<<a[i]<<" "<<pref[i+1]<<endl;
		}
		cout<<ans%mod;
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 6764
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;
bool isPrime(int num);

int main(){
	string data;
	while(cin >> data, data != "0"){
		int a = 0, b = 0;
		for(int i = 1; i <= data.size(); i++){
			if(data[i] == 'A'){
				a++;
			}else if(data[i] == 'B'){
				b++;
			}
		}
		
		if(a > b) a++;
		if(a < b) b++;
		
		cout << a << " " << b << endl;
	}
	return 0;
}


Measured memory_bytes: 3036
fn main() {
    let k: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();
    if s.len() > k {
        println!("{}...", s.iter().take(k).collect::<String>());
    } else {
        println!("{}", s.iter().collect::<String>());
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define re register
int p[200100],n,dp[200100][2],q[200100],f[600100][2],N;
void upd(re int x,re int v0,re int v1)
{
	x+=N;f[x][0]=v0;f[x][1]=v1;
	for(x>>=1;x;x>>=1)f[x][0]=std::max(f[x*2][0],f[x*2+1][0]),f[x][1]=std::max(f[x*2][1],f[x*2+1][1]);
}
int ans0,ans1;
int qry(re int l,re int r)
{
	ans0=0,ans1=-(1<<30);
	for(l+=N-1,r+=N+1;l!=(r^1);l>>=1,r>>=1)
	{
		if(!(l&1))ans0=std::max(ans0,f[l^1][0]),ans1=std::max(ans1,f[l^1][1]);
		if(r&1)ans0=std::max(ans0,f[r^1][0]),ans1=std::max(ans1,f[r^1][1]);
	}
}
int main()
{
	re int mx=0,ca=0,cb=0,ma=0,mb=0;
	scanf("%d",&n);
	for(N=1;N<=n;N<<=1);
	for(re int i=1;i<=n;i++)scanf("%d",&p[i]);
	for(re int i=1;i<=2*N;i++)f[i][1]=-(1<<30);
	for(re int i=1;i<=n;i++)
	{
		if(p[i]>mx)mx=p[i],q[i]=1;
	}
	for(re int i=n;i;i--)
	{
		qry(p[i]+1,n);
		if(q[i])dp[i][0]=ans0+2,dp[i][1]=ans1+2;
		else dp[i][0]=ans1+1,dp[i][1]=ans0+1;
		upd(p[i],dp[i][0],dp[i][1]);
		q[i]+=q[i+1];
		//printf("****%d %d %d %d %d\n",i,dp[i][0],dp[i][1],ans0,ans1);
	}
	re int xx=qry(1,n);
	if(q[1]&1)
	{
		if(ans1<q[1]){puts("-1");return 0;}
	}else if(ans0<q[0]){puts("-1");return 0;}
	#define into0 {putchar('0');if(p[i]>ma)ma=p[i],ca++;continue;}
	#define into1 {putchar('1');if(p[i]>mb)mb=p[i],cb++;continue;}
	for(re int i=1;i<=n;i++)
	{
		upd(p[i],0,-(1<<30));
		re int ca1=ca,cb1=cb,ma1=ma,mb1=mb;
		if(p[i]>ma1)ma1=p[i],ca1++;
		if(q[i+1]+cb1-ca1>=0)
		{
			qry(ma1+1,n);
			if((q[i+1]+cb1-ca1)&1){if(ans1>=q[i+1]+cb1-ca1)into0;}
			else{if(ans0>=q[i+1]+cb1-ca1)into0;}
		}
		if(q[i+1]+ca1-cb1>=0)
		{
			qry(mb1+1,n);
			if((q[i+1]+ca1-cb1)&1){if(ans1>=q[i+1]+ca1-cb1)into0;}
			else{if(ans0>=q[i+1]+ca1-cb1)into0;}
		}
		into1;
	}
	puts("");
}

Measured memory_bytes: 8192
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  vector<ll> v;
  ll d[3];
  clr(d,0);
  rep(i,0,n){
    ll a;
    cin>>a;
    d[a%3]++;
  }
  if(d[1]==0&&d[2]==0){
    cout << 1 << endl;
    return 0;
  }
  ll mx = 0;
  if(d[1]==0){
    ll a1 = d[1];
    ll a2 = d[2];
    mx = max(mx,min(2LL,a2));
  }
  if(d[2]==0){
    ll a1 = d[1];
    ll a2 = d[2];
    mx = max(mx,min(3LL,a1));
  }
  if(d[1]==1&&d[2]>0){
    ll a1 = d[1];
    ll a2 = d[2];
    mx = max(mx,min(5LL,a2+1));
  }
  if(d[1]>1){
    ll a1 = d[1];
    ll a2 = d[2];
    ll c = 0;
    a1-=2;
    c+=2;
    ll e = min(a1,a2);
    c += e*2;
    a1 -= e;
    a2 -= e;
    if(a2>=1){
      c+=min(2LL,a2);
    }
    else if(a1>0){
      c++;
    }
    mx = max(mx,c);
  }
  if(d[2]>0){
    ll a1 = d[1];
    ll a2 = d[2];
    ll c = 0;
    a2--;
    c++;
    ll e = min(a1,a2);
    c += e*2;
    a1 -= e;
    a2 -= e;
    if(a2>=1){
      c+=min(2LL,a2);
    }
    else if(a1>0){
      c++;
    }
    mx = max(mx,c);
  }
  cout << mx+d[0] << endl;
  return 0;
}

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

const string YES = "YES";
const string NO = "NO";


int main(){
    string s1, s2;
    cin >> s1 >> s2;
    reverse(s1.begin(), s1.end());
    for(ll i=0; i< 3; i++){
        if(s1[i]!= s2[i]) {
            cout << NO << endl;
            return 0;
        }
    }
    cout << YES << endl;
    return 0;
}


Measured memory_bytes: 256
def count_fee_station(a, n_list):
    cost = 0
    for i in n_list:
        if i in a:
            cost += 1
    return cost


def main():
    n , m , x  = map(int,input().split())
    a = list(map(int, input().split()))
    # if n in a:
    #     a.remove(n)
    n_list_a = list(range(0,x+1))
    n_list_b = list(range(x,n+1))
    cost_a = count_fee_station(a,n_list_a)
    cost_b = count_fee_station(a,n_list_b)
    print(min(cost_a,cost_b))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{n:usize, T:i64, t:[i64;n]};
    let mut ans:i64 = 0;
    for i in 0..n-1 {
        if t[i] + T > t[i+1] {
            ans += t[i+1]-t[i];
        } else {
            ans += T;
        }
    }
    println!("{}", ans+T);
}


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

int main(void)
{
  int n;
  std::cin >> n;

  int money;
  if (n < 1000) {
    money = 1000;
  }
  else {
    money = ((n + 999) / 1000) * 1000;
  }
  std::cout << money - n << std::endl;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, m, q;
	cin >> n >> m >> q;

	vector<vector<int>> dp(n + 1, vector<int>(n + 1));
	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		dp[l][r]++;
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			dp[i][j] += dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
		}
	}

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		cout << dp[r][r] - dp[l - 1][r] - dp[r][l - 1] + dp[l - 1][l - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int sum1 = 0;
		int sum2 = 0;

		for (int i = 0; i < a; i++) {
			String b = scanner.next();
			String c = scanner.next();
			if (b.compareTo(c) > 0)
				sum1 += 3;
			else if (b.compareTo(c) < 0)
				sum2 += 3;
			else {
				sum1 += 1;
				sum2 += 1;
			}
		}
		System.out.println(String.format("%d %d", sum1, sum2));
	}
}


Measured memory_bytes: 30392
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (ll)1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

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

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


int main(void) {
	int d, n, ans=0;
	cin >> d >> n;
	d = pow(10, d*2);
	rep(i, n) {
		ans += d;
		if (i == 100 - 1)ans += d;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
S = input()
if "N" in S:
    if "S" not in S:
        print("No")
        exit()
elif "S" in S:
    if "N" not in S:
        print("No")
        exit()

if "W" in S:
    if "E" not in S:
        print("No")
        exit()
elif "E" in S:
    if "W" not in S:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 38384
// abc133_b
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(void) {
	int N, D;
	cin >> N >> D;
	vector<vector<int>> vec;
	vec.resize(N);
	for (int i = 0; i < N; i++) {
		vector<int> x;
		x.resize(D);
		for (int j = 0; j < D; j++) {
			cin >> x[j];
		}
		vec[i] = x;
	}
	int sum = 0;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			double distance = 0;
			for (int k = 0; k < D; k++) {
				distance += abs(pow((vec[i][k] - vec[j][k]), 2.0));
			}
			distance = sqrt(distance);
			int chk = int(distance);
			if (distance == (double)chk) {
				sum++;
			}

		}
	}
	cout << sum << endl;

	return 0;
}

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

int main() {
	int n, d;
	scanf("%d %d", &n, &d);

	int counter = 0;
	for (int i = 0; i < n; i++) {
		int x, y;
		scanf("%d %d", &x, &y);

		double dist = sqrt(1.0 * x * x + 1.0 * y * y);
		if (dist < d + 1e-6)
			counter++;
	}

	printf("%d\n", counter);

	return 0;
}

Measured memory_bytes: 3812
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;
map<string, bool> mp;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

unsigned long long Stol(string s) {
	unsigned long long ans = 0;
	for (int i = 1; i <= s.size(); i++) {
		ans += (s[s.size() - i] - '0') * pow(10, i - 1);
	}
	return ans;
}

unsigned long long solve(string s) {
	unsigned long long ans = 0;
	vector<string> ss;
	int a = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '/') {
			string ns = "";
			for (int j = a; j < i; j++) {
				ns += s[j];
			}
			ss.push_back(ns);
			a = i + 1;
		}
	}
	if (a < s.size()) {
		string ns = "";
		for (int i = a; i < s.size(); i++)
			ns += s[i];
		ss.push_back(ns);
	}
	for (int i = 0; i < ss.size(); i++) {
		ans += Stol(ss[i]);
	}
	for (int i = 0; i < ss.size(); i++) {
		for (int j = 1; j < ss[i].size(); j++) {
			vector<string> nss = ss;
			nss[i].insert(j, "/");
			string q = nss[0];
			for (int k = 1; k < nss.size(); k++) {
				q += "/" + nss[k];
			}
			if (mp[q]) {
				continue;
			}
			mp[q] = true;
			ans += solve(q);
		}
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	cout << solve(s) << endl;
	return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {

        int N = nextInt();
        int M = nextInt();
        if(N==M){
    	    out.println("Yes");
        }else{
    	    out.println("No");            
        }
	    
	}

	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

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

Snack = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))

    for j in range(d):
        Snack[A[j]-1] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)


Measured memory_bytes: 9132
function Main(input) {
  const data = input.trim();

  var strs = data.split("");

  var list = [];

  strs.forEach((n) => {
    if (list.indexOf(n) == -1) {
      list.push(n);
    } else {
      var idx = list.indexOf(n);
      list.splice(idx, 1);
    }
  });

  if (list.length > 0) {
    console.log("No");
  } else {
    console.log("Yes");
  }
}

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


Measured memory_bytes: 7500
import java.util.*;
import java.io.*;
 
public class Main{
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        String S = s.next();
        String A = "ABC";
        
        if(S.equals(A)){
            System.out.println("ARC");
        }else{
            System.out.println("ABC");
        }
        
	}
} 

Measured memory_bytes: 35600
#include<iostream>
#include<math.h>
using namespace std;

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

    int ans = 0;
    if(X>=100){
        int keta, n;
        keta = X%100;
        n = ceil(keta/5.0);
        if(0<=keta && keta <=5)
            ans = 1;
        else if(X>n*100){
            ans = 1;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>

using namespace std;

int main(){

  char record[101];
  int play_a;
  int play_b;
  int n;

  while(cin >> record){
    
    if(record[0]=='0')
      break;

    n = strlen(record);
      
    play_a=0;
    play_b=0;
    
    for(int i=1; i<n; i++){
      if(record[i]=='A'){
	play_a++;
      } else {
	play_b++;
      }
    }
    
    if(play_a>play_b){
      play_a++;
    } else {
      play_b++;
    }
    
    cout << play_a << " " << play_b << endl;
  }
}


Measured memory_bytes: 3064
const main = (standardInput) => {
    const lengthList = standardInput.split(' ');
    const a = Number.parseInt(lengthList[0]);
    const b = Number.parseInt(lengthList[1]);
    const c = Number.parseInt(lengthList[2]);

    var result = divisor(c);
    result = result.filter((item) => {
      return a <= item && item <= b
    })

    console.log(result.length)
}

function divisor(num){
    var results = [];
    for(var i=1; i<=num; i++) {
        if( (num%i == 0) ) {
            results.push(i);
        }
    }
    return results;
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));



Measured memory_bytes: 15408