akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<string, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  queue<P> q1;
  rep(i,n){
    string a;
    ll b;
    cin>>a>>b;
    q1.push(P(a,b));
  }
  ll time = 0;
  while(!q1.empty()){
    P tmp = q1.front();
    q1.pop();
    if(tmp.se <= m){
      cout<<tmp.fi<<" "<<time + tmp.se<<endl;
      time -= (m-tmp.se);
    }else q1.push(P(tmp.fi,tmp.se-m));
    time += m;
  }
}

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

Measured memory_bytes: 6320
#include<stdio.h>
#define Max 100000
#define INF 2000000000

struct Card{
  char suit;
  int value;
};

struct Card L[Max/2+2];
struct Card R[Max/2+2];

void merge(struct Card A[],int n,int l,int m,int r){
  int i,j,k;
  int n1 = m - l;
  int n2 = r - m;

  for(i=0 ; i<n1 ; i++) L[i] = A[l+i];
  for(i=0 ; i<n2 ; i++) R[i] = A[m+i];
  L[n1].value = R[n2].value = INF;
  i = j = 0;
  for(k=l ; k<r ; k++){
    if(L[i].value <= R[j].value) A[k] = L[i++];
    else A[k] = R[j++];
  }
}

void mergeSort(struct Card A[],int n,int l,int r){
  int m;
  if(l+1 < r){
    m = (l+r)/2;
    mergeSort(A,n,l,m);
    mergeSort(A,n,m,r);
    merge(A,n,l,m,r);
  }
}

