akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = reader.nextInt();
		}
		Arrays.sort(A);
		int base = A[N-1];
		int mid = getCloser(base, A);
		System.out.println(base + " " + mid);
		reader.close();
	}
	public static int getCloser(int base, int[] A) {
		int N = A.length;
		double mid = base / 2.0;
		double minGap = A[N-1];
		int ans = 0;
		for (int i = 0; i < N - 1; i++) {
			double gap = Math.abs(mid - A[i]);
			if (gap < minGap) {
				minGap = gap;
				ans = A[i];
			}
		}
		return ans;
	}
}



Measured memory_bytes: 50420
#include<stdio.h>
#include <algorithm>
using namespace std;
int nod(int X){
	int C=0;
	while(X){
		C+=1;
		X/=10;
	}
	return C;

}
int main()
{
	//freopen("in","r",stdin);
	int t=1;
	while(t--){
		int ans=0;
		int n; scanf("%d",&n);
		for (int i = 1; i <=n; ++i)
		{
			if(nod(i)&1)
				ans++;
		}
		printf("%d\n", ans);

	}
	return 0;
}

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

int main(void){
  int a;
  cin >> a;
  if (a == 2){
    cout << 2;
    return 0;
  }
  
  if (a % 2 == 0){
    a += 1;
  }
  int i = a;
  while(true){
    bool sosu = true;
    for(int j = 3; j <= sqrt(i); j += 2){
      if(i % j == 0){
        sosu = false;
        break;
      }
    }
    if (sosu){
      cout << i;
      return 0;
    }
    i += 2;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int c[6];
int main()
{
	for(int i = 0; i < 6; i++)
		cin >> c[i];
	bool ans = c[0] + c[1] * 5 + c[2] * 10 + c[3] * 50 + c[4] * 100 + c[5] * 500 >= 1000;
	cout << ans << endl;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
int check(int *ban,int m)
{
	for(int i=1;i<=m;i++)
	{
		if(ban[i]==0)
			return 1;
	}
	return 0;
}
int main(void)
{
	int n,m;
	scanf("%d %d",&n,&m);
	int arr[n+1][m+1];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			scanf("%d",&arr[i][j]);
		}
	}
	int count[m+1];
	fill(count+1,count+m+1,0);
	int mark[n+1];
	fill(mark+1,mark+n+1,1);
	int ban[m+1];
	fill(ban+1,ban+m+1,0);
	int ans=1e9;
	while(check(ban,m)==1)
	{
		for(int i=1;i<=n;i++)
		{
			count[arr[i][mark[i]]]++;
		}
		int temp=0;int temp2;
		for(int i=1;i<=m;i++)
		{
			if(count[i]>temp)
			{
				temp=count[i];
				temp2=i;
			}
		}
		ans=min(ans,temp);
		ban[temp2]=1;
		fill(count,count+m+1,0);
		for(int i=1;i<=n;i++)
		{
			while(mark[i]<=m&&ban[arr[i][mark[i]]]==1)
				mark[i]++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+1;
 
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
 
int D, G;
 
 
//核問題についてコンプするか全く手を出さないかの二択
//ただし中途半端に解くのが1種だけある場合あり
//その場合コンプしない問題の中から最も単価が高いもの
int main() {
    cin >> D >> G;
    vector<int> p(D),c(D),comp(D);
    int maxc = -1;
    for (int i = 0; i < D; i++) {
        cin >> p[i] >> c[i];
    }
    for (int i = 0; i < D; i++) {
        comp[i] = 100 * (i+1) * p[i] + c[i];
    }
    int res = INF;
    for (int s = 0; s < 1 << D; s++) {
        int point = 0;
        int count = 0;
        int k = 0;
        for (int i = 0; i < D; i++) {
            if (s & 1 << i) {
                point += comp[i];
                count += p[i];
            } else {
                k = i;
            }
        }   
        if (point < G) {
            int j = 0;
            while (point < G) {
                if (j == p[k]-1) {        
                    break;
                }
                point += 100 * (k+1);
                count++;
                j++;
            }
        }
        if (point >= G) {
            chmin(res,count);
        }
    }
    cout << res << endl;
 
}

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

int main(void)
{
    int a, b;
    int d, r;
    double f;

    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / b;

    cout << d << " " << r << " ";
    cout << fixed << setprecision(5) << f << endl;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 1000010
 

int main(){
	IOS;
	tihs;
	
	ll n,d,a;cin>>n>>d>>a;
	vector<pii>v;
	rep(i,0,n){
		ll x,h;cin>>x>>h;
		v.pb({x,h});
	}
	sort(all(v));
	vll x,h;
	rep(i,0,n)x.pb(v[i].fi),h.pb(v[i].se);//,s.insert(x[i]);
	ll bomb[n+1];
	rep(i,0,n)bomb[i]=0;
	ll tot=0, ans=0;
	rep(i,0,n){
		if(bomb[i]<0)tot+=bomb[i];
		ll now = h[i] - tot*a, pos = x[i];
		if(now<=0)now=0;
		ll val = now/a + bool((now%a));
		tot += val, ans += val;
		auto it = upper_bound(x.begin(),x.end(),pos+2*d);
		if(it == x.end())bomb[n]-=val;	
		ll idx = it - x.begin();
		bomb[idx] -= val;
	}
	cout<<ans;
	return 0;
}

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

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

  int b_ = 100 * (b[0] - 48) + 10 * (b[2] - 48) + (b[3] - 48);
  ll ans = a * b_;
  ans /= 100;

  cout << ans << endl;

  return 0;
}


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

void solve(long long a, long long b)
{
    cout << (a % 2 == 0 || b % 2 == 0 ? "Even" : "Odd") << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    auto b = a;
    vector<int> sum(1000,0);
    rep(i,n){
        int j = 0;
        while(a[i] > 0){
            sum[j] += a[i]&1;
            a[i] = a[i] >> 1;
            j++;
        }
    }
    vector<ll> ans(n);
    ll t = 1;
    rep(i,300){
        rep(j,n){
            if(sum[i] % 2 == 0){
                ans[j] += (b[j]&1)*t;
            }else{
                int tmp = b[j]&1;
                ans[j] += (tmp^1)*t;
            }
            b[j] = b[j]>>1;
        }
        t *= 2;
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 7932
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;


int main(void){

    ll X,Y,A,B,C; cin>>X>>Y>>A>>B>>C;
    priority_queue<pair<ll, string>> pq;

    for (int i = 0; i < A; ++i) {
        ll tmp; cin>>tmp;
        pq.push({tmp,"red"});
    }
    for (int i = 0; i < B; ++i) {
        ll tmp; cin>>tmp;
        pq.push({tmp,"green"});
    }
    for (int i = 0; i < C; ++i) {
        ll tmp; cin>>tmp;
        pq.push({tmp,"nothing"});
    }

    ll ans=0;
    ll red = 0, green=0, nothing=0, sum=0;

    while(sum < X+Y && !pq.empty()){
        pair<ll, string> tmp = pq.top(); pq.pop();

        if(tmp.second=="red"){
            red++;
            if(red > X) continue;
        }else if(tmp.second=="green"){
            green++;
            if(green > Y) continue;
        }


        ans += tmp.first;
        sum++;
    }

    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 22764
import java.util.Scanner;

public class Main 
{
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) 
	{
		while(true)
		{
			int input = scan.nextInt();
			
			if(input == 0)
			{
				break;
			}
			else
			{
				new DataSet(input);
			}
		}
	}

	static class DataSet
	{
		int[][] tile;
		int col;
		int score = 0;
		
		public DataSet(int arg)
		{
			col = arg;
			tile = new int[5][col];
			
			for(int y = 0; y < col; y++)
			{
				for(int x = 0; x < 5; x++)
				{
					tile[x][y] = scan.nextInt();
				}
			}
			
			while(true)
			{
//				System.out.println("PHASE");
				if(checkMatches() == 0)
				{
					break;
				}
				
				boolean fell = true;
				
				while(fell == true)
				{
//					System.out.println("fall");
					fell = fall();
				}
			}
			
			System.out.println(score);
		}

		boolean fall()
		{
//			System.out.println("FALL");
			boolean fell = false;
			for(int y = col-1; y >= 0; y--)
			{
				for(int x = 0; x < 5; x++)
				{
					if(tile[x][y] == 0)
					{
						if(y > 0)
						{
							if(tile[x][y-1] > 0) {fell = true;}

							tile[x][y] = tile[x][y-1];
							tile[x][y-1] = 0;
						}
					}
				}
			}
			
			return fell;
		}
		
		int checkMatches()
		{
			int scoreGot = 0;
			
			for(int y = 0; y < col; y++)
			{
				int curNum = -1;
				int occurences = 0;
				
				for(int x = 0; x < 5; x++)
				{
					int sel = tile[x][y];
					
					if(sel > 0)
					{
						if(sel == curNum)
						{
							occurences += 1;
						}
						else
						{
							if(occurences >= 3)
							{
								//left to this disappears
//								System.out.println("Score " + tile[x-1][y] + " x " + occurences + " at " + y);
								
								for(int xDis = x - occurences; xDis <= x-1; xDis++)
								{
									scoreGot += tile[xDis][y];
									tile[xDis][y] = 0;
								}
							}
							
							curNum = sel;
							occurences = 1;
						}
					}
					else
					{
						occurences = 0;
					}
				}
				
				//
				if(occurences >= 3)
				{
					//left to this disappears
//					System.out.println("Score " + tile[4][y] + " x " + occurences + " at " + y);
					
					for(int xDis = 5 - occurences; xDis <= 4; xDis++)
					{
						scoreGot += tile[xDis][y];
						tile[xDis][y] = 0;
					}
				}
				
				//
			}
			
			score += scoreGot;
			return scoreGot;
		}
	}
}



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

int main()
{

    long long  i,j,s,k,r=0;
    cin>>k>>s;
    for(i=0;i<=k;i++)
    {
      for(j=0;j<=k;j++)
      {
        if(s-i-j<=k && s-i-j>=0) r++;
      }
    }
    cout<<r;
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    for (int i=0; i<n; i++) {
        cin>>d[i];
    }
    int ans=0;
     for(int i=0;i<n;i++){
     for(int j = i + 1; j < n; j++) {
     ans += d[i] * d[j];
     }
    }
    cout<<ans<<endl;
    return 0;
}

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

const ll MOD=1e9+7;
ll powm(ll a,ll n){
    if(n==0)    return 1;
    if(n==1)    return a%MOD;
    ll temp=powm(a,n/2);
    temp*=temp;temp%=MOD;
    if(n&1) temp*=a;
    return temp%MOD;
}
main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n;cin>>n;
    ll ans=powm(10,n);
    ans+=powm(8,n);
    ans+=MOD;ans%=MOD;
    ans-=powm(9,n);
    ans+=MOD;ans%=MOD;
    ans-=powm(9,n);
    ans+=MOD;ans%=MOD;
    ans%=MOD;
    cout<<ans<<"\n";    
}

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

int main(){
    string s;
    int count=0;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='p'){
            count++;
        }
    }
    cout<<s.length()/2-count<<endl;
    return 0;
}



Measured memory_bytes: 512
import math
while True:
	n = input()
	if n == 0:
		break
	s = map(int, raw_input().split())
	sumS = 0.0
	sum = 0.0
	for i in s:
		sumS += i**2
		sum += i
	v = sumS / n - (sum / n)**2
	print math.sqrt(v)

Measured memory_bytes: 4436
#include <stdio.h>
#include <stdlib.h>

#define N 50

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

int main() {
	static int vv[N];
	int n, i;
	double x;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &vv[i]);
	qsort(vv, n, sizeof *vv, compare);
	x = vv[0];
	for (i = 1; i < n; i++)
		x = (x + vv[i]) / 2;
	printf("%f\n", x);
	return 0;
}


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

const string YES = "Yes";
const string NO = "No";

int solve(std::vector<std::vector<long long>> A, long long N, std::vector<long long> b)
{
    std::vector<std::vector<long long>> match(3, std::vector<long long>(3));

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < N; k++)
            {
                if (A[i][j] == b[k])
                {
                    match[i][j] = 1;
                }
            }
        }
    }

    for (int i = 0; i < 3; i++)
    {
        if ((match[0][i] == 1 && match[1][i] == 1 && match[2][i] == 1) || (match[i][0] == 1 && match[i][1] == 1 && match[i][2] == 1) || (match[1][1] == 1 && match[2][2] == 1 && match[0][0] == 1) || (match[0][2] == 1 && match[1][1] == 1 && match[2][0] == 1))
        {
            cout << YES << endl;
            return 0;
        }
    }

    cout << NO << endl;
    return 0;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            scanf("%lld", &A[i][j]);
        }
    }
    long long N;
    scanf("%lld", &N);
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &b[i]);
    }
    solve(std::move(A), N, std::move(b));
    return 0;
}


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

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    int dif = abs(b - a);
    bool f = 0;
    for (int i = a; i <= b; ++i)
        if (i % k == 0)
        {
            f = 1;
            break;
        }
    if (f)
        cout << "OK"
             << "\n";
    else
        cout << "NG"
             << "\n";
}

