akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<map>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, P;
    string S;
    cin >> N >> P >> S;
    vector<ll> digits(N);
    rep(i, 0, N) {
        digits[i] = (ll)(S[i] - '0');
    }
    if (P == 2) {
        ll ans = 0;
        rep(i, 0, N) {
            if (digits[i] % 2 == 0) {
                ans += (ll)(i + 1);
            }
        }
        cout << ans << endl;
        return 0;
    }
    if (P == 5) {
        ll ans = 0;
        rep(i, 0, N) {
            if (digits[i] == 5 || digits[i] == 0) {
                ans += (ll)(i + 1);
            }
        }
        cout << ans << endl;
        return 0;
    }
    vector<ll> U(N + 1, 0);
    ll pow = 1;
    ll ans = 0;
    map<ll, ll> cnt;
    ++cnt[0];
    rrep(i, N, 0) {
        U[i] = (U[i + 1] + (digits[i] * pow) % P) % P;
        ans += cnt[U[i]];
        ++cnt[U[i]];
        pow = (pow * 10) % P;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4244
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll = long long;
using ull = unsigned long long;

static const ll MOD = 1e+9 + 7;

ll f(ll x)
{
    ll res = 1;
    for (ll i = 1; i <= x; ++i) {
        res = (res * i) % MOD;
    }

    return res;
}

int main()
{
    ll N, M;
    cin >> N >> M;

    if (abs(N-M) > 1) {
        cout << 0 << endl;
    } else if (abs(N-M) == 1) {
        cout << (f(N) * f(M)) % MOD << endl;
    } else {
        cout << ((f(N) * f(M)) % MOD * 2) % MOD << endl;
    }

    return 0;
}


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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto& e : A)cin >> e;
  vector<int64_t> count(N, 0);
  for (const auto& e : A)++count[e - 1];
  int64_t ans = 0;
  for (const auto& e : count)
    ans += e * (e - 1) / 2;
  for (const auto& e : A) {
    cout << (ans - count[e - 1] * (count[e - 1] - 1) / 2 + (count[e - 1] - 1) * (count[e - 1] - 2) / 2) << "\n";
  }
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;
vvl G = vv(200000, 0, 0, ll);
int main(int argc, char const *argv[]) {
  ll a, b, n, m;std::cin >> n >> m;
  re(i, m){
    std::cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for(int i=1;i<=n;i++) std::cout << G[i].size() << '\n';
}


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

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    string S; cin >> S;
    if(S[0] == 'A'){
        if(count(S.begin()+2, S.end()-1, 'C') == 1){
            int cnt = 0;
            REP(i,S.size()){
                if(isupper(S[i])) cnt++;
            }
            if(cnt == 2){
                cout << "AC" << endl;
                return 0;
            }
        }
    }
    cout << "WA" << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

// DANE:

P f(int x) {
    string s = to_string(x);
    int a = s[s.size()-1]-'0', b = s[0]-'0';
    return P(a, b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<P, int> freq;
    for(int i=1; i<=n; i++){
        P p = f(i);
        freq[p]++;
    }
    ll ans = 0;
    for(int i=1; i<=n; i++){
        P p = f(i);
        P q(p.second, p.first);
        ans += freq[q];
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  int n, q;
  cin >> n >> q;

  vector<queue<int>> qs(n);
  for (int i = 0; i < q; ++i) {
    int q, t;
    cin >> q >> t;

    if (q == 0) {
      int x;
      cin >> x;
      qs[t].push(x);
    }
    if (q == 1) {
      if (!qs[t].empty())
        cout << qs[t].front() << endl;
    }
    if (q == 2) {
      if (!qs[t].empty())
        qs[t].pop();
    }
  }
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
#define MAXN 1000000
using namespace std;
int serve_time[6], deliver_time[6], order_time[6], id[6];

int nearestMultipleOf10(int n){
	while(n%10!=0){
		n++;
	}
	return n;
}
int main() {
	for(int i=0;i<5;i++) {
		id[i] = i;
		cin>>serve_time[i];
	}
	
	int minTotal = INT_MAX;
	do{
		deliver_time[id[0]] = serve_time[id[0]];
		int i=1;
		while(i<5){
			order_time[id[i]] = nearestMultipleOf10(deliver_time[id[i-1]]);
			deliver_time[id[i]] = order_time[id[i]] + serve_time[id[i]];
			i++;
		}
		minTotal = min(minTotal, deliver_time[id[4]]);
	}while(next_permutation(id,id+5));
	
	printf("%d\n", minTotal);
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
const int N=200005;
int n,m;
char ss[N];
int X[N],Y[N];
int du[N][2];
vector<int> vec[N];
queue<int> q;
bool in[N];
int main()
{
	scanf("%d%d",&n,&m);
	scanf("%s",ss+1);
	for (int u=1;u<=m;u++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		vec[x].push_back(y);
		vec[y].push_back(x);
		du[y][ss[x]-'A']++;
		du[x][ss[y]-'A']++;
	}
	memset(in,true,sizeof(in));
	for (int u=1;u<=n;u++)
	{
		if (du[u][0]<=0||du[u][1]<=0)
		{
			in[u]=false;
			q.push(u);
		}
	}
	while (!q.empty())
	{
		int x=q.front();q.pop();
		int siz=vec[x].size();
		for (int u=0;u<siz;u++)
		{
			int y=vec[x][u];
			if (in[y]==false) continue;
			du[y][ss[x]-'A']--;
			if (du[y][ss[x]-'A']==0)	{in[y]=false;q.push(y);}
		}
	}
	for (int u=1;u<=n;u++) if (in[u])
	{
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std ;
#define Fors(n) for(int i=1;i<=n;i++)
#define For(n) for(i=0;i<n;i++)
#define ll long long
#define vint(s) vector<int> s
#define pb(x)  push_back(x)
#define mpair(x,y) make_pair(x,y)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll x=0,y=0,s=0,n=0,i=0;

int main(){
    IOS;
    cin >> n;
    ll a[n+1];
    vector<ll> v;
    For ((n-1)){
    	cin >> a[i];
    }
    v.pb(a[0]);
    for (i = 1;i < n-1;i++){
    	x = min(a[i],a[i-1]);
    	v.pb(x);
    }
    v.pb(a[n-2]);
    for (auto it : v){
    	s += it;
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApplication2
{

    class Program
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');
            string[] string2 = Console.ReadLine().Split(' ');
            bool checker = false;

            int cost=0;

            if(string2[0].Count()-1==input[0].Count())
            {
                if(Equals(string2[0].Substring(0,input[0].Count()),input[0]))
                {
                    checker = true;
                }
            }
            Console.WriteLine(checker==true ? "Yes":"No");

            checker = false;

        }
    }
}


Measured memory_bytes: 18648
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import copy
K=int(input())
A=list(map(int,input().split()))
if A[-1]!=2:
    print(-1)
    exit()

maX=2
miN=2

for i in range(K-1,-1,-1):

    if A[i]//maX>=2:
        print(-1)
        exit()
    if A[i]//miN>=2:
        miN=A[i]
    else:
        if miN%A[i]==0:
            pass
        else:
            miN=(miN//A[i] +1) *A[i]
    maX=maX-maX%A[i] + A[i]-1

mmaX=maX
for i in range(K):
    mmaX-=mmaX%A[i]
if mmaX==2:
    print(miN,maX)
else:
    print(-1)


Measured memory_bytes: 64476
num = 2000000

n = int(input())
l = list(map(int, input().split()))

max = -num
min = num
total = 0

for x in l:
  if max < x:
    max =x
  if min > x:
    min = x
  total += x

print('%d %d %d'%(min, max, total))


Measured memory_bytes: 6588
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll h,w;
  cin >> h >> w;
  vector<vector<ll>> cost(10,vector<ll>(10));
  rep(r,10)rep(c,10) {
    cin >> cost[r][c];
  }
  // Warshall-Floyd
  rep(k,10)rep(v,10)rep(u,10) {
    chmin(cost[v][u], cost[v][k] + cost[k][u]);
  }

  ll ans = 0;
  rep(r,h)rep(c,w) {
    ll a;
    cin >> a;
    if (a != -1) {
      ans += cost[a][1];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

const int MAX_N = 1000;
const int MAX_V = MAX_N * 3 + 3;
const int INF = 1<<29;

int N;
int As[MAX_N], Bs[MAX_N];

typedef pair<int, int> P;
struct edge{ int to, cap, cost, rev; };
int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, int cap, int cost){
	G[from].push_back((edge){to,cap,cost,G[to].size()});
	G[to].push_back((edge){from,0,-cost,(int)G[from].size()-1});
}

int min_cost_flow(int s, int t, int f){
	int res = 0;
	fill(h, h+V, 0);
	while(f > 0){
		priority_queue<P, vector<P>, greater<P> > que;
		fill(dist, dist+V, INF);
		dist[s] = 0;
		que.push(P(0,s));
		while(!que.empty()){
			P p = que.top(); que.pop();
			int v = p.second;
			if(dist[v] < p.first) continue;
			for(int i=0; i<G[v].size(); i++){
				edge &e = G[v][i];
				if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(P(dist[e.to],e.to));
				}
			}
		}
		if(dist[t] == INF){
			return -1;
		}
		for(int v = 0; v<V; v++) h[v] += dist[v];

		int d = f;
		for(int v=t; v != s; v = prevv[v]){
			d = min(d, G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += d*h[t];
		for(int v=t; v!=s; v=prevv[v]){
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}

int solve(){
	int tot = 0;
	vector<int> ns;
	for(int i=0; i<N; i++){
		tot += As[i] + Bs[i];
		ns.push_back(As[i]);
		ns.push_back(Bs[i]);
	}

	sort(ns.begin(), ns.end());
	ns.erase( unique(ns.begin(), ns.end()), ns.end() );

	const int M = ns.size();
	map<int,int> dict;
	for(int i=0; i<M; i++){
		dict[ns[i]] = i;
	}

	//ツグツδ可フツ構ツ青ャ
	const int trash = N + M, source = trash + 1, sink = source + 1;
	V = sink + 1;

	for(int i=0; i<N; i++){
		add_edge(source, i, 1, 0);
	}

	for(int i=0; i<N; i++){
		add_edge(i, dict[As[i]] + N, 1, As[i]);
		add_edge(i, dict[Bs[i]] + N, 1, Bs[i]);
		add_edge(i, trash, 1, As[i] + Bs[i]);
	}

	for(int i=0; i<M; i++){
		add_edge(i + N, sink, 1, 0);
	}
	add_edge(trash, sink, INF, 0);

	return tot - min_cost_flow(source, sink, N);
}

int main(){
	scanf("%d",&N);
	for(int i=0; i<N; i++){
		scanf("%d%d", As+i, Bs+i);
	}

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

	return 0;
}

Measured memory_bytes: 0
import java.io.*;
 
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String taro, hanako, str;
        int st=0, sh=0;
        int n = Integer.parseInt(br.readLine());
        for(int i=0; i<n; i++) {
            str = br.readLine();
            taro = str.substring(0, str.indexOf(' '));
            hanako = str.substring(str.indexOf(' ')+1);
            if(taro.compareTo(hanako) < 0) sh += 3;
            else if(taro.compareTo(hanako) > 0) st+=3;
            else { st++; sh++; }
        }
        System.out.println(st + " " + sh);
    }
}

Measured memory_bytes: 17028
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<ll, pair<ll,ll>>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)

ll n, t;
ll c[500], s[500], f[500];

int main() {
    cin >> n;
    rep(i,n-1) cin >> c[i] >> s[i] >> f[i];
    rep(i,n-1){
        t = s[i] + c[i];
        for (ll j = i+1; j < n-1; j++){
            if (t < s[j]) t = s[j];
            else {
                //次の出発まで待つ
                if (t%f[j]!=0) t += f[j] - t%f[j];
            }
            t += c[j];
        }
        cout << t << endl;
    }
    cout << "0" << endl;
    return 0;
}

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

int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

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

typedef long long int ll;

int main()
{
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    vector<vector<ll>> cnt(h,vector<ll>(w));
    for(ll i = 0;i < h;i++){
        cin >> s[i];
    }
    queue<pair<ll,ll>> st;
    st.push(pair<ll,ll>(0,0));

    ll ud[4] = {0, 1, 0, -1},
       rl[4] = {-1, 0, 1, 0};
    while(!st.empty()){
        pair<ll,ll> t = st.front();
        st.pop();
        for(ll i = 0;i < 4;i++){
            if(t.first + ud[i] >= 0 && t.second + rl[i] >= 0 && t.first + ud[i] < h && t.second + rl[i] < w){
                if(s[t.first + ud[i]][t.second + rl[i]] == '.' && cnt[t.first + ud[i]][t.second + rl[i]] == 0){
                    st.push(pair<ll,ll>(t.first + ud[i],t.second + rl[i]));
                    cnt[t.first + ud[i]][t.second + rl[i]] = cnt[t.first][t.second] + 1;
                }
            }
        }
        if(cnt[0][0] == 0){
            cnt[0][0] = -1;
        }
    }

    if(cnt[h - 1][w - 1] == 0){
        cout << -1;

        return 0;
    }

    ll ans = 0;
    for(ll i = 0;i < h;i++){
        for(ll j = 0;j < w;j++){
            if(s[i][j] == '.'){
                ans++;
            }
        }
    }

    ans -= cnt[h - 1][w - 1];
    ans--;

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char W[10], T[50];
    int count = 0, i;
    scanf("%s", W);
    while (scanf("%s", T) != EOF && strcmp(T, "END_OF_TEXT")) {
        for (i = 0; T[i]; i++) {
            T[i] = tolower(T[i]);
        }
        if (!strcmp(W, T)) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 548
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if p[i-1]>p[i] and p[i+1]<p[i]:
    ans+=1
  if p[i-1]<p[i] and p[i+1]>p[i]:
    ans+=1
print(ans)

Measured memory_bytes: 3060
program main
implicit none
integer :: i, j, k, n, x, y

read(*,*) n
read(*,*) k
read(*,*) x
read(*,*) y

if( n<k ) then
   i = x * n
else
   i = x*k + y*(n-k)
end if
write(*,'(i0)') i



end program main


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a < 10 and b < 10)
        print(a * b);
    else
        print(-1);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

int main() {
  ll in(A); ll in(B); ll in(N);

  if (A == 1 || B == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll x;
  if (N >= B) {
    x = B-1;
  } else
    x = N;
  ll tmp = A * x / B;
  ll tmp2 = x / B;
  tmp2 *= A;
  cout << tmp - tmp2 << endl;

  return 0;
}


Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static void Main(string[] args)
        {
            int H = ReadInt();
            int W = ReadInt();
            int N = ReadInt();
            int max = Math.Max(H, W);
            Console.WriteLine((N + max - 1) / max);
        }
    }
}


Measured memory_bytes: 13140
N = int(input())

INF = 10 ** 6
dp = [INF] * (N + 1)
dp[0] = 0

for i in range(N+1):
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] + 1)
        power *= 6
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] + 1)
        power *= 9

print(dp[N])

Measured memory_bytes: 3828
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

S = s()
if 'R' not in S:
    ans = 0
else:
    ans = 1
for i in range(2):
    if S[i] == S[i+1] == 'R':
        ans = 2
if 'S' not in S:
    ans = 3
print(ans)

Measured memory_bytes: 72616
#include<iostream>
using namespace std;
int main(){
    char table[9][5]={ {'.',',','!','?',' '},{'a','b','c'},{'d','e','f'},{'g','h','i'},{'j','k','l'},{'m','n','o'},{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'} };
    int youso[10] = {0,5,3,3,3,3,3,4,3,4},n;
    cin >> n;
    while(n--){
        int count=0,num,space,s;
        string str;
        cin >> str;
        for(int i=0;i<str.size();i++){
            num = int(str[i]-'0');
            if(num==0){
                if(count>0){
                     s = count%youso[space];
                     if(s==0)   s = youso[space];
                     cout << table[space-1][s-1];
                     count = 0;
                }
            }
            else{
                space=num;
                count++;
            }
        }
        cout << endl;
    }
} 


Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var res = new List<int>();
            int i = 0;
            int idx = 0;
            while(i<n)
            {
                for (int j = idx; j < a.Length; j++)
                {
                    if (a[j] == i + 1)
                    {
                        res.Add(a[j]);
                        idx = j;
                        break;
                    }
                }
                if (res.Count() != i+1)
                    break;
                else i++;
            }

            Console.WriteLine(res.Count() == 0 ? -1 : n - res.Count());

        }
    }
}


Measured memory_bytes: 34524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}
const int MAX_DIGIT = 200010;
int a[MAX_DIGIT]; 

ll modpow(ll n, ll p, ll m) {
    ll res = 1;
    while(p>0){
        if(p%2==1) res = (res * n) % m;
        n = (n * n) % m;
        p /= 2;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    int n = s.size();
    const int MOD = 2019;
    reverse(all(s));
    a[0] = s[0]-'0';
    map<int, int> mp;
    mp[0]=1;
    for(int i=1; i<n; i++){
        a[i] = ((s[i]-'0') * modpow(10, i, MOD) + a[i-1]) % MOD;
    }
    rep(i,n){
        mp[a[i]]++;
    }
    ll ans = 0;
    for(auto i : mp){
        int m = i.second;
        ans += m * (m-1)/2;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ar              array
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("ip1.txt", "r", stdin);
	freopen("op1.txt", "w", stdout);
#endif
}
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
bool compare(pii p1, pii p2)
{
	return p1.ff < p2.ff;
}
int32_t main()
{
	k_007();
	long double a, b, x;
	cin >> a >> b >> x;
	long double ans;
	if (a * a * b / 2.0 <= x)
	{
		ans = atan(2 * (a * a * b - x) / (a * a * a));
	}
	else
	{
		ans = pi / 2 - atan(2 * x / (a * b * b));
	}
	long double res = ans * 180 / (long double)pi;

	cout << ps(res, 10) << endl;

}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int prime(int n) {
	int flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {flag = 0; break;}
	}
	return flag;
}
int power(int x, int y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
	else
		return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
	return (a * b) / gcd(a, b);
}

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

int check(int p[][3],int n){
    int cou=0;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            if(p[i][0]==p[j][0]&&p[i][1]==p[j][1]&&p[i][2]==p[j][2]&&p[i][0]!=-1){
                cou++;
                p[j][0]=-1;
            }
        }
    }
    return cou;
}

int main(){
    int N;
    int p[1000][3];
    cin>>N;
    for (int i=0; i<N; i++) {
        for (int j=0; j<3; j++) {
            cin>>p[i][j];
        }
        sort(p[i], p[i]+3);
    }
    
    int ans=check(p, N);
    
    cout<<ans<<endl;
    return 0;
}

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

const int INF = 1001001001;

int a[12][12];

int main() {
 int N;
 cin>>N;
 for(int i=0;i<100;i++){
   for(int j=0;j<100;j++){
     if(4*i+7*j==N){cout<<"Yes"<<endl;return 0;}
   }
 }
 cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
 
int main() {
	int n, a, b;
	std::cin >> n >> a >> b;
	std::string s;
	std::cin >> s;
	int nSum = 0;
	int Sum = 0;
	for (int i = 0;i < n;i++) {
		if (s[i] == 'a') {
			if (nSum < a + b) {
				std::cout << "Yes" << std::endl;
				nSum += 1;
			}
			else {
				std::cout << "No" << std::endl;
			}
		}
		if (s[i] == 'b') {
			if (nSum < a + b&&Sum < b) {
				std::cout << "Yes" << std::endl;
				nSum += 1;
				Sum += 1;
			}
			else {
				std::cout << "No" << std::endl;
			}
		}
		if (s[i] == 'c') {
			std::cout << "No" << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>

int main(void) {
	int kouzi[18][18];
	int putternnum[18][18];
	int a,b;
	int kouzimax;
	int x,y;
	int i;
	while(1) {
		scanf("%d %d",&a,&b);
		if(a==0 && b==0)break;
		for(y=0;y<18;y++) {
			for(x=0;x<18;x++) {
				kouzi[x][y]=0;
				putternnum[x][y]=0;
			}
		}
		scanf("%d",&kouzimax);
		for(i=0;i<kouzimax;i++) {
			scanf("%d %d",&x,&y);
			kouzi[x][y]=1;
		}
		putternnum[1][0]=1;
		for(y=1;y<=b;y++) {
			for(x=1;x<=a;x++) {
				if(!kouzi[x][y]) {
					putternnum[x][y]=
						putternnum[x-1][y]+putternnum[x][y-1];
				}
			}
		}
		printf("%d\n",putternnum[a][b]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep2(i, n) for (int i = 0; i < ( n ); ++i )
#define rep(i,n)    for (int i =0; i < ( n ); ++i )
using namespace std;
using ll = long long;
using ull = unsigned long long;
using p  = pair<int, int>;
using vec_int = vector<int>;
using vec_str = vector<string>;
#define INF (1<<29)
ll ans = 0;

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

void debug_input(vec_str& argv)
{
    // デバッグ用引数読み込み
    ifstream file("./input.txt");
    string str;
    while( getline(file, str) ) {
        argv.push_back(str);
    }
}

void debug_split_string(const string& str, vec_str& v)
{
    stringstream ss{str};
    string buf;
    while (getline(ss, buf, ' ')) {
        v.push_back(buf);
    }
}

void debug_split_int(const string& str, vec_int& v)
{
    stringstream ss{str};
    string buf;
    while (getline(ss, buf, ' ')) {
        istringstream ss(buf);
        int temp;
        ss >> temp;
        v.push_back(temp);
    }
}

int main()
{
    int N = 0;
    string S;
#if 1
	cin >> N;
#endif
#if 0
	cin >> S;
#endif
#if 1
    //vec_str v(N);
    vec_int v(N);
    rep(i, N-1) {
        ll num;
        cin >> num;
        v[num-1]++;
    }
#endif

    
    rep(i, N) {
    
        cout << v[i] << endl;
    }
        
    
    return 0;
}

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

const int maxN=1000005,p=1000000007;
int N;
int H[maxN];
int fac[maxN],ifac[maxN],inv[maxN];
int qpow(int a,int k){
    int ans=1;
    while(k){
        if(k&1) ans=1LL*ans*a%p;
        a=1LL*a*a%p;
        k>>=1;
    }
    return ans;
}
void inline check(int &x){x-=p,x+=x>>31&p;}
void init(){
    fac[0]=ifac[0]=fac[1]=ifac[1]=inv[1]=H[1]=1;
    for(int i=2;i<maxN;i++)
    	fac[i]=1LL*fac[i-1]*i%p,
    	inv[i]=1LL*(p-p/i)*inv[p%i]%p,
    	ifac[i]=1LL*ifac[i-1]*inv[i]%p,
    	check(H[i]=H[i-1]+inv[i]);
}

int main(){
	init();
	scanf("%d",&N);
	int ans=0;
	for(int i=1,mul=inv[3];i<=N;i++,mul=1LL*mul*inv[3]%p){
		if(i==N) mul=3LL*mul%p*inv[2]%p;
		check(ans+=1LL*inv[N]*(H[N]-H[N-i]+p)%p*mul%p*2%p);
	}
	printf("%d\n",1LL*ans*inv[3]%p);
}

Measured memory_bytes: 19420
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
// khodaya khodet komak kon
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;

ll n, ans, dp[210];
int main(){
	IOS;
	cin >> n;
	vector <ll> dig;
	for (int i = 1; i <= 144; i++){
		ll Sum = i;
		dig.clear();
		while (Sum >= 10){
			dig.pb(9);
			Sum -= 9;
		}
		dig.pb(Sum);
		ll add = 0;
		for (ll j = dig.size() - 1; j >= 0; j--){
			add = add * 10 + dig[j];
		}
		dp[i] = add;
		
	}
	for (int i = 0; i <= 144; i++){
		//cout << dp[i] << '\n';
		if (dp[i] <= n) ans = i;
		
	}
	//cout << dp[197];
	cout << ans;
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	
	static class Priorityqueue {
		public void priorityqueue (InputReader ir) {
			
			Queue<Integer> pq = new PriorityQueue<> (Collections.reverseOrder());;
			StringBuilder sb = new StringBuilder ();
			
			while (true) {
				
				String ord = ir.nextString();
				
				if (ord.equals("end")) break;
				
				if (ord.equals("insert")) pq.add(ir.nextInt());
				else if (ord.equals("extract")) sb.append(pq.poll()).append("\n"); 
				
			}
			
			System.out.print(sb);
			
		}
	}

	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		Priorityqueue obj = new Priorityqueue ();
		obj.priorityqueue (in);
	}
	
	
}



Measured memory_bytes: 194664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>

using namespace std;

typedef long long ll;

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

template<class T> void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

int main(void){
    int N,K;
    cin >> N >> K;
    int h[100100];
    rep(i,N) cin >> h[i];
    long long INF = 1LL << 60;
    long long dp[100100];
    for(int i = 0;i < 100100; ++i) dp[i] = INF;
    dp[0] = 0;

    for(int i = 0; i < N; i++){
        for(int j = 1;j < K + 1;++j){
            chmin(dp[i+j],dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[N-1] << endl;
}

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

public class Main {
    public static void main(String args[]) {

         Scanner sc=new Scanner(System.in);
		 long a=sc.nextLong();
		 long b=sc.nextLong();
		 long c=sc.nextLong();
		 long k=sc.nextLong();
		//String t=sc.next();
long	mx=0;
		if(k>a){
		    mx=mx+a;
		    k=k-a;
		    if(k>b){
		        k=k-b;
		    }else k=0;
		    
		    if(k>0){
		        mx-=k;k=0;
		    }
		    
		}else mx=k;
		
		
		
		
		System.out.println(mx);
	




         
       // System.out.println("Hello World!");
    }
}

Measured memory_bytes: 35788
#include<iostream>
using namespace std;
int main()
{
    int n, m;
    int S, ans=0;
    bool error = false;
    cin>>n>>m;
    S = m;
    for(int i=0; i<n; i++) {
        int in, out;
        cin>>in>>out;
        S += in - out;
        if(S < 0) error = true;
        ans = max(ans, S);
    }
    if(error) ans = 0;
    cout<<ans<<endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int N;
	int ans;
	string s, t, sub_s, sub_t;
	cin >> N >> s >> t;

	ans = N * 2;

	for (int i = 0; i < N; i++)
	{
		sub_s = s.substr(i, N - i);
		sub_t = t.substr(0, N - i);

		if (sub_s == sub_t)
		{
			ans = N * 2 - (N - i);
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String a = s.next();
		char aend = a.charAt(a.length()-1);
		String b = s.next();
		String c = s.next();
		char cstart = c.charAt(0);
		
		if(b.startsWith(String.valueOf(aend))) {
			if(b.endsWith(String.valueOf(cstart))) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}

Measured memory_bytes: 25556
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, l; cin >> n >> l;
	vi a(n); rep(i, n) cin >> a[i];
	rep(i, n - 1){
		if(a[i] + a[i + 1] < l) continue;
		cout << "Possible" << endl;
		vi ans;
		for(int j = i; j < n - 1; j++) ans.pb(j);
		for(int j = i - 1; j >= 0; j--) ans.pb(j);
		reverse(all(ans));
		for(int j : ans) cout << j+1 << endl;
		return 0;
	}
	cout << "Impossible" << endl;
	return 0;
}

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

int main(void) {
	int N,Xfrom,Yfrom;
	

	cin >> N;
	int* Xto = new int[N + 1];
	int* Yto = new int[N + 1];
	int* Time = new int[N + 1];
	Time[0] = 0;
	Xto[0] = 0;
	Yto[0] = 0;
	string ans = "Yes";
	for (int i = 0; i < N; i++) {
		cin >> Time[i + 1]>> Xto[i + 1] >> Yto[i + 1];
	}
	for (int i = 0; i < N; i++) {
		int difftime = Time[i + 1] - Time[i];
		int distance = abs(Xto[i + 1] - Xto[i] + Yto[i + 1] - Yto[i]);
		int going = difftime - distance;
		if (going % 2 == 0 && difftime >= distance) {
			ans = "Yes";
		}
		else {
			ans = "No";
			break;
		}
	}
	cout << ans;

	delete[] Xto;
	delete[] Yto;
	delete[] Time;
	return 0;
}


Measured memory_bytes: 4484
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

A,B = inputIL()

ans = 0
for i in range(A,B+1):
  i = str(i)
  if str(i) == str(i)[::-1]:
    ans += 1
print(ans)

Measured memory_bytes: 40684
#include<stdio.h>
#include<stdlib.h>
int main(){
	int n,sum=0;
	scanf("%d",&n);
	int * arr = (int*)malloc(sizeof(int)*51);
	for(int i=0;i<n;i++){
		scanf("%d",&arr[i]);
	}
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			sum += arr[i]*arr[j];
		}
	}
	printf("%d", sum);
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int i, n;
    int data[4][3][10] = {{{0}}};
    scanf("%d", &n);
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10 ; k++){
                data[i][j][k] = 0;
            }
        }
    }
    for(i = 0; i < n; i++) {
        int b, f, r, v;
        scanf("%d %d %d %d", &b, &f, &r, &v);
        data[b-1][f-1][r-1] += v;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++){
                printf(" %d",data[i][j][k]);
            }
            if(j != 2 || j == 2 && i == 3){
                printf("\n");
            }
        }
        if(i != 3){
            printf("\n####################\n");
        }
    }
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M, C, check = 0, ans = 0;
  cin >> N >> M >> C;
  vector<int> b(M);
  for (int i = 0; i < M; i++) {
    cin >> b.at(i);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      int a;
      cin >> a;
      check += a * b.at(j);
    }
    if (check + C > 0) {
      ans++;
    }
    check = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	if(n<=100){
        printf("%d\n",2*n);
        for(int i=0;i<2*n;i++){
            if(i<n)printf("%d ",n-i);
            else printf("%d ",i+1-n);
        }
        printf("\n");
    }
    else{
        printf("200\n");
        vector<int> res(100);
        for(int i=0;i<100;i++){
            res[i]=100-i;
        }
        n-=100;
        int now=1;
        ll p=99;
        while(n){
            ll q=min(n,p);
            if(n%2!=q%2)q--;
            for(int i=0;i<100;i++){
                if(res[i]==now){
                    res.erase(res.begin()+i);
                    res.insert(res.begin()+i-q,now);
                    break;
                }
            }
            now++;
            n-=q;
            p=q-1;
            n/=2;
        }
        for(int i=0;i<200;i++){
            if(i<100)printf("%d ",res[i]);
            else printf("%d ",i-99);
        }
        printf("\n");
    }
}


Measured memory_bytes: 256