int partition(struct Card A[],int n,int p,int r){
  int i,j;
  struct Card t,x;
  x = A[r];
  i = p-1;
  for(j=p ; j<r ; j++){
    if(A[j].value <= x.value){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i+1;
}

void quickSort(struct Card A[],int n,int p,int r){
  int q;
  if(p < r){
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main(){
  int n,i,v;
  struct Card A[Max];
  struct Card B[Max];
  char S[10];
  int st = 1;

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%s %d",S,&v);
    A[i].suit = S[0];
    A[i].value = v;
    B[i].suit = S[0];
    B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);

  for(i=0 ; i<n ; i++) if(A[i].suit != B[i].suit) st=0;

  if(st == 1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0 ; i<n ; i++) printf("%c %d\n",B[i].suit,B[i].value);

  return 0;
}

Measured memory_bytes: 2952
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	int Q;
	cin>>Q;
	lli A[100],B[100];
	rep(i,Q){
		cin>>A[i]>>B[i];
		if(A[i]==B[i])cout<<2*A[i]-2<<endl;
		else if(abs(A[i]-B[i])==1)cout<<2*min(A[i],B[i])-2<<endl;
		else{
			lli sq=sqrt(A[i]*B[i]);
			if(A[i]*B[i]==sq*sq)cout<<2*sq-3<<endl;
			else if(sq*(sq+1)>=A[i]*B[i])cout<<2*sq-2<<endl;
			else cout<<2*sq-1<<endl;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

constexpr int K = 1000000007;

long long dp[2001];

long long count(int n) {
  if (n < 3)
    return 0;

  auto& result = dp[n];
  if (result != 0)
    return result;

  result = 1;
  for (auto v = 3; n - v >= 0; v++) {
    result += count(n - v);
    result %= K;
  }
  return result;
}

int main(void) {
  int s;
  cin >> s;
  cout << count(s) << '\n';
  return 0;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

ld comb(ll s, ll t){
    ll a = 1, b = 1;
    ld ans = 1;
    rep(i, 0, t){
        a = s - i;
        b = t - i;
        ans *= ld(a) / ld(b);
    }
    return ans;
}

int main(void){
    ll n, a, b;
    cin >> n >> a >> b;

    ll x[n];
    rep(i, 0, n){
        cin >> x[i];
    }

    sort(x, x + n, greater<ll>());

    ld ave;
    ll sum = 0;

    rep(i, 0, a){
        sum += x[i];
    }

    ave = sum / double(a);

    ll num = 0;
    ll f = 0;
    rep(i, 0, a){
        if(x[i] == x[a - 1]){
            f = i;
            break;
        }
    }
    rep(i, f, n){
        if(x[i] == x[a - 1]){
            num++;
        }
    }

    ld ans = 0;
    if(f == 0){
        rep(i, a, min(num, b) + 1){
            ans += comb(num, i);
        }

    }else{
        ans = comb(num, a - f);
    }

    printf("%.9Lf\n", ave);
    printf("%.0Lf\n", ans);
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
import string
import sys
from itertools import chain, takewhile


def read(
    f, *shape, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        return f("".join(takewhile(lambda c: c not in whitespaces, it)).strip())

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def debug(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    while True:
        h, w, n = map(int, sys.stdin.readline().split())
        if (h, w, n) == (0, 0, 0):
            return
        grid = []
        for _ in range(h):
            row = list(map(int, sys.stdin.readline().split()))
            grid.append(row)

        dp = arr(h, w)
        dp[0][0] = n - 1

        for i in range(h):
            for j in range(w):
                if i < h - 1 and grid[i][j] == 0:
                    dp[i + 1][j] += (dp[i][j] + 1) // 2
                if i < h - 1 and grid[i][j] == 1:
                    dp[i + 1][j] += dp[i][j] // 2
                if j < w - 1 and grid[i][j] == 0:
                    dp[i][j + 1] += dp[i][j] // 2
                if j < w - 1 and grid[i][j] == 1:
                    dp[i][j + 1] += (dp[i][j] + 1) // 2

        for i in range(h):
            for j in range(w):
                grid[i][j] = (grid[i][j] + dp[i][j]) % 2

        i = 0
        j = 0
        while i < h and j < w:
            if grid[i][j] == 0:
                i += 1
            else:
                j += 1
        print(i + 1, j + 1)


if __name__ == "__main__":
    main()



Measured memory_bytes: 29856
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int health = sc.nextInt();
		char[][] s = new char[n][];
		int[] t = new int[n];
		for(int i=0;i<n;i++) {
			s[i] = sc.next().toCharArray();
			t[i] = sc.nextInt();
		}
		int word = 0;
		int alpha = 0;
		int miss = 0;

		int typecount = 0;
		int misscount = 0;
		while(true) {
			System.out.println("? " + String.valueOf(s[word]));
			System.out.flush();
			char c = Character.toLowerCase(sc.next().charAt(0));
			typecount++;
			if (Character.toLowerCase(s[word][alpha]) == c) {
				s[word][alpha] = '_';
				alpha++;
				if (alpha >= s[word].length) {
					word++;
					alpha = 0;
					miss = 0;
				}
			}else{
				miss++;
				misscount++;
				if (miss > t[word]) {
					health--;
					word++;
					alpha = 0;
					miss = 0;
					if (health <= 0) {
						System.out.println("! Game Over");
						System.out.flush();
						return;
					}
				}
			}
			if (word >= n) {
				BigDecimal tc = BigDecimal.valueOf(typecount);
				BigDecimal mc = BigDecimal.valueOf(misscount);
				System.out.println("! Game Clear " + tc.subtract(mc).multiply(BigDecimal.valueOf(100)).divide(tc, 1, RoundingMode.FLOOR));
				System.out.flush();
				return;
			}
		}
	}

}

Measured memory_bytes: 26336
loop do
    n = gets.to_i
    break if n == 0
    a = []
    seq = []
    gets.split.map(&:to_i).sort.each do |i|
        if seq.empty?
            seq << i
        elsif seq[-1] + 1 == i
            seq << i
        else
            if seq.size == 1
                a << seq[0]
            else
                a << [seq[0], ?-, seq[-1]].join
            end
            seq = [i]
        end
    end
    if seq.size == 1
        a << seq[0]
    else
        a << [seq[0], ?-, seq[-1]].join
    end
    puts a * ' '
end



Measured memory_bytes: 7000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mo 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second



int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    ll k;cin >> k;
    while(k>0 && (a>=b || b>=c))
    {
        if(a>=b)
        {
            b = b*2;
            k--;
            continue;
        }
        if(b>=c)
        {
            c = c*2;
            k--;
            continue;
        }
    }
    if(a<b && b<c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

void solve(string S)
{
    map<string, int> m = {
        {"SUN", 7},
        {"MON", 6},
        {"TUE", 5},
        {"WED", 4},
        {"THU", 3},
        {"FRI", 2},
        {"SAT", 1}
    };
    cout << m.at(S) << endl;
}

int main()
{
    string S;
    cin >> S;
    solve(S);
    return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var a  = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var b = new int[N];
            var center = N == 1 ? 0 : N / 2;
            b[center] = a[0];

            int fCount = 1, lCount = 1;
            for (var i = 1; i < N; i++)
            {
                if ((N % 2 == 0 && i % 2 == 0) || (N % 2 == 1 && i % 2 == 1))
                {
                    b[center + lCount] = a[i];
                    lCount++;
                }
                else
                {
                    b[center - fCount] = a[i];
                    fCount++;
                }
            }
            Console.WriteLine(string.Join(" ", b));
        }
    }
}


Measured memory_bytes: 50488
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

#define pli pair<ll, int>

vector<pii> g[100005];
ll d[100005], e[100005], x[100005], y[100005];
bool b[100005], c[100005];
priority_queue<pli, vector<pli>, greater<pli>> q;
int n, m;

int main() {
    ios::sync_with_stdio(false);
    int u, v, w, s, t;
    cin >> n >> m >> s >> t;
    fr(m) cin >> u >> v >> w, g[u].push_back({v, w}), g[v].push_back({u, w});
    fill(d, d + n + 1, (ll)mod * mod);
    fill(e, e + n + 1, (ll)mod * mod);
    d[s] = 0;
    x[s] = 1;
    q.push({0, s});
    while (!q.empty()) {
        int p = q.top().second;
        q.pop();
        if (b[p]) continue;
        b[p] = 1;
        for (pli i : g[p]) {
            if (d[i.first] > d[p] + i.second) {
                d[i.first] = d[p] + i.second;
                q.push({d[i.first], i.first});
            }
        }
        for (pii i : g[p]) if (d[i.first] + i.second == d[p]) x[p] = (x[p] + x[i.first]) % mod;
    }
    e[t] = 0;
    y[t] = 1;
    q.push({0, t});
    while (!q.empty()) {
        int p = q.top().second;
        q.pop();
        if (c[p]) continue;
        c[p] = 1;
        for (pli i : g[p]) {
            if (e[i.first] > e[p] + i.second) {
                e[i.first] = e[p] + i.second;
                q.push({e[i.first], i.first});
            }
        }
        for (pii i : g[p]) if (e[i.first] + i.second == e[p]) y[p] = (y[p] + y[i.first]) % mod;
    }
    ll z = 0;
    fr1(n) if (d[i] == e[i] && d[i] + d[i] == d[t]) z = (z + x[i] * y[i] % mod * x[i] % mod * y[i]) % mod;//, cout << i << '\n';
    fr1(n) for (pii j : g[i]) {
        if (d[i] + d[i] < d[t] && d[j.first] + d[j.first] > d[t] && e[i] + e[i] > e[s] && e[j.first] + e[j.first] < e[s] && d[i] + e[i] == d[t] && d[i] + e[j.first] + j.second == d[t]) z = (z + x[i] * y[j.first] % mod * x[i] % mod * y[j.first]) % mod;//, cout << i << ' ' << j.first << '\n';
    }
    /*
    fr1(n) cout << d[i] << ' '; cout << '\n';
    fr1(n) cout << x[i] << ' '; cout << '\n';
    fr1(n) cout << e[i] << ' '; cout << '\n';
    fr1(n) cout << y[i] << ' '; cout << '\n';
    */
    ll z0 = x[t] * x[t] % mod;
    z0 -= z;
    if (z0 < 0) z0 += mod;
    cout << z0;
}


Measured memory_bytes: 13424
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int x=sc.nextInt();
    int y=sc.nextInt();
    int[] a=new int[n];
    for(int i=1;i<n;i++){
      for(int j=i+1;j<=n;j++){
        a[Math.min(Math.abs(x-i)+1+Math.abs(j-y),j-i)]++;
      }
    }
    for(int i=1;i<a.length;i++){
      System.out.println(a[i]);
    }
  }
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll q;
    cin>>q;
    ll a,b;
    vector<ll> ans;

    for(int i=0;i<q;i++){
    	cin>>a>>b;
    	if(a==b){
    		ans.pb(2*(a-1));
    		continue;
    	}
    	if(b>a)swap(a,b);
    	ll ma=1e9+2,mi=0,mid=(ma+mi)/2;
    while(mi!=mid){
    	if(mid*mid>a*b){
    		ma=mid;
    	}
    	else{
    		mi=mid;
    	}
    	mid=(ma+mi)/2;
    }
    if(mi*mi==a*b){
    	ans.pb(mi*2-3);
    }
    else if(a-b==1){
    	ans.pb(mi*2-2);
    }
    else if(mid*(mid+1)<a*b)ans.pb((mi*2-1)); 
    else ans.pb((mi*2-2));
    
    }
    
    for(int i=0;i<q;i++){
    	cout << ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    cin >> a;
    vector <int> right(n, n);
    vector <int> st;
    forn (i, 0, n) {
        while (!st.empty() && a[st.back()] > a[i]) {
            right[st.back()] = i;
            st.pop_back();
        }
        st.push_back(i);
    }
    vector <int> left(n, -1);
    st.clear();
    for (int i = n - 1; i >= 0; --i) {
        while (!st.empty() && a[st.back()] > a[i]) {
            left[st.back()] = i;
            st.pop_back();
        }
        st.push_back(i);
    }
    cerr << left << "\n" << right << "\n";
    long long ans = 0;
    forn (i, 0, n) {
        int l = i - left[i], r = right[i] - i;
        ans += 1LL * l * r * a[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 6556
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = a; i < (b); ++i)

int main() {

    int N;
    cin >> N;

    vector<ll> A(N);
    vector<ll> B(N);
    ll x, y;
    rep(i, N){
        cin >> x >> y;
        A[i] = x + y;
        B[i] = x - y;
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    cout << max(A[N-1] - A[0], B[N-1] - B[0]) << endl;

    return 0;
}


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

int main(){
  int e;
  while(1){
    cin >> e;
    if(e == 0) break;
    int z,y,x,min = 1000000000;

    for(z = 0; z*z*z <= e; z++){
      // cout << z << endl;
      for(y = 0; y*y + z*z*z <= e ; y++){
	x = e - y*y - z*z*z;
	if(x >= 0){
	  if(min > x + y + z) {
	    min = x + y + z;
	    //    cout << x << " " << y << " " << z << endl;; 
	  }
	}
      }
    }
    cout << min << endl;
  }

  return 0;
}

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

signed main(){
  
  int n;
  cin >> n;
  
  int ans = 1000 - ( n % 1000 );
  
  cout << ( ans == 1000 ? 0LL : ans ) << endl;
  
  return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;


public class Main{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=sc.nextInt();
        if(n<=500&&n<=a){
            System.out.println("Yes");
        }
        else if(n>=500){
            if(n%500<=a){
                System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }
        }
        else if(n>a&&n<500){
            System.out.println("No");
        }
        else{
            System.out.println("No");
        }
    }
    
}


Measured memory_bytes: 23380
IDENTIFICATION                   DIVISION.
       PROGRAM-ID.                      PRACTIVE-B.
       ENVIRONMENT                      DIVISION.
       DATA                             DIVISION.
       WORKING-STORAGE                  SECTION.
      *>
       01 NAGASA                        PIC 9(3).
       01 I-DATA                        PIC X(100).
       01 TUIKA-DATA                    PIC X(3) VALUE '...'.
       01 IDX                           PIC 9(3).
       01 END-FLAG                      PIC 9(1).
       01 CHK-NAGASA                    PIC 9(3).
 
       PROCEDURE DIVISION.
 
           ACCEPT    NAGASA.
           ACCEPT    I-DATA.
 
           MOVE      1  TO IDX.
           MOVE      0  TO END-FLAG.
           COMPUTE CHK-NAGASA = NAGASA + 1.
      
           PERFORM  
             UNTIL  IDX  >  NAGASA 
                      OR
                    END-FLAG = 1
      
      		 IF I-DATA(IDX:1) NOT = SPACE
             THEN
      		     CONTINUE
             ELSE
                 DISPLAY I-DATA(1:IDX)
                 MOVE  1  TO  END-FLAG
             END-IF
             COMPUTE  IDX = IDX + 1
            
           END-PERFORM.

      
           IF  IDX = 101
           THEN
          	   DISPLAY I-DATA(1:NAGASA)
           ELSE
               IF  END-FLAG NOT = 1
               THEN
                   IF  I-DATA(CHK-NAGASA:1) = SPACE
                   THEN
          	           DISPLAY I-DATA(1:NAGASA)
                   ELSE
          	           DISPLAY I-DATA(1:NAGASA)TUIKA-DATA
               END-IF
           END-IF.
 
           STOP RUN.

Measured memory_bytes: 3856
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int K = sc.nextInt();

        long sum = 0;

        for(int i = 1; i <= K; i++){
            for(int j = 1; j <= K; j++){
                for(int k = 1; k <= K; k++){
                    // System.out.printf("%d %d %d %d\n", i, j, k, gcd(i, j, k));
                    sum += gcd(i, j, k);
                }
            }
        }

        System.out.println(sum);
        sc.close();
    }

    private static int gcd(int a, int b, int c){
        return gcd(a, gcd(b, c));
    }

    private static int gcd(int a, int b){
        if(a >= b){
            if(b == 0){
                return a;
            } else {
                return gcd(b, a%b);
            }
        } else {
            return gcd(b, a);
        }

    }
}


Measured memory_bytes: 36088
#include <stdio.h>
#include <cstdio>
#include <string>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>


int main()
{
	long long int N;
	long long int ans;
	scanf("%lld", &N);
	ans = (long long int)sqrt(N);

	printf("%lld\n", ans* ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;
int n;
double W,v[1<<17],w[1<<17];
main()
{
	cin>>n>>W;
	vector<pair<double,double> >a;
	for(int i=0;i<n;i++)
	{
		cin>>v[i]>>w[i];
		a.push_back(make_pair(-v[i]/w[i],w[i]));
	}
	sort(a.begin(),a.end());
	double ans=0;
	for(int i=0;i<n;i++)
	{
		ans-=a[i].first*min(a[i].second,W);
		W-=min(a[i].second,W);
	}
	cout<<fixed<<setprecision(9)<<ans<<endl;
}



Measured memory_bytes: 6148
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

#define LL long long

const int MAXN = 500000 + 5;



int main()
{
    int L[MAXN], N, ans = 0;
    cin >> N;
    for (int i = 0; i < N; i ++){
        cin >> L[i];
    }
    sort(L, L + N);
    for (int i = 0; i < N; i ++){
        for (int j = i + 1; j < N; j ++){
            if (L[j] > L[i]){
                for (int k = j + 1; k < N; k ++){
                    if (L[k] > L[j]){
                        if (L[k] < L[i] + L[j]){
                            ans ++;
                        }
                        else{
                            break;
                        }
                    }
                }
            }
        }
    }
    cout << ans;
    system("pause");
    return 0;
}

Measured memory_bytes: 3708
#include <map>
#include <cstdio>
#include <string>
#include <iostream>
typedef long long ll;

const int p=998244353;
std::map<std::string,int> f,g;

int F(std::string s);

int G(std::string s)
{
    if(g.count(s))return g[s];
    int &Res=g[s];
    if(s.size()==1)return Res=(s[0]^48)+1;
    for(int i=1;i<(int)s.size();++i)
        if((int)s.size()%i==0)
        {
            std::string t;
            for(int j=0;j<i;++j)
            {
                int r=1;
                for(int k=0;k<(int)s.size()/i;++k)
                    if(s[k*i+j]=='0')r=0;
                t+=(char)(r^48);
            }
            Res=(Res+F(t))%p;
        }
    return Res;
}

int F(std::string s)
{
    if(f.count(s))return f[s];
    int &Res=f[s];
    for(int i=1;i<=(int)s.size();++i)
        Res=(Res+(ll)F(s.substr(0,(int)s.size()-i))*G(s.substr((int)s.size()-i,i)))%p;
    return Res;
}

int main()
{
    std::ios::sync_with_stdio(false),std::cin.tie(0),std::cout.tie(0);
    std::string s;
    std::cin>>s,f[""]=1,std::cout<<F(s)<<std::endl;
    return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main () {

    int l;cin>>l;
    double ans = (l*l*l)/27.0;

    cout << fixed << setprecision(10) << ans << endl;


}

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

int main() {
  int A, B, count = 0;
  cin >> A >> B;

  for (int i = A; i <= B; i++) {
    int x = i / 1000;
    int y = i - (i / 100)*100;
    int z = (y - (y / 10)*10)*10 + y / 10;

    if(x == z){
      count += 1;
    }
  }

  cout << count << endl;
  return 0;

}


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

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var b = new LinkedList<int>();
        bool frag = true;
        foreach(var i in a)
        {
            if (frag) b.AddFirst(i);
            else b.AddLast(i);
            frag = !frag;
        }
        if (a.Length % 2 == 0)
        {
            Console.WriteLine(string.Join(" ",b.Reverse()));
        }
        else
            Console.WriteLine(string.Join(" ",b));
    }
}

Measured memory_bytes: 71868
while True:
    H, W = map(int, input().split(" "))
    if H == W == 0:
        break
    else:
        if H%2 == 0:    
            if W%2 == 0:
                for i in range(H//2):    
                    print("#."*(W//2)) 
                    print(".#"*(W//2))   
            elif W%2 != 0:
                for i in range(H//2):
                    print("#."*(W//2), end="")
                    print("#")
                    print(".#"*(W//2), end="")
                    print(".")
        elif H%2 != 0:
            if W%2 == 0:
                for i in range(H//2):    
                    print("#."*(W//2)) 
                    print(".#"*(W//2))   
                print("#."*(W//2))
            elif W%2 != 0:
                for i in range(H//2):
                    print("#."*(W//2), end="")
                    print("#")
                    print(".#"*(W//2), end="")
                    print(".")
                print("#."*(W//2), end="")
                print("#")
    print()


Measured memory_bytes: 5624
// longest increasing subsequence (LIS)
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> sequence;
    vector<int> LIS;
    int initial;
    cin >> initial;
    LIS.emplace_back(initial);
    for (int i = 1; i < n; ++i) {
        int a;
        cin >> a;
        auto it = lower_bound(begin(LIS), end(LIS), a);
        if (it == end(LIS)) {
            LIS.emplace_back(a);
        } else {
            *it = a;
        }
    }
    cout << LIS.size() << endl;
}



Measured memory_bytes: 3392
#include<bits/stdc++.h>
using namespace std;
#define int long long 
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

ll qmult(ll X, ll Y, ll M) {    
    return X * Y % M;
}

ll qexp(ll A, ll B, ll M) {
    if (B == 0) return 1;
    ll half = qexp(A, B/2, M); 
    half = qmult(half, half, M);
    half %= M;
    if (B%2==1) half *= A%M;
    return half%M;
}

int Nfact;
int factarr[11]={1,927880474,933245637,668123525,429277690,733333339,724464507,957939114,203191898,586445753,698611116};
const int interval=1e8;

int factmod(int n) {
    int res = factarr[n/interval];
	FOR(i, (n/interval)*interval+1, n){
		res*=i;
		res%=MOD;
	}
	return res;
}

int modinv(int x){
	return qexp(x,MOD-2,MOD);
}



int choose(int n, int r){
	int ans=factmod(n);
	ans*=modinv(factmod(r)); ans%=MOD;
	ans*=modinv(factmod(n-r)); ans%=MOD;
	return ans;
}


main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N,A,B; 
	cin>>N>>A>>B;
	int ans=qexp(2,N,MOD)-1+MOD; ans%=MOD;
	ans+=MOD-choose(N,A); ans%=MOD;
	ans+=MOD-choose(N,B); ans%=MOD;
	cout<<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

string str;

void reset()
{
}

void input()
{
	cin>>str;
}

void solve()
{
	ll temp = 0;
	UP(i,0,str.length())
	{
		temp += str[i] - '0';
	}
	cout<<(temp % 9 == 0 ?"Yes":"No")<<endl;
}

void LetsRock()
{
	solve();	
}

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

		input();
		reset();
		LetsRock();
	
	return 0;
}


Measured memory_bytes: 3784
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))


n = int(input())
s, t = map(str, input().split())

ans =""

for i in range(n):
    ans += s[i]
    ans += t[i]

print(ans)


Measured memory_bytes: 9096
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

int n;
vl im[2];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, 2){
    im[i].resize(n);
    fill(rng(im[i]), 1);
  }
  FOR(i, 0, n){
    int p;
    cin >> p;
    p--;
    FOR(j, 0, 2) im[j][p] += i;
  }
  ll s = 0;
  FOR(i, 0, n){
    s += im[0][i];
    im[0][i] = s;
  }
  s = 0;
  FORR(i, n-1, 0){
    s += im[1][i];
    im[1][i] = s;
  }
  FOR(i, 0, 2) cout << join(im[i]) << endl;
  return 0;
}

Measured memory_bytes: 1628
// https://beta.atcoder.jp/contests/abc084

#define SUBMIT

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#include <unordered_map>
#include <map>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

int main() {
    int A, B;
    string S;
#ifdef SUBMIT
    cin >> A >> B;
    cin >> S;
#else
    A = 1, B = 2;
    S = "7444";
#endif
    for (int i = 0; i < S.length(); ++i) {
        if (i != A) {
            if (!isdigit(S[i])) {
                cout << "No" << endl;
                exit(0);
            }
        }
        else {
            if (S[i] != '-') {
                cout << "No" << endl;
                exit(0);
            }
        }
    }

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

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B, K; cin >> A >> B >> K;

    vi ans;    
    if (B-A+1 >= K*2) {
        for(int i=A; i<A+K; i++) {
            ans.push_back(i);
        }    
        for(int i=B-K+1; i<=B; i++) {
            ans.push_back(i);
        }
    } else {
        for(int i=A; i<=B; i++) {
            ans.push_back(i);
        }
    }

    for(int i : ans) cout << i << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char b[100],c[100],d[100];
int i,j,l,n;

int main()
{
	scanf("%d\n",&n);
	for (i=1;i<=26;i++)
		c[i]=100;
	for (i=1;i<=n;i++)
	{
		scanf("%s",b+1);
		l=strlen(b+1);
		memset(d,0,sizeof(d));
		for (j=1;j<=l;j++)
			d[b[j]-96]++;
		for (j=1;j<=26;j++)
			c[j]=min(c[j],d[j]);
	}
	for (i=1;i<=26;i++)
		for (j=1;j<=c[i];j++)
			putchar(96+i);
	return 0;
}

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

int main()
{
  int n, m, q;
  cin >> n >> m >> q;
  int ctr[n+1][n+1] = {};
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    ++ctr[l][r];
  }
  
  int sum[n+1][n+1] = {};
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j) {
      sum[i][j] = sum[i][j-1] + ctr[i][j];
    }
  }

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

Measured memory_bytes: 2944
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n;
  scan(n);
  if (n % 2 == 0) {
    print(n / 2 - 1);
  } else {
    print(n / 2);
  }

  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;

int main(){
   string S;
   cin>>S;
   int n=0,s=0,e=0,w=0;
   for(int i=0;i<S.size();i++){
      if(S[i]=='N')n++;
      else if(S[i]=='S')s++;
      else if(S[i]=='E')e++;
      else w++;
   }
   bool ns=false,ew=false;
   if(n>0 && s>0)ns=true;
   if(n==0 && s==0)ns=true;
   if(e>0 && w>0)ew=true;
   if(e==0 && w==0)ew=true;

   if(ns && ew)cout<<"Yes"<<endl;
   else cout<<"No"<<endl; 
}

   


Measured memory_bytes: 632
#include <stdio.h>
#include <stdlib.h>
int compar(const int *val1,const int *val2){
    return *val1-*val2;
}

int main(void){
    int len[3],sign,num,hole;
    for(;scanf("%d %d %d",&len[0],&len[1],&len[2]),len[2];){
        qsort(len,3,sizeof(int),(int (*)(const void *,const void *))compar);
        sign=len[0]*len[0]+len[1]*len[1];
        scanf("%d",&num);
        while(num--){
            scanf("%d",&hole);
            hole*=2;
            printf("%s",sign>=hole*hole?"NA\n":"OK\n");
        }
    }
    return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define nl '\n'
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define all(a) a.begin(),a.end()
#define F first
#define S second
const ll N=1e6+9;
const ll mod=1e9+7;

ll dp[N];
vector<pair<ll,ll>> v;

void solve()
{
	ll n,w,w1,v1;
	cin>>n>>w;
	v.pb({0,0});
	
	rep(i,1,n)
	{
		cin>>w1>>v1;
		v.pb({v1,w1});
	} 
	sort(all(v));

	rep(i,1,100000)dp[i]=1e9+7;
	dp[0]=0;
	rep(i,1,n)
	{
		repd(j,100000,1)
		{
			if(j-v[i].F>=0)
			dp[j]= min(dp[j], dp[j-v[i].F]+v[i].S);
		}
	}
	repd(i,100000,0)
	{
		if(dp[i]<=w)
		{
			cout<<i;
			break;
		}
	}

}



int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t=1;
    //pre();
    //cin>>t;
    //if(t^1)exit(0);
    while(t--)
       solve();
}

Measured memory_bytes: 1024
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if a<=9 and b<=9:
        print(a*b)
    else:
        print(-1)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <algorithm>
#define For(i,x,y) for(int i=(x); i<=(y); i++)
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
ll pre1[maxn],pre2[maxn];
int main()
{
    int n,m,k,x,pos;
    int ans=0;
    cin>>n>>m>>k;
    For(i,1,n)cin>>x,pre1[i]=pre1[i-1]+x;
    For(i,1,m)cin>>x,pre2[i]=pre2[i-1]+x;
    int j=m;
    For(i,0,n)
    {
        if(pre1[i]>k)break;
        while(pre2[j]>k-pre1[i])j--;
        ans=max(i+j,ans);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6692
//#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>

//Some constants don't work
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN -2147483648
#endif
//short hand tricks
typedef long long ll;

using namespace std;

int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(false);
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    while(B<=A) {
        if(K<=0) {
            cout << "No\n";
            return 0;
        }
        B*=2;
        K--;
    }
    while(C<=B) {
        if(K<=0) {
            cout << "No\n";
            return 0;
        }
        C*=2;
        K--;
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


#define N 10000050

int prime[N];

void eratosthenes(){
  rep(i,N) prime[i]=0;
  repi(i,1,N){
    for(int j=i;j<N;j+=i){
      prime[j]++;
    }
  }
}


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  eratosthenes();
  int ans=0;
  rep(i,n+1){
    ans+=(prime[i]*(i));
    //cout<<ans<<endl;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 81756
fun main(args: Array<String>) {
    val S = readLine()!!

    when(S){
        "SUN" -> print(7)
        "MON" -> print(6)
        "TUE" -> print(5)
        "WED" -> print(4)
        "THU" -> print(3)
        "FRI" -> print(2)
        "SAT" -> print(1)
    }
}

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

using namespace std;
typedef long long ll;

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

  int qualified = 0;
  int oversea_students = 0;
  for (char c : s) {
    switch (c) {
      case 'a':
        if (qualified < a + b) {
          cout << "Yes";
          ++qualified;
        } else {
          cout << "No";
        }
        break;
      case 'b':
        ++oversea_students;
        if (qualified < a + b && oversea_students <= b) {
          cout << "Yes";
          ++qualified;
        } else {
          cout << "No";
        }
        break;
      case 'c':
        cout << "No";
        break;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include <numeric>
#include<cmath>
#include<string>
using namespace std;
#define ll long long

int main(void){
    int n;
    int k;
    cin >> n>>k;
    ll sum = 0;
    int cnt = k;
    for(int i=0;i<n;i++){
        sum += cnt;
        cnt++;
    }
    // cout << sum<<endl;
    if(k+n-1<0){
        cout << sum-(k+n-1)<<endl;
    }else if(0<k){
        cout << sum-k<<endl;
    }else{
        cout << sum<<endl;
    }
    
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
  if A[i]>=B[i]:
    ans+=B[i]
  else:
    ans+=A[i]
    B[i]-=A[i]
    if A[i+1]>=B[i]:
      ans+=B[i]
      A[i+1]-=B[i]
    else:
      ans+=A[i+1]
      A[i+1]=0
print(ans)

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

#define fast ios::sync_with_stdio(false); cin.tie(0)
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed; cout.precision(a);
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

int n;
int a[100010];

int main() {
	fast;

	cin >> n;

	for(int i=1; i<=n; i++) {
		int t;
		cin >> t;
		a[t] = i;
	}

	for(int i=1; i<=n; i++) {
		cout << a[i] << " ";
	}
}

Measured memory_bytes: 1280
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int MAGIC = 1000000007;
#define int long long int

map<string, int> prev_memo;
set<string> NG;

char c[4] = {'A', 'G', 'C', 'T'};

int N;

void init() {
  const string AGC = "AGC";
  vector<string> v = {"AGC"};
  for (auto x : c) {
    v.push_back(x + AGC);
    v.push_back(AGC + x);
    for (auto y : c) {
      v.push_back(x + AGC + y);
      v.push_back(string({x, y}) + AGC);
      v.push_back(AGC + x + y);
    }
  }

  for (const auto &str : v) {
    NG.emplace(str);
    for (int i = 1; i < str.size(); i++) {
      string s = str;
      swap(s[i - 1], s[i]);
      NG.emplace(s);
    }
  }

  for (auto x : c) {
    for (auto y : c) {
      prev_memo[string({x, y})] = 1;
    }
  }
}

void solve() {
  // int x;
  // cout << endl;
  init();
  cin >> N;

  for (int i = 2; i < N; i++) {
    map<string, int> memo;
    for (auto p : prev_memo) {
      for (auto cc : c) {
        string key = p.first + cc;
        if (NG.count(key) == 0) {
          if (key.size() == 5) {
            int &m = memo[key.substr(1, 4)];
            m = (m + p.second) % MAGIC;
          } else {
            int &m = memo[key];
            m = (m + p.second) % MAGIC;
          }
        }
      }
    }
    prev_memo = memo;
  }

  int ans = 0;
  for (auto p : prev_memo) {
    ans = (ans + p.second) % MAGIC;
  }

  cout << ans << endl;
}

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


Measured memory_bytes: 256
fn main() {
  let input = gets::<i32>();
  let a = input[0];
  println!("{}", a*a*a+a*a+a);
}

fn gets<T: std::str::FromStr>() -> Vec<T> {
  let mut line = String::new();
  std::io::stdin().read_line(&mut line).unwrap();
  line.split_whitespace().filter_map(|s|s.parse().ok()).collect()
}


Measured memory_bytes: 2104