Measured memory_bytes: 3632
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b = i2()
s = s()
if "-" in s[0:a] or "-" in s[a+1:] or s[a] != "-":
	print("No")
else:
	print("Yes")

Measured memory_bytes: 3064
let rec ext_euclid a b =
  if b = 0 then (1, 0)
  else
    let (x, y) = ext_euclid b (a mod b) in
    (y, x - (a / b) * y)

let () =
  let (a, b) = Scanf.scanf "%d %d\n" (fun a b -> (a, b)) in
  let (x, y) = ext_euclid a b in
  Printf.printf "%d %d\n" x y

Measured memory_bytes: 2420
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M,X,Y;
    cin>>N>>M>>X>>Y;
    vi x(N);
    vi y(M);
    rep(i,N) cin>>x.at(i);
    rep(i,M) cin>>y.at(i);
    sort(all(x));
    sort(all(y));
    bool ok=false;
    for(int Z=-100; Z<=100; Z++) {
        if(X<Z&&Z<=Y&&x.at(N-1)<Z&&y.at(0)>=Z) {
            ok=true;
        }
    }
    if(ok) cout<<"No War"<<endl;
    else cout<<"War"<<endl;
}

Measured memory_bytes: 256
//Code By: pratibha_899 (Pratibha Shrivastav)

