akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
 {
  int n,sum=0;
  cin>>n;
  int b[n];  
  for(int i=0;i<n-1;++i)
    cin>>b[i];
 for(int i=0;i<n-2;++i)
   sum+=min(b[i],b[i+1]);
  sum+=b[0]+b[n-2];
  cout<<sum;
  return 0;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PI;
using namespace std;
#define MAX  999999
int main(){
    int n; cin>>n;
    stack<int> st; int ans = 0;
    bool check = true;
    rep(i,n){
        ans = i;
        string s; cin >>s;
        if(s == "A"){st.push(1);}
        else if(s == "Un"){if(st.empty()){check = false;break;} st.pop();}
    }
    if(ans == n-1 && st.empty() && check == true) cout<< "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3164
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cstdio>
#include <cmath>
#include <cctype>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int H, W;
	char c[100][100];
	
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c[i][j];
		}
	}

	for (int i = 0; i < H; i++) {
		for (int k = 0; k < 2; k++) {
			for (int j = 0; j < W; j++) {
				cout << c[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

int main()
{
  string s;
  cin >> s;
  int num[4];
  REP(i, s.length())
  {
    num[i] = atoi(s.substr(i, 1).c_str());
  }

  REP(i, 8)
  {
    int result = num[0];
    string s = to_string(num[0]);
    REP(j, 3)
    {
      if (((i >> j) & 1) == 1)
      {
        result += num[j + 1];
        s += "+" + to_string(num[j + 1]);
      }
      else
      {
        result -= num[j + 1];
        s += "-" + to_string(num[j + 1]);
      }
    }
    s += "=7";
    if (result == 7)
    {
      cout << s << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
    int N;
    cin >> N;
    vector<pair<int, int>> pp(N);
    rep(i, N)
    {
        cin >> pp.at(i).first;
        pp.at(i).second = i;
    }

    sort(pp.begin(), pp.end());
    int mm = N + 1;
    int cnt = 0;
    rep(i, N)
    {
        if (mm > pp.at(i).second)
        {
            mm = pp.at(i).second;
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll N;

ll qpow(ll x, int b)
{
	ll ret = 1;
	while(b)
	{
		if(b & 1)
			ret *= x;
		b >>= 1;
		if(!b)
			break;
		x = x * x;
		//b >>= 1;
	}
	return ret;
}
vector<pair<ll, int> > facs;

int main()
{
	cin>>N;
	ll sqt = sqrt(N);
	for(ll i = 2; i <= sqt; ++i)
	{
		if(N % i == 0)
		{
				ll NN = N;
				ll exp = 0;
				while(NN % i == 0)
				{
						NN /= i;
						++exp;
				}
				facs.push_back(make_pair(i, exp));
				if(i * i != N)
				{
						ll NN = N;
						ll exp = 0;
						ll j = N / i;
						while(NN % j == 0)
						{
								NN /= j;
								++exp;
						}
						facs.push_back(make_pair(j, exp));
				}
		}
	}
	
	ll ans = (N == 2)?1:2;
	for(auto& p: facs)
	{
			ll K = p.first;
			int exp = p.second;
			ll NN = N;
			NN /= qpow(K, exp);
			if((NN - 1) % K == 0)
				++ans;
	}
	ll M = N - 1;
	sqt = sqrt(M);
	for(ll i = 2; i <= sqt; ++i)
	{
			if(M % i == 0)
			{
				if(i * i == M)
					ans++;
				else
					ans += 2;
			}
			
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
n,ma,mb = map(int, input().split())
p = []
for i in range(n):
    a,b,c = map(int, input().split())
    p.append((a,b,c))

r = [[40001 for j in range(401)] for i in range(401)]
r[0][0] = 0
for i in range(n):
    for j in range(400 - 10*i, -1, -1):
        for k in range(400 - 10*i, -1, -1):
            if 40001 > r[j][k]:
                r[j + p[i][0]][k + p[i][1]] = min(r[j + p[i][0]][k + p[i][1]], r[j][k]+p[i][2])
min_v = 40001
ia = ma
ib = mb
flag  =False
while ia <= 400 and ib<=400:
    if 40001 > r[ia][ib] > 0:
        min_v = min(min_v,  r[ia][ib])
        flag = True
    ia += ma
    ib += mb
        
if not flag:
    print(-1)
else:
    print(min_v)

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define int               long long
#define M                 1000000007
#define MM                998244353
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount

template<typename T1,typename T2>
std::istream& operator>>(std::istream& in,pair<T1,T2> &a)
{
	in>>a.fr>>a.sc;
	return in;
}
template<typename T1,typename T2>
std::ostream& operator<<(std::ostream& out,pair<T1,T2> &a)
{
	out<<a.fr<<" "<<a.sc;
	return out;
}

int h[101005];
int dp[101005];

void solve(){
	int n,k;
	cin>>n>>k;
	rep(i,0,n){
		cin>>h[i];
	}
	rep(i,0,n+k+4){
		dp[i]=M;
	}
	dp[n-1]=0;
	for(int i=n-2;i>=0;i--){
		rep(j,1,k+1){
			dp[i]=min(dp[i],dp[i+j]+abs(h[i]-h[i+j]));
		}
	}
	cout<<dp[0];
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	#ifdef DSU
		cleardsu(MAXDSUSIZE);
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 1792
import java.util.*

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val (n, m) = reader.readLine()!!.split(" ").map{it.toInt()}
    val k = Array(m, {
        val x = reader.readLine()!!.split(" ").map{it.toInt()-1}
        x.drop(1)
    })
    val p = reader.readLine()!!.split(" ").map{it.toInt()}

    val res = Array(m, {
        ArrayList<Int>()
    })
    val max = (1 shl n)
    for (i in 0..m-1) {
        for (j in 0..max-1) {
            var cnt = 0
            for (d in 0..n-1) {
                if ((d in k[i]) && (j and (1 shl d) > 0)) {
                    cnt += 1
                }
            }
            if (cnt%2 == p[i]) {
                res[i].add(j)
            }
        }
    }

    var ans = res[0].toSet()
    for (i in 1..m-1) {
        ans = ans.intersect(res[i])
    }
    println(ans.size)
}


Measured memory_bytes: 37872
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ma[105][105]={{}};
  int i,j;
  long long o=0;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      cin >> ma[i][j];
    }
  }
  for(i=0;i<n;i++){
    for(j=i;j<n;j++){
      o+=min(ma[i][j],ma[j][i]);
    }
  }
  cout << o << endl;
}

Measured memory_bytes: 1208
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var nums = GetStrings();
                var a = int.Parse(nums[0]);
                var b = int.Parse(nums[2]);
                switch (nums[1])
                {
                    case "+":
                        Console.WriteLine(a + b);
                        break;
                    case "-":
                        Console.WriteLine(a - b);
                        break;
                    case "*":
                        Console.WriteLine(a * b);
                        break;
                    case "/":
                        Console.WriteLine(a / b);
                        break;
                    default:
                        return;
                }
            }
        }

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static List<int> GetNumbers()
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
        }

        static List<string> GetStrings()
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
    }
}

Measured memory_bytes: 10040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}




#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


  








int main() {
  string s,t;
  cin >> s >> t;
  ll cnt = 0;
  rep (i,s.size()){
    if (s[i]!=t[i]){
      cnt ++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) 			a.begin(),a.end()
#define pb 				push_back
#define vi				vector<int>
#define vl 				vector<long long>
#define MOD 			1000000007
#define FOR(i,a,b) 		for(int i = a; i <= b ; i++)
#define forn(i,n) 		for(int i = 0 ; i < n; i++)
#define br 				cout<<endl;
#define testc()			int t;cin>>t;while(t--)
#define ll				long long
#define printv(v)		for(auto x : v) cout<<x<<' ';br;
#define ff				first
#define ss 				second
#define fast 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vb 				vector<bool>
#define INF				INT_MAX
#define INFL			LLONG_MAX

using namespace std;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using ld = long double;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


vi prime_generator()
{
	vector<int> pr;
	const int N = 10000000;
	vi lp(N+1);
	

	for (int i=2; i<=N; ++i) {
	    if (lp[i] == 0) {
	        lp[i] = i;
	        pr.push_back (i);
	    }
	    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
	        lp[i * pr[j]] = pr[j];
	}
}


vi z_function(string t)
{
	int n = t.size();
	vi z(t.size());
	for(int i = 1,r = 0,l = 0 ; i <  n ; i++)
	{
		if(i <= r)
			z[i] = min(r - i + 1,z[i - l]);
		while(i + z[i] < n && t[z[i]] == t[i + z[i]])
			z[i]++;
		if(i + z[i] - 1 > r)
			r = i + z[i] - 1,l = i;
	}
	return z;
}


ll power(ll a,ll b,ll mod)
{
	ll res = 1;
	a = a % mod;
	while(b)
	{
		if(b & 1)
			res = (res * a) % mod;
		b = b >> 1;
		a = (a * a) % mod;
	}
	return res;
}

template<typename T>
void answer(T s)
{
	cout<<s<<endl;
	exit(0);
}
//use for string in strcpy([string],s.c_str())
//stringstream fs---->fs>>string_name**this will copy the value from fs to string_name
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/


int main()
{
	fast
	int n,d;cin>>n>>d;
	int x = 0;
	int y = 1;
	while(y <= n)
	{
		x++;
		y += 2 * d + 1;
	}	
	cout<<x<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    if(400<=n&&n<=599) printf("8");
    else if(600<=n&&n<=799) printf("7");
    else if(800<=n&&n<=999) printf("6");
    else if(1000<=n&&n<=1199) printf("5");
    else if(1200<=n&&n<=1399) printf("4");
    else if(1400<=n&&n<=1599) printf("3");
    else if(1600<=n&&n<=1799) printf("2");
    else if(1800<=n&&n<=1999) printf("1");
    return 0;
}

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

int main() {
    int n, a, b, c, d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;
    s = '#' + s + '#';
    bool con = false;
    for(int i = a;i+1<= c;i++){
        if(s[i] == '#' && s[i+1] == '#'){
            con = true;
        }
    }
    bool con2 = false;
    for (int i = b; i+1 <= d; i++) {
        if (s[i] == '#' && s[i + 1] == '#') {
            con = true;
        }
    }
    if(con == true || con2 == true){
        cout<<"No"<<endl;
    } else {
        if(c < d){
            cout<<"Yes"<<endl;
        } else {
            bool con3 = false;
            for (int i = b; i <= d; i++) {
                if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                    con3 = true;
                }
            }
            if(con3){
                cout<<"Yes"<<endl;
            } else {
                cout<<"No"<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 772
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n, m;
int a[100000];
vector<int> edge[100000];
vector<int> tree[100000];
int visited[100000];

void dfs(int x, int p) {
    visited[x] = 1;
    tree[p].push_back(a[x]);
    for (int i : edge[x]) {
        if (visited[i]) continue;
        dfs(i, p);
    }
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; ++i) cin >> a[i];
	int cnt = (n - 1 - m) << 1;
	if (cnt > n) {
        printf("Impossible\n");
        return 0;
	}
	if (cnt == 0) {
        printf("0\n");
        return 0;
	}
	for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
	}
	
	int ord = 0;
	for (int i = 0; i < n; ++i) {
        if (visited[i]) continue;
        dfs(i, ord++);
	}
	llong ans = 0;
	cnt -= ord;
	vector<int> arr;
	for (int i = 0; i < ord; ++i) {
        sort(tree[i].begin(), tree[i].end());
        ans += tree[i][0];
        for (int j = 1; j < tree[i].size(); ++j) arr.push_back(tree[i][j]);
	}
	sort(arr.begin(), arr.end());
	for (int i = 0; i < cnt; ++i) ans += arr[i];
	printf("%lld\n", ans);
	return 0;
}


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


int main()
{
	int k;
	int height[5];
	
	for (int i = 0; i < 5; ++i)
		scanf("%d", height + i);
	scanf("%d", &k);
	sort(height, height + 5);
	printf(height[4] - height[0] <= k ? "Yay!\n" : ":(\n");
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
XY = []
for i in range(N):
    x,y = map(int,readline().split())
    XY.append(x+y*1j)
    
center = []    
for z0,z1 in itertools.combinations(XY,2):
    center.append((z0+z1)/2)
    
for z0,z1,z2 in itertools.combinations(XY,3):
    a = z1-z0
    b = z2-z0
    nume = a*b*(a.conjugate()-b.conjugate())
    deno = a.conjugate()*b - a*b.conjugate()
    if deno == 0:
        continue
    c = nume / deno
    c += z0
    center.append(c)

XY = np.array(XY)
center = np.array(center)

ans = abs(XY[:,None] - center[None,:]).max(axis=0).min()
print(ans)


Measured memory_bytes: 52272
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
 
int main()
{
    int N, D; cin >> N >> D;

    cout << (N + 2 * D) / (2 * D + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	char i, s[100];
	for(i = 0; i < 4; i++)
		scanf("%c", &s[i]);
	for(i = 0; i < 3; i++){
		if (s[i] == s[i + 1]){
			puts("Bad");
			return 0;
		}
	}
	puts("Good");
	return 0;
}

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

int main(){
    int n,q;
    cin >> n >> q;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for(int i=0; i<q; i++){
        int l,r;
        cin >> l >> r;
        cout << upper_bound(a.begin(), a.end(), r) -lower_bound(a.begin(), a.end(), l) << endl;
    }
    return 0;
}



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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  int N,M;
  cin>>N>>M;
  vector<vector<int>> v(N,vector<int>(M));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      int x;
      cin>>x;
      v[i][j]=x-1;
    }
  }
  unordered_map<int,bool> m;
  int ans = INF;
  for(int i = 0; i < M; i++) m[i]=true;
  for(int i = 0; i < M; i++){
    vector<int> w(M,0);
    for(int j = 0; j < N; j++){
      for(int k = 0; k < M; k++){
        if(m[v[j][k]]){
          w[v[j][k]]++;
          break;
        }
      }
    }
    int p = 0;
    for(int j = 0; j < M; j++) chmax(p,w[j]);
    for(int j = 0; j < M; j++){
      if(w[j]==p) {
        m[j]=false;
        break;
      }
    }
    chmin(ans,p);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
def main():
    n, k = map(int, input().split())
    res = 0.0
    for i in range(1, n + 1):
        if i >= k:
            res += 1 / n
            continue
        ii = i
        j = 0
        while ii < k:
            ii *= 2
            j += 1
        res += 1 / n / (2 ** j)
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define MAX_N 200000

int N, dat[2 * MAX_N - 1];
static const int maxi = pow(2, 31) - 1;

void init(int n) {
	N = 1;
	while (N < n) N *= 2;

	fill_n(dat, 2 * N - 1, maxi);
}

void update(int k, int a) {
	k += N - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l)
		return maxi;
	if (a <= l && r <= b)
		return dat[k];

	int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
	int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
	return min(vl, vr);
}

void printv(int v[], int len) {
	for (int i = 0; i < len; i++)
		cout << " " << v[i];
	cout << endl;
}

int main() {
	int n, q, com, x, y;
	cin >> n >> q;
	init(n);
	while (q-->0) {
//		printv(dat, N);
		cin >> com >> x >> y;
		if (com == 0)
			update(x, y);
		else
			cout << query(x, y + 1, 0, 0, N) << endl;;
	}
	return 0;
}

Measured memory_bytes: 2188
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long power[33];
long long Q;
long long A[1 <<18], B[1 << 18], C[1 << 18], D[1 << 18];

long long query(long long lx, long long ly, long long rx, long long ry) {
	long long sz = -1;
	long long px = 0, py = 0, qx = 0, qy = 0;

	for (int i = 29; i >= 0; i--) {
		long long V1 = (lx + power[30] + power[i + 1] - power[i]) / power[i + 1]; V1 -= power[30 - (i + 1)];
		long long VX = V1 * power[i + 1] + power[i];
		if ((lx + power[30] - power[i]) % power[i + 1] < power[i]) {
			V1--; VX = lx;
		}
		long long V2 = (ly + power[30] + power[i + 1] - power[i]) / power[i + 1]; V2 -= power[30 - (i + 1)];
		long long VY = V2 * power[i + 1] + power[i];
		if ((ly + power[30] - power[i]) % power[i + 1] < power[i]) {
			V2--; VY = ly;
		}
		
		if (VX <= rx && VY <= ry) {
			sz = i;
			px = V1 * power[i + 1] + power[i]; qx = V1 * power[i + 1] + 2LL * power[i] - 1LL;
			py = V2 * power[i + 1] + power[i]; qy = V2 * power[i + 1] + 2LL * power[i] - 1LL;
			break;
		}
	}
	if (sz == -1) {
		return abs(lx - rx) + abs(ly - ry);
	}

	// パターン 1
	if (px <= lx && lx <= qx && px <= rx && rx <= qx) {
		long long S = abs(ly - ry);
		long long T1 = abs(lx - (px - 1LL)) + abs((px - 1LL) - rx);
		long long T2 = abs(lx - (qx + 1LL)) + abs((qx + 1LL) - rx);
		S += min(T1, T2);
		return S;
	}

	// パターン 2
	if (py <= ly && ly <= qy && py <= ry && ry <= qy) {
		long long S = abs(lx - rx);
		long long T1 = abs(ly - (py - 1LL)) + abs((py - 1LL) - ry);
		long long T2 = abs(ly - (qy + 1LL)) + abs((qy + 1LL) - ry);
		S += min(T1, T2);
		return S;
	}

	// パターン 3
	return abs(lx - rx) + abs(ly - ry);
}

int main() {
	// 入力
	cin >> Q;
	for (int i = 1; i <= Q; i++) cin >> A[i] >> B[i] >> C[i] >> D[i];
	power[0] = 1;
	for (int i = 1; i <= 32; i++) power[i] = (3LL * power[i - 1]);

	// 前準備
	for (int i = 1; i <= Q; i++) {
		A[i]--; B[i]--; C[i]--; D[i]--;
		if (A[i] > C[i]) { swap(A[i], C[i]); swap(B[i], D[i]); }
		if (B[i] > D[i]) {
			B[i] = power[30] - 1LL - B[i];
			D[i] = power[30] - 1LL - D[i];
		}
	}

	// 計算
	for (int i = 1; i <= Q; i++) {
		cout << query(A[i], B[i], C[i], D[i]) << endl;
	}
	return 0;
}

Measured memory_bytes: 6528
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        HashSet<Character> hs = new HashSet<>();
        for(char c : s){
            hs.add(c);
        }
        if(s.length == hs.size()){
            System.out.println("yes");
        }else{
            System.out.println("no");
        }
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

int n, m;
P m_p[1000000];

int main() {
  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    m_p[i] = make_pair(b, a);
  }
  sort(m_p, m_p + m);

  int ans = 0, last = 0;
  rep(i, m) {
    int a = m_p[i].second;
    int b = m_p[i].first;

    if(last < a) {
      last = b - 1;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3
#define LINF 0x3f3f3f3f3f3f3f
#define MAXN 2*int(1e5)+7
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define max3(x, y, z) max(x, max(y, z))
using namespace std;
using namespace __gnu_pbds;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<unsigned ll, pair<int, int> > piii;
typedef pair<pair<int, int>, int> piii2;
typedef pair<char, pair<int, int>> pcii;
typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;


int main() {
    int n;
    cin >> n;
    vector<int> v(n), p1(n), p2(n);
    for(int i = 0; i < n; i++) {
        v[i] = i+1;
        cin >> p1[i];
    }
    for(int i = 0; i < n; i++)
        cin >> p2[i];


    ll a = 1, b = 1, cont = 1;

    while(next_permutation(v.begin(), v.end())) {
        bool is = true, is2 = true;
        cont++;
        for(int i = 0; i < n; i++) {
            if(v[i] != p1[i]) is = false;
            if(v[i] != p2[i]) is2 = false;
        }
        if(is == true) a = cont;
        if(is2 == true) b = cont;
    }
    cout << abs(a-b) << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int w, d;
    while (cin >> w >> d, w + d) {
        array<int, 25> W = {};
        array<int, 25> D = {};
        REP (i, 0, w) {
            int wi;
            cin >> wi;
            W[wi]++;
        }
        REP (i, 0, d) {
            int di;
            cin >> di;
            D[di]++;
        }
        int sum = 0;
        REP (i, 0, W.size()) {
            sum += i * max(W[i], D[i]);
        }
        cout << sum << endl;
    }
    return 0;
}

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

vector<int> parent;
vector< vector<int> > child;
vector<int> ra;
vector<int> fin;
void search(int root,int cur){
  for(int i = 0;i < child[root].size();i++){
    if(ra[child[root][i]] < cur+1 && fin[parent[child[root][i]]] == 0){
      ra[child[root][i]] = cur+1;
      parent[child[root][i]] = root;
      if(fin[child[root][i]] == 0){
	search(child[root][i],cur+1);
      }
      fin[child[root][i]] = 1;
    }
  }
}

int main(){
  int n,m;
  cin >> n >> m;
  parent = vector<int>(n,-1);
  child = vector< vector<int> >(n);
  ra = vector<int>(n);
  fin = vector<int>(n);
  for(int i = 0;i < n-1+m;i++){
    int u,v;
    scanf("%d",&u);
    scanf("%d",&v);
    parent[v-1] = u-1;
    child[u-1].push_back(v-1);
  }
  int root;
  for(int i = 0;i < n;i++){
    if(parent[i] == -1){
      root = i;
      break;
    }
  }
  search(root,0);
  for(int i = 0;i < n;i++){
    cout << parent[i]+1 << " ";
  }
  cout << endl;
}


Measured memory_bytes: 13696
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll n, k;
    cin >> n >> k;
    ll ans = k;
    REP(i, n - 1){
        ans *= k - 1;
    }
    cout << ans << endl;
    return 0;
}


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


int main(){
    string s;cin>>s;
    ll k;cin>>k;
    map<char,ll> m;
    rep(i,0,s.size())m[s.at(i)]++;
    set<string> sett;
    ll cn=0;
    for(auto i:m){
        rep(j,0,s.size()){
            if(s.at(j)==i.first){
                rep(k,1,6){
                    if(j+k<=s.size()){
                        string tm=s.substr(j,k);
                        sett.insert(tm);
                    }
                }
            }
        }
        cn++;
        if(cn==5)break;
    }
    cn=0;
    string ans[6];
    for(auto i:sett){
        ans[cn]=i;
        cn++;
        if(cn==5)break;
    }
    cout<<ans[k-1]<<endl;
}







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

int main() {
	int64_t n, k;
	cin >> n >> k;
	//x個選ぶ k<=x<=n+1 
	/* xのとき、n+(n-1)+...+(n-x+1) - ( (x-1) + ... + 1 + 0) + 1
	= (n-x+1 + n)*x*0.5 - (0+x-1)*x*0.5 + 1
	=(2n-x+1-x+1)*0.5*x + 1
	=(n-x+1)*x + 1 */
	int64_t ans = 0;
	for (int i = k; i <= n + 1; i++) {
		ans += (n - i + 1) * i + 1;
	}
	cout << ans%1000000007 << endl;
}


Measured memory_bytes: 3608
import numpy as np
a,b,x = map(int,input().split(" "))
triangle = (a*a*b)/2
if x >= triangle:
    space = a*a*b - x
    theta = np.arctan(((2*space)/(a**2))/a)
    print(np.rad2deg(theta))
else:
    water = (2*x)/(a*b)
    theta = np.arctan(b/water)
    print(np.rad2deg(theta))


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

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) {
      cout << " " << i;
    } else {
      int x = i;
      while (x) {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
        x /= 10;
      }
    }
  }
  cout << endl;

  return 0;
}




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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD


ll N,M,L,Q,S[101010],T[101010];
vector<pll> abcv[333];
vector<ll> exv[333];
ll mk[333];

ll i,j,k;
void bfs(ll s){
    priority_queue<pll> q;
    ll i,j=0;
    fornum(i,0,N){
        mk[i+1]=0;
    }
    q.push({L,s});
    
    while(q.size()){
        auto qa=q.top();
        q.pop();
        if(mk[qa.second]==1){
            continue;
        }
        mk[qa.second]=1;
        exv[s].push_back(qa.second);
        fornum(i,0,abcv[qa.second].size()){
            auto b=abcv[qa.second][i];
            if(qa.first>=b.second&&!mk[b.first]){
                //mk[b.first]=qa.first-b.second;
                
                q.push({qa.first-b.second,b.first});
            }
        }
    }
}
void solve(ll s,ll t){
    //printf("aa");
    ll i,j;
    queue<pll> q;
    fornum(i,0,N){
        mk[i+1]=0;
    }
    q.push({s,0});
    mk[s]=1;
    while(q.size()){
        auto qa=q.front();
        //printf("a%llda",qa.first);
        q.pop();
        //printf("%lld ",qa.first);
        
        fornum(i,0,exv[qa.first].size()){
            ll b=exv[qa.first][i];
            if(!mk[b]){
                if(b==t){
                    printf("%lld\n",qa.second);
                    return;
                }
                mk[b]=1;
                q.push({b,qa.second+1});
            }
        }
    }
    printf("-1\n");
}

int main(){
    scanf("%lld%lld%lld", &N,&M,&L);
    fornum(i,0,M){
        ll a,b,c;
        scanf("%lld%lld%lld",&a,&b,&c);
        if(c>L)
            continue;
        abcv[a].push_back({b,c});
        abcv[b].push_back({a,c});
    }
    fornum(i,0,N){
        
        bfs(i+1);
        
    }
    scanf("%lld",&Q);
    fornum(i,0,Q){
        scanf("%lld%lld",&S[i],&T[i]);
    }
    fornum(i,0,Q){
        solve(S[i],T[i]);
    }
    
    return 0;
}

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

using namespace std;

typedef long long ll;

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

 ll t1,t2,a1,b1,a2,b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
 ll p=(a1-b1)*t1;
 ll q=(a2-b2)*t2;
 if(p>0) {
   p=-p; 
   q=-q;
 }
 if(p+q<0) cout << 0 << endl;
 else if(p+q==0) cout << "infinity" << endl;
 else if(p%(p+q)==0) cout << -p/(p+q)*2 << endl;
 else cout << -p/(p+q)*2+1 << endl;
   
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

bool calc(int a, int b, int c) {
  return a == b && b != c;
}

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  if(calc(a,b,c) || calc(b,c,a) || calc(c,a,b)) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    vector<ll>cnt(n,0);
    for (int i = 0; i < n; ++i) {
        int a;cin >>a;
        cnt[a]++;
    }
    bool flg=true;
    if(n%2==0){
        for (int i =1; i <n;i+=2) {
            if(cnt[i]!=2)flg=false;
        }
    }
    else {
        if(cnt[0]!=1)flg=false;
        for (int i =2; i <n;i+=2) {
            if(cnt[i]!=2)flg=false;
        }
    }
    if(!flg) {
        cout << 0 << endl;
        return 0;
    }
    ll ans=1;
    ll k=n/2;
    for (int i = 0; i < k; ++i) {
        ans*=2;
        ans%=mod;
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 4052
#include <iostream>

using namespace std;

int main(){
    int h[300],w[300];
    int c=0;
    while(1){
        cin >> h[c] >> w[c];
        if(h[c]==0&&w[c]==0)break;
        c++;
    }
    for(int i=0;i<c;i++){
        for(int ih=0;ih<h[i];ih++){
            for(int iw=0;iw<w[i];iw++){
                cout << "#";
            }
            cout << endl;
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3076
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int k = in.nextInt();
            char c = s.charAt(k - 1);
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) != c)
                    out.print("*");
                else
                    out.print(c);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}

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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define mp make_pair

int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double mx = 0, w = 0, s = 0;
  for (int i = 0; 100 * a * i <= f; i++) {
    int tmp = f - 100 * a * i;
    for (int j = 0; 100 * b * j <= tmp; j++) {
      int ttmp = tmp - 100 * b * j;
      for (int k = 0; e * (i * a + j * b) >= k * c && k * c <= ttmp; k++) {
        int water = (i * a + j * b) * 100;
        int sugar = k * c;
        int tttmp = ttmp - k * c;
        int left = ttmp - sugar;
        int left_sugar = (i * a + j * b) * e - sugar;
        int p = min(left_sugar,tttmp) / d;
        sugar += p * d;
        double q = (double)sugar / (double)(water + sugar);
        if (q >= mx) {
          mx = q;
          w = water;
          s = sugar;
        }
      }
    }
  }
  cout << w + s << " " << s << endl;
  return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

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

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    string S;
    cin >> S;
    S.erase(S.begin() + 7);
    S.erase(S.begin() + 4);
    cerr << S << endl;
    if(stoi(S) > 20190430) PRINT("TBD");
    else PRINT("Heisei");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <math.h>
#include <map>
#include <queue>

#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define vec vector

using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

ll dp[100010][3];
int main() {
  int n;
  cin >> n;
  vec<vec<ll> > a(n+1, vec<ll>(3));
  rep(i,n) cin >> a[i+1][0] >> a[i+1][1] >> a[i+1][2];

  rep(i, 100010) rep(j, 3) dp[i][j] = -INF;
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;

  for(int i=1; i<=n; i++) {
    rep(j, 3) {
      rep(k, 3) {
        if (j==k) continue;
        chmax(dp[i][j], dp[i-1][k] + a[i][j]);
      }
    }
  }

  ll ans = 0;
  rep(i, 3) {
    ans = max(ans, dp[n][i]);
  }
  say(ans);
  return 0;
}


Measured memory_bytes: 8064
N = int(input())
S = [input() for _ in range(N)]
# print(S) # ['AC', 'TLE', 'AC', 'AC', 'WA', 'TLE']
print('AC x ' + str(S.count('AC')))
print('WA x ' + str(S.count('WA')))
print('TLE x ' + str(S.count('TLE')))
print('RE x ' + str(S.count('RE')))

Measured memory_bytes: 16292
a;g(){scanf("%d",&a);a?a:exit(0);}
main(m,v,x){
  for(;;){double s=0,t=0,z=.01745329,e=.000001;
    for(v=360,m=g();--m;s+=sin(x*z))v-=x=g();s+=sin(v*z);
    for(v=360,m=g();--m;t+=sin(x*z))v-=x=g();t+=sin(v*z);
    puts(s>t+e?"1":s+e<t?"2":"0");
  }
}

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

int main() {
    int a, time, minute, seconds, mod;
    cin >> a;
    time = a / 3600;
    mod = a % 3600;
    minute = mod / 60;
    seconds = mod % 60;
    cout << time << ":" << minute << ":" << seconds << endl; 
    return 0;
}


Measured memory_bytes: 3088
cnt[9999];
main(T,N,i,j,r,p,f){for(scanf("%d",&T);T--;printf("%d\n",r-f-!p)){
	memset(cnt,0,sizeof(cnt));
	scanf("%d",&N),getchar();
	for(i=0;i<2*N;i++)if(getchar()=='Y')cnt[(i+1)/2]|=1;
	for(i=0;i<2*N;i++)if(getchar()=='Y')cnt[(i+1)/2]|=2;
	for(r=p=f=i=0;!p&&i<N+1;i++,r++)
		if(cnt[i]&2)r+=2,p=1,f=0;
		else if(cnt[i]&1)r+=1,p=1,f=1;
	for(;i<N+1;i++,r++)
		if(cnt[i]==3)r+=2,f=1;
		else if(cnt[i])r+=1,f=cnt[i]&1;
}exit(0);}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a, b;
    cin >> a >> b;
    if (1 <= a && a <= 9 && 1 <= b && b <= 9)
    {
        cout << a * b << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

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


Measured memory_bytes: 256
[X,K,D]=list(map(int, input().split()))
abx=round(abs(X))
n=round(abx//D)
if n>K:
    ans=abx-K*D
else:
    x2=abx-n*D
    x1=(n+1)*D-abx
    if x2>=x1:
        if (K-n-1)%2==0:
            ans=x1
        else:
            ans=x2
    else:
        if (K-n)%2==0:
            ans=x2
        else:
            ans=x1
print(ans)


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int a,b,c; cin >> a >> b >> c;
  int k; cin >> k;
  for(int i = 0; i < k; ++i){
    if(a >= b)b *= 2;
    else if(b >= c) c *= 2;
  }
  cout << (a < b && b < c ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3628
n, k = map(int, input().split())
x = list(map(int, input().split()))
time = 3 * 10 ** 8

for i in range(n - k + 1):
    l = x[i]
    r = x[i + k - 1]
    if l * r >= 0:
        total = max(abs(l), abs(r))
    else:
        total = (r - l + min(abs(l), abs(r)))
    time = min(time, total)

print(time)


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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll n,x;
vector <int> pos;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++){
		cin >> x;
		pos.pb(x);
	}
	sort(pos.begin(),pos.end());
	cout << pos[n-1]-pos[0];
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
const ll MOD = 1e9+7;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n,k; cin >> n >> k;
    if(k==n){
        ll ans=1;
        rep(i,n){
            ll x; cin >> x;
            ans*=x; ans%=MOD;
        }
        cout << (ans+MOD)%MOD << endl;
        return 0;
    }
    priority_queue<ll> p;
    priority_queue<ll,vector<ll>,greater<ll>> q;
    priority_queue<ll> r;
    rep(i,n){
        ll x; cin >> x;
        if(x>0)p.push(x);
        else{q.push(x); r.push(x);}
    }
    //全部負
    if(p.size()==0){
        if(k%2==1){
            ll ans=1;
            rep(i,k){
                ans*=r.top(); r.pop();
                ans%=MOD;
            }
            cout << (ans+MOD)%MOD << endl;
            return 0;
        }else{
            ll ans=1;
            rep(i,k){
                ans*=q.top(); q.pop();
                ans%=MOD;
            }
            cout << (ans+MOD)%MOD << endl;
            return 0;
        }
    }
    //
    vector<ll> ans;
    int ok=0;
    if(k%2==1){
        ans.pb(p.top()); p.pop();
        ok=1;
        k--;
    }
    while(p.size()>1&&q.size()>1&&ans.size()<k+ok){
        ll f=p.top(); p.pop();
        ll s=p.top(); p.pop();
        ll r=q.top(); q.pop();
        ll t=q.top(); q.pop();
        if(f*s<=r*t){
            ans.pb(-r);
            ans.pb(-t);
            p.push(f); p.push(s);
        }else{
            ans.pb(f);
            ans.pb(s);
            q.push(r); q.push(t);
        }
    }
    if(ans.size()!=k+ok){ //even
        if(p.size()<=1){
            while(ans.size()!=k+ok){
                ans.pb(-q.top()); q.pop();
            }
        }else{
            while(ans.size()!=k+ok){
                ans.pb(p.top()); p.pop();
            }
        }
    }
    ll ret=1;
    rep(i,k+ok){
        ret*=ans[i];
        ret%=MOD;
    }
    cout << (ret+MOD)%MOD << endl;
}



Measured memory_bytes: 9332
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	cout<<fixed<<setprecision(6)<<w*h/2;
	if(x*2.000000==w&&y*2.000000==h)  cout<<' '<<1;
	else                cout<<' '<<0;
	return 0;
}

Measured memory_bytes: 256