/********   All Required Header Files ********/
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

//All the Loops and defines required
typedef long long int ll;
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

//All the declarations using typedef

typedef pair<ll, ll> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll, ll> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;
typedef unsigned long int ul;
typedef unsigned long long int  ull;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	int cost[n][3];
	ll x,y,z;
	for(ll i=0;i<n;i++){
		cin>>x>>y>>z;
		if(i==0){
			cost[i][0]=x;
			cost[i][1]=y;
			cost[i][2]=z;
		}
		else{
			cost[i][0]= x + max(cost[i-1][1],cost[i-1][2]);
			cost[i][1]= y + max(cost[i-1][0],cost[i-1][2]);
			cost[i][2]= z + max(cost[i-1][0],cost[i-1][1]);
		}
	}
	ll res=cost[n-1][0];
	for(int i=1;i<3;i++){
		if(cost[n-1][i]>res)
			res=cost[n-1][i];
	}
	// cout<<cost[n-1][0]<<" "<<cost[n-1][1]<<" "<<cost[n-1][2]<<endl;
	cout<<res;
	return 0;
}

Measured memory_bytes: 1408
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var r=n(1);n(2)(r.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";var r=n(3),i=n(5);t.exports=function(t){var e=new r(t);i(e)}},function(t,e,n){"use strict";var r=n(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new r(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,n){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,n){"use strict";t.exports=function(t){for(var e=t.inr(),n=t.inr(),r=e.length,i=new Map,o=new Map,s=0;s<r;s++)if(i[e[s]]){if(i[e[s]]!=n[s])return void console.log("No")}else{if(i[e[s]]=n[s],o[n[s]]&&o[n[s]]!=e[s])return void console.log("No");o[n[s]]=e[s]}console.log("Yes")}}]);

Measured memory_bytes: 9420
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

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

#define MAX_N 1000
#define MAX_M 100

const long long INF = 1LL << 60;

//境界値に注意！！！

// DP テーブル
ll dp[100010][3];
ll a[100010][3];

int main (){
    ll n;
    cin >> n;
    for (ll i=0;i<n;i++)for(ll j=0;j<3;++j)cin >>a[i][j];
    
    for (ll i=0;i<n;++i){
        for (ll j=0;j<3;++j){
            for (ll k=0;k<3;++k){
                if (k==j){
                    continue;
                }
                chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    ll ans=max(dp[n][0],dp[n][1]);
    ans=max(ans,dp[n][2]);
    cout << ans << endl;
}


Measured memory_bytes: 4992
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

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

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        k: usize,
        s: usize,
    }

    let dummy = if s > 100000 { 1 } else { 1000000000 };

    let mut a = vec![];

    for i in 0..k {
        a.push(s);
    }
    for i in k..n {
        a.push(dummy);
    }

    for i in 0..n {
        print!("{} ", a[i]);
    }
}


Measured memory_bytes: 5372
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    char c;
    cin >> c;
    cout << char(c + 1) << endl;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	while(1)
	{
		vector<string> menu[105];
		vector<string> vec;
		int n,m;
		cin >> n;
		if(n==0)break;
		map<string,int> ma;
		for(int i=0;i<n;i++)
		{
			string name;
			int cost;
			cin >> name >> cost;
			ma[name]=cost;
		}
		cin >> m;
		for(int i=0;i<m;i++)
		{
			string s;int k;
			cin >> s;
			vec.pb(s);
			cin >> k;
			for(int j=0;j<k;j++)
			{
				string ss;
				cin >> ss;
				menu[i].pb(ss);
			}
		}
		bool update=true;
		while(update)
		{
			update=false;
			for(int i=0;i<m;i++)
			{
				int sum=0;
				for(int j=0;j<menu[i].size();j++)
				{
					sum+=ma[menu[i][j]];
				}
				if(ma[vec[i]]>sum)
				{
					ma[vec[i]]=sum;
					update=true;
				}
			}
		}
		string out;
		cin >> out;
		cout << ma[out] << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>
int main(void){
 int a,b,c,x,i,j,k,d=0;
 scanf("%d%d%d%d",&a,&b,&c,&x);
 for(i=0;i<=a;i++){
  for(j=0;j<=b;j++){
   for(k=0;k<=c;k++){
    if(500*i+100*j+50*k==x){
     d++;
     break;
    }
   }
  }
 }
 printf("%d",d);
 return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		while(a > 0 || c > 0) {
			c -= b;
			if(c <= 0)
				break;
			a -= d;
		}
		if(a > 0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 35632
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

int main(void){
    int n, y;
    cin >> n >> y;
    int k;
    int count = 0;
    for(int i = 0; i <= y/10000; i++){
        for(int j = 0; j <= (y-10000*i)/5000; j++){
            k = (y-10000*i-5000*j)/1000;
            if(i+j+k==n && count == 0){
                cout << i << ' ' << j << ' ' << k << endl;
                count++;
                break;
            }
        }
        if(count!=0) break;
    }
    if(count==0)
        cout << "-1 -1 -1" << endl;

    return 0;
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(unused_imports)]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::max($x, max!($($y),+))
    };
}

macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::min($x, max!($($y),+))
    };
}

use std::cmp;
use std::collections::{HashSet, BinaryHeap, VecDeque};
use std::iter::FromIterator;
fn main() {
    input! {
        N: usize,
        K: usize,
    }
    println!("{}", N-K+1);
}

Measured memory_bytes: 4352
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
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; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
ll n, k;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s>>k;
    n=s.size();
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        a[i]=s[i]-'a';
    }
    string ans="";
    for(int i=0;i<n;i++){
        if(a[i]==0){
            ans+='a';
        }
        else if(k>=26-a[i]){
            k-=26-a[i];
            ans+='a';
        }
        else{
            ans+=s[i];
        }
    }
    int temp=ans[n-1]-'a';
    temp+=k;
    temp%=26;
    ans[n-1]='a'+temp;
    cout << ans << "\n";
}



Measured memory_bytes: 1488
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  K = readint()[1]
  S = readline()
  
  if length(S) > K
    println(S[1:K]*"...")
  else
    println(S)
  end
end

main()

Measured memory_bytes: 162428
#include<stdio.h>
 
#define max 10000
main(){
  int i,j,n,q,f[max],s[max],count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&f[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&s[i]);
  for(i=0;i<q;i++)
    for(j=0;j<n;j++)
      if(f[j]==s[i]){
    count++;
    break;
      }
  printf("%d\n",count);
   
  return 0;
}

Measured memory_bytes: 648
#include <stdio.h>
#include <utility>
using namespace std;

int Bubblesort(int* temp, int size){

    int swaps = 0;

    for(int i = 0; i < size; i++){
        for(int j = size-1; j > i; j--){
            if(temp[j] < temp[j-1]){
                swap(temp[j], temp[j-1]);
                swaps++;
            }
       }

    }
    return swaps;
}

int main(){
    int n;
    int *temp;
    int ans;
    
    scanf("%d",&n);
    
    temp = new int[n];
    
    for(int i = 0; i < n; i++){
        scanf("%d",temp + i);
    }
    
    ans = Bubblesort(temp, n);

    for(int i = 0; i < n; i++){
        printf("%d",temp[i]);
        if(i < n -1){
            printf(" ");
            
        }if(i == n - 1){
            printf("\n");
        }
    }
    printf("%d\n", ans);

    return 0;
}



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

int main(){
    int N;cin>>N;
    if(N%111==0) cout<<N<<endl;
    else{
        cout<<((N/111)+1)*111<<endl;
    }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

signed main(){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;

  map<char,int>mp;
  mp[X]=A;
  mp[Y]=B;

  int ans=0;
  if(C*2<A+B){
    ans+=C*2*min(X,Y);
  }else{
    ans+=A*X+B*Y;
    cout<<ans<<"\n";
    return 0;
  }

  int l=X+Y-min(X,Y)*2;

  if(2*C<mp[max(X,Y)]){
    ans+=2*C*l;
    cout<<ans<<"\n";
  }else{
    ans+=l*mp[max(X,Y)];
    cout<<ans<<"\n";
  }

  return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll a, b;

	cin >> a >> b;

	if (a < 6) {
		cout << 0 << endl;
	}
	else if (a < 13) {
		cout << b / 2 << endl;
	}
	else {
		cout << b << endl;
	}
}

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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void){
    int N,ans=0;;

    cin>>N;

    vector<int> vec(N+5,0);

    for(int i=1;i<=N;i++){
        cin>>vec[i];
    }

    for(int i=1;i<=N;i++){
        if(i %2 ==1){
            if(vec[i] % 2 ==1){
                ans++;
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}



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

#define fo(i,s,t) for(int i = s; i <= t;  ++ i)

int a[200050], n;
long long s[200050], ss[200050], ans=1ll<<60;

int main()
{
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&a[i]);
	fo(i,1,n) ss[i] = ss[i-1]+a[i];
	for(int i = n; i >= 1; -- i) s[i] = s[i+1] + a[i];
	fo(i,1,n-1) ans = min(ans,abs(ss[i]-s[i+1]));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int main() {
	int k, t; cin >> k >> t;
	int a[110];
	int key = 0;
	int sum = 0;
	REP(i, t) {
		cin >> a[i];
		key = max(key, a[i]);
		sum += a[i];
	}
	sum -= key;
	if (sum + 1 >= key) {
		cout << 0 << endl;
	}
	else {
		cout << key - sum - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long
lli a[101];
lli dp[101][100001];
lli sum[101][100001];
const lli mod = (lli)(1e9+7);

int main() 
{
    int n,k;
    cin >> n >> k;
    
    for(int i=1;i<=n;i++) cin >> a[i];
    sum[0][0]=dp[0][0]=1;
    
    for(int i=1;i<101;i++) {
        dp[i][0]=1;
        sum[i][0]=dp[i][0];
    }
    
    for(int i=1;i<100001;i++) {
      sum[0][i] = sum[0][i-1] + dp[0][i];
      sum[0][i] %= mod;
    }
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            lli x = min(1LL*a[i],1LL*j);
            
            if(x==j) dp[i][j] = sum[i-1][j];
            else dp[i][j] = sum[i-1][j] - sum[i-1][j-x-1];
            dp[i][j]+=mod;
            dp[i][j]%=mod;
            sum[i][j] = sum[i][j-1] + dp[i][j];
            sum[i][j] %= mod;
            //cout<<i<<" "<<j<<" "<<dp[i][j]<<" "<<sum[i][j]<<endl;
        }
    }
    
    cout<<dp[n][k]<<endl;
	return 0;
}

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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

string S;

int main()
{
	cin >> S;

	if(S [0] == S [1] && S [1] == S [2]){
		puts("Yes");
	}
	else if(S [1] == S [2] && S [2] == S [3]){
		puts("Yes");
	}
	else{
		puts("No");
	}

	return 0;
}


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


def main():
    b = input()

    if b == 'A':
        print('T')
    elif b == 'T':
        print('A')
    elif b == 'C':
        print('G')
    elif b == 'G':
        print('C')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n,m = map(int,input().split())
def Fib(n):
  seq = []
  a,b = 0,1
  for i in range(1,n+10):
    if i == 1:
      seq.append(0)
    elif i == 2:
      seq.append(1)
    else:
      a, b = b, a + b
      seq.append(b)
  return seq
table = Fib(n)
temp = -1
route = 1
mod = 10**9+7
for _ in range(m):
  a = int(input())
  dif = a-temp-1
  temp = a
  route = route*table[dif]%mod
print(route*table[n-temp]%mod)  

Measured memory_bytes: 466088
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int a = tmp[0], b = tmp[1];
	WriteLine((a < 10 && b < 10) ? a * b : -1);
    }
}


Measured memory_bytes: 13396
import java.util.*;

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

    String s = sc.next();
    int countZero = 0, countOne = 0;

    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == '0')
        countZero++;
      else
        countOne++;
    }
    System.out.println(countZero > countOne ? countOne*2 : countZero*2);
  }
}


Measured memory_bytes: 23636
#include<stdio.h>
#define N 10000
#define Q 500
int main(){
  int n,q,S[N],T[Q],i,j,cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&T[i]);
  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(S[j]==T[i]){
	cnt++;
	break;
      }
    }
  }
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2104
n = int(input())
a = [int(input()) - 1 for _ in range(n)]

i = 0
ans = 1
while a[i] != -1:
    if a[i] == 1:
        print(ans)
        exit()
    _i = a[i]
    a[i] = -1
    i = _i
    ans += 1
print(-1)

Measured memory_bytes: 7084
(N,M),*AB = $<.map{|ln| ln.split.map(&:to_i) }

g, *W = 0, *0...M,*[-1]*(100001-M)
D = lambda{|d|
	return W[d] == d ? d : W[d] = D[W[d]]
}
AB.sort_by{|*,b|-b}.each{|a,b|
	d = D[M-a]
	g, W[d] = g+b, d-1 if d != -1
}
p g


Measured memory_bytes: 16024
from heapq import heapify, heappop, heappush
from operator import add

SENTINEL = 100000
while True:
    n, m, s, g1, g2 = map(int, input().split())
    s -= 1
    g1 -= 1
    g2 -= 1
    if not n:
        break
    pipes = [set() for _ in range(n)]
    rpipes = [set() for _ in range(n)]
    for _ in range(m):
        b1, b2, c = map(int, input().split())
        b1 -= 1
        b2 -= 1
        pipes[b1].add((c, b2))
        rpipes[b2].add((c, b1))

    dists = [[SENTINEL] * n for _ in range(2)]

    for i in (0, 1):
        g = (g1, g2)[i]
        dist = dists[i]
        dist[g] = 0
        queue = list(rpipes[g])
        heapify(queue)
        while queue:
            total_cost, base = heappop(queue)
            if dist[base] < SENTINEL:
                continue
            dist[base] = total_cost
            for next_cost, next_base in rpipes[base]:
                if dist[next_base] == SENTINEL:
                    heappush(queue, (total_cost + next_cost, next_base))

    dists = list(map(add, *dists))

    current_best = dists[s]
    queue = list(pipes[s])
    heapify(queue)
    visited = {s}
    while queue:
        total_cost, base = heappop(queue)
        if base in visited:
            continue
        visited.add(base)
        current_best = min(current_best, total_cost + dists[base])
        for next_cost, next_base in pipes[base]:
            if next_base not in visited:
                heappush(queue, (total_cost + next_cost, next_base))

    print(current_best)

Measured memory_bytes: 8268
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iomanip>
#include<map>
#include<cstring>

using namespace std;

typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
int arrayMax(int a[], const int N){
    int maxv = 0;
    rep(i, N)maxv = max(a[i], maxv);
    return maxv;
}
/* -- template -- */

int main(){
    int K;cin >> K;
    vector<vector<ll>> A(50);
    int count = 0;
    rep(i, 9){A[0].push_back(i + 1);++count;if(count == K){cout << A[0][A[0].size() - 1] << endl;return 0;}}
    int keta = 2;
    int j = 0;
    while(count < K){
        if(j >= A[keta - 2].size()){j = 0;++keta;}
        ll x = A[keta - 2][j] % 10;
        if(x != 0){A[keta - 1].push_back(A[keta - 2][j] * 10 + (x - 1));++count;}
        if(count == K){cout << A[keta - 1][A[keta-1].size() - 1] << endl;return 0;}
        A[keta - 1].push_back(A[keta - 2][j] * 10 + x);++count;
        if(count == K){cout << A[keta - 1][A[keta-1].size() - 1] << endl;return 0;}
        if(x != 9){A[keta - 1].push_back(A[keta - 2][j] * 10 + (x + 1));++count;}
        if(count == K){cout << A[keta - 1][A[keta-1].size() - 1] << endl;return 0;}
        ++j;
    }


}


Measured memory_bytes: 1272
#include<cstdio> 
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 1e5+100;
int cnt[maxn],Ans;
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		cnt[x]++;
	}
	for (int x=1;x<=1e5;x++){
		Ans = max(Ans,cnt[x-1]+cnt[x]+cnt[x+1]);
	}
	printf("%d\n",Ans);
}

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

string v[16];
bool usedc[16];
int H,W;
bool checkcols(int x,int y){
	for(int i=1;i<H;i+=2) if(v[i][x] != v[i-1][y] || v[i][y] != v[i-1][x]) return false;
	return true;
}

bool itcols(){
	int st = 0;
	while(usedc[st]) st += 1;
	usedc[st] = true;
	int left = 0;
	for(int i=st+1;i<W;i++) if(usedc[i] == false){
		left += 1;
		if(checkcols(st,i) == false) continue;
//		cout<<st+1<<" "<<i+1<<endl;
		usedc[i] = true;
		if(itcols()) return true;
		usedc[i] = false;
	}
	if(left == 0) return true;
	usedc[st] = false;
	return false;
}

bool itrows(int st){
	if(st == H-1 || st == H){
		if(itcols()) return true;
		if(W%2 == 0) return false;
		for(int i=0;i<W;i++){
			usedc[i] = true;
			if(itcols()) return true;
			usedc[i] = false;
		}
		return false;
	}
	if(itrows(st+2)) return true;
	for(int i=st+2;i<H;i++){
		swap(v[st+1],v[i]);
		if(itrows(st+2)) return true;
		swap(v[st+1],v[i]);
	}
	return false;
}


int main(){
	cin>>H>>W;
	for(int i=0;i<H;i++) cin>>v[i];
	for(int i=0;i<H;i++){
		swap(v[i],v[H-1]);
		if(itrows(0)){
			cout<<"YES"<<endl;
			return 0;
		}
		swap(v[i],v[H-1]);
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[5][5];
int dp[6][1<<8];
int sc[]={0,60,70,80};
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		for(int i=0;i<5;i++)
			for(int j=0;j<5;j++){
				scanf("%d",&b[i][j]);
				b[i][j]--;
			}
		for(int i=0;i<6;i++){
			//for(int j=0;j<6;j++)
				for(int k=0;k<(1<<8);k++)
					dp[i][k]=-999999999;
		}
		dp[0][0]=0;
		for(int i=0;i<5;i++){
			for(int j=0;j<(1<<8);j++){
				if(dp[i][j]<0)continue;
				for(int k=0;k<(1<<8);k++){
					if(i==4&&k)break;
					int gs=0;
					if(~b[i][0])gs+=sc[(b[i][0]+(j%4)+(k%4))%4];
					if(~b[i][1])gs+=sc[(b[i][1]+(j%4)+(j%16/4)+(k%4)+(k%16/4))%4];
					if(~b[i][2])gs+=sc[(b[i][2]+(j%16/4)+(j%64/16)+(k%16/4)+(k%64/16))%4];
					if(~b[i][3])gs+=sc[(b[i][3]+(j%64/16)+(j%256/64)+(k%64/16)+(k%256/64))%4];
					if(~b[i][4])gs+=sc[(b[i][4]+(j%256/64)+(k%256/64))%4];
					
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+gs);
				}
			}
		}
		printf("%d\n",dp[5][0]);
	}
}

Measured memory_bytes: 1032
import sys

l = [int(i) for i in sys.stdin]

N = l[0]

a = [int(i) - 1 for i in l[1:]]

done = [False] * N

i = 0

ans = 0

while True:
    if done[i] == False:
        done[i] = True
        ans += 1
        if a[i] == 1:
            break
        i = a[i]
    else:
        ans = -1
        break

print(ans)


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

int main() {
  vector<int> a(3);
  rep(i,0,3) cin >>a[i];
  sort(a.begin(),a.end());
  int K; cin >>K;
  a[2]*=pow(2,K);
  cout <<accumulate(a.begin(),a.end(),0) <<endl;
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

int main()
{
  //  freopen("in", "r", stdin);
    ll n, m;;
    cin >> n >> m;
    ll ans;
    if (m < n) swap(n, m);
    if (n == 1) 
    {
        if (m == 1) ans = 1;
        else if (m == 2) ans = 0;
        else ans = m - 2;
    }
    else ans = (n-2)*(m-2);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

int n, a[10009], cnt;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i]; cnt += (a[i] - 1);
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256