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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// get a integer
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(Main.countCans(a, b, c));
		sc.close();
	}
	
	static int countCans(int a, int b, int c) {
		Set<Integer> set = new HashSet<Integer>();
		set.add(a);
		set.add(b);
		set.add(c);
		return set.size();
	}

}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;
vector<ll> v[11];
ll a[11];
ll n,m;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        ll k;
        cin>>k;
        while(k--)
        {
            ll x;
            cin>>x;
            v[x-1].pb(i-1);
        }
    }
    for(i=0;i<m;i++)
    cin>>a[i];
    ll cnt=0;
    ll temp[15]={0};
    for(i=0;i<(1<<n);i++)
    {
        memset(temp,0,sizeof(temp));
        for(j=0;j<n;j++)
        {
            if((i&((1<<j)))!=0)
            {
                for(auto x : v[j])
                {
                    temp[x]++;
                }
            }
        }
        ll pos=1;
        for(j=0;j<m;j++)
        {
            if(temp[j]%2!=a[j])
            pos=0;
        }
        if(pos==1)
        cnt++;
    }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    cin>>a;
    int b=a/1000;
    int c=(a%1000)/100;
    int d=(a%100)/10;
    int e=a%10;
  	if((b==c&&c==d)||(c==d&&d==e)||(b==c&&c==d&&d==e)){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  
}


Measured memory_bytes: 3380
N,M = list(map(int,input().split()))
X = list(map(int,input().split()))

distX = sorted(X)
# print(distX)
distX = [abs(x-y) for x,y in zip(distX[:-1],distX[1:])]
# print(distX)

a = N-1
if a == 0:
    print(sum(distX))
else:
    sorDX = sorted(distX)
    print(sum(sorDX[:-a]))

Measured memory_bytes: 13968
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
void init();
#define REP(var, num) for(sll var = 0; var < num; var++)
typedef signed long long sll;
typedef unsigned long long ull;
/*
numeric_limits<sll>::max()
*/

int main() {
    init();
    sll H, W, h, w;
    cin >> H >> W;
    cin >> h >> w;

    cout << H * W - (w*H + h*W - w*h) << endl;
    return 0;
}

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

Measured memory_bytes: 256
m, d = map(int, input().split())

ans = 0
for i in range(1, m+1):
    for j in range(1, d+1):
        d1 = j % 10
        d2 = (j - d1) // 10
        if (d1 > 1) and (d2 > 1):
            if d1 * d2 == i:
                ans += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> p;
typedef vector<int> vi;
typedef vector<ll> vll;
vll a(100005);
int n,t;
ll profit=0;
ll minval=INF+1;
int same=1;
string s;
int main(int argc,char const* argv[])
{
  cin >> n >> t;
  for(int i=0;i<n;i++)
    {
      cin >> a[i];
    }
  for(int i=0;i<n-1;i++)
    {
      if(a[i]<minval)
	{
	  minval=a[i];
	}
      if(a[i+1]-minval>profit) profit=a[i+1]-minval;
      else if(a[i+1]-minval==profit) same++;
    }
  cout << same << endl;
  return 0;
}


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

using namespace std;

typedef long long/*--------------------*/ll;
typedef long double/*------------------*/ld;
typedef unsigned long long/*-----------*/ull;
typedef pair<ll, ll >/*----------------*/pll;
typedef std::vector<pll >/*------------*/vpll;

#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)

#define YES/*--------------------------*/cout << "YES" << endl
#define NO/*---------------------------*/cout << "NO" << endl

#define lb/*---------------------------*/lower_bound
#define ub/*---------------------------*/upper_bound
#define pb/*---------------------------*/push_back
#define popb/*-------------------------*/pop_back
#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define sz/*---------------------------*/size()
#define mpp/*--------------------------*/make_pair
#define bs/*---------------------------*/binary_search
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()

#define ff/*---------------------------*/first
#define ss/*---------------------------*/second

#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(ll)2e15
#define MOD/*--------------------------*/(ll)1000000007

void solve();
void boost()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	boost();
	ll t,i;
	t = 1;
    //cin >> t;
	REP(i,1,t)
	{
       //cout << "Case "<< i << ": ";
       solve();
	}
	return 0;
}
vector<ll> v;
void recur(ll n,ll ans,ll k)
{
    if(!n)
    {
        v.pb(ans);
        return ;
    }
    recur(n-1,ans+k,k);
    recur(n-1,ans*2LL,k);
}
void solve()
{
    ll n,k;
    cin >> n >> k;
    ll ans = 1LL;
    recur(n,ans,k);
    cout << *min_element(all(v)) << endl;
}


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

signed main(){
  string s;cin>>s;
  int N=s.size()+1;
  vector<int> v(N,-1);
  set<int> se;
  for(int i=0;i<N;i++){
    if(!i){if(s[i]=='<')v[i]=0,se.insert(i);}
    else if(i==N-1){if(s[N-2]=='>')v[i]=0,se.insert(i);}
    else if(s[i-1]=='>'&&s[i]=='<')v[i]=0,se.insert(i);
  }
  //for(int i=0;i<N;i++)cout<<v[i]<<" ";cout<<endl;
  for(int p:se){
    int now=p;now--;
    while(now>=0&&now<N&&!se.count(now)){
      if(s[now]=='<')v[now]=max(0LL,v[now]);
      else v[now]=max(v[now],v[now+1]+1);
      now--;
    }
    now=p+1;
    while(now>=0&&now<N&&!se.count(now)){
      if(s[now-1]=='>')v[now]=max(0LL,v[now]);
      else v[now]=max(v[now],v[now-1]+1);
      now++;
    }
  }
  int ans=0;
  for(int i=0;i<N;i++)ans+=v[i];//,cout<<v[i]<<" ";cout<<endl;
  cout<<ans<<endl;
}


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

int alp[26];

int main() {
    char a;
    while (cin >> a) {
        if (isupper(a)) a = tolower(a);
        alp[a - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
        cout << char(i + 'a') << " : " << alp[i] << endl;
    }
}


Measured memory_bytes: 3068
#include<iostream>
#include<vector>
using namespace std;
typedef long long int ll;
int main(void){
ll n;
cin>>n;
//for(ll n=4;n<=1000;n++){
if(n<=2){
	cout<<n<<endl;
	return 0;
}
if(n==3){
	cout<<1<<endl;
	cout<<2<<endl;
	return 0;
}
ll ans,no,sum=0;
for(ll i=1;i<=n;i++){
	 sum+=i;
	if(sum>=n){
		ans=i;
		no=sum-n;
		break;
	}
}
	//cout<<no<<endl;
int t=0;
for(ll i=1;i<=ans;i++){
	if(i!=no){
	cout<<i<<endl;
//t+=i;
	}
}
//if(t!=n)cout<<n<<endl;
//}
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    char c[n][m];
    for (int i =0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> c[i][j];
//            cout << c[i][j];
        }
//        cout << "\n";
    }
    int dp[n][m];
    memset(dp,0,sizeof(dp));
    for (int i =0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (c[i][j] == '#') {
                if (i-1 >= 0) {
                    if (j-1 >= 0) {
                        dp[i-1][j-1] += 1;
                    }
                    dp[i-1][j] += 1;
                    if (j+1 < m) {
                        dp[i-1][j+1] += 1;
                    }
                }
                if (i+1 < n) {
                    if (j-1 >= 0) {
                        dp[i+1][j-1] += 1;
                    }
                    dp[i+1][j] += 1;
                    if (j+1 < m) {
                        dp[i+1][j+1] += 1;
                    }
                }
                if (j-1 >= 0)
                    dp[i][j-1] += 1;
                if (j+1 < m)
                    dp[i][j+1] += 1;
            }
        }
    }
    for (int i =0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (c[i][j] == '.') {
                cout << dp[i][j];
            }
            else
                cout << "#";
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
        int a,b,c,poor=0;
        cin >> a >> b >> c;
        if (a == b && c != a)
                poor = 1;
        else if (a == c && b != a)
                poor = 1;
        else if (b == c && b != a)
                poor = 1;
        if (poor)
                cout << "Yes" << endl;
        else
                cout << "No" << endl;
        return 0;
}

Measured memory_bytes: 256
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <utility>
#include <set>
#include <unordered_set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>
#include <functional>

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

bool vis[55556];

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    for (int i = 2; i <= 55555; i++)
    {
        if (!vis[i]) for (int j = i+i; j <= 55555; j += i) vis[j] = 1;
    }
    
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 6; cnt < n; i += 5)
    {
        if (!vis[i])
        {
            cout << i << " \n"[cnt+1 == n];
            cnt++;
        }
    }
    
    return 0;
    
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fr first
#define sc second
#define pb push_back
const ll mod = 998244353;
const int N = 1e6+205;
void solve(){
	int n,k; 
	cin>>n>>k;
	int id = -1;
	for(int i=1;i<=n;i++){
		int x; 
		cin>>x; 
		if(x==1)id = i;
	}
	int st = id-1;
	int ans = st/(k-1);
	int en = n-id;
	en+=st%(k-1);
	ans+=(en+k-2)/(k-1);
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
int main(void){
while(1){
    int a,b,c;
    char x;
    scanf("%d%*c%c%d",&a,&x,&b);
    if(x=='?')
    break;
    
    if(x=='+')
    c=a+b;
    else if(x=='-')
    c=a-b;
    else if(x=='*')
    c=a*b;
    else
    c=a/b;
    
    printf("%d\n",c);
    
}
return 0;
}

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


bool sol(vector<int>d1,vector<int>d2){
    for(int i=0;i<4;i++){
        int tmp1=d1[0];
        d1[0]=d1[2], d1[2]=d1[5], d1[5]=d1[3], d1[3]=tmp1;
        for(int j=0;j<4;j++){
            int tmp2=d1[0];
            d1[0]=d1[1], d1[1]=d1[5], d1[5]=d1[4], d1[4]=tmp2;
            for(int k=0;k<4;k++){
                int tmp3=d1[1];
                d1[1]=d1[2], d1[2]=d1[4], d1[4]=d1[3], d1[3]=tmp3;
                if(equal(d1.cbegin(),d1.cend(),d2.cbegin())){
                    printf("No\n");
                    return false;
                }
            }
        }
    }
    return true;
}

int main(){
    int n;
    scanf("%d",&n);
    vector<vector<int>> d(n,vector<int>(6));
    for(int i=0;i<n;i++){
        for(auto&e:d[i]){
            scanf("%d",&e);
        }
    }
    bool flag;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            flag=sol(d[i],d[j]);
            if(flag==false) return 0;;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

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

    int cnt = 0;
    rep(i, s.size()-1){
        if(s[i]!=s[i+1]){
            cnt++;
        }
    }
    cout << n-1-max(cnt - 2*k, 0) << endl;
    // printf("%d\n", N);
    return 0;
}

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

constexpr double EPS = 1e-10;
using point = complex<double>;
using vect = point;
using segment = pair<point, point>;
using polygon = vector<point>;
double dot(vect a, vect b){
	return real(a) * real(b) + imag(a) * imag(b);
}
double cross(vect a, vect b){
	return real(a) * imag(b) - imag(a) * real(b);
}
int ccw(point p0, point p1, point p2){
	vect v = p1 - p0, w = p2 - p0;
	if(cross(v, w) > EPS) return 1; // COUNTER_CLOCKWISE
	if(cross(v, w) < -EPS) return -1; // CLOCKWISE
	if(dot(v, w) < -EPS) return 2; // ONLINE p2 - p0 - p1
	if(norm(v) + EPS < norm(w)) return -2; // ONLINE p0 - p1 - p2
	return 0; // ONLINE p1 - p2 - p0
}
bool intersect(segment s1, segment s2){
	int t = ccw(s1.first, s1.second, s2.first) * ccw(s1.first, s1.second, s2.second);
	int u = ccw(s2.first, s2.second, s1.first) * ccw(s2.first, s2.second, s1.second);
	return (t == 0 || t == -1 || t == -4) && (u == 0 || u == -1 || u == -4);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	polygon p(n);
	for(int i=0; i<n; ++i){
		int x, y; cin >> x >> y;
		p[i] = point(x, y);
	}
	int q; cin >> q;
	while(q--){
		int x, y; cin >> x >> y;
		bool f = false;
		for(int i=0; i<n; ++i){
			if(ccw(p[i], point(x, y), p[(i+1)%n]) == -2){
				cout << 1 << "\n";
				f = true;
			}
		}
		if(f) continue;
		segment t(point(x, y), point(1.4142e5, 1.3141e5));
		int cnt = 0;
		for(int i=0; i<n; ++i)
			if(intersect(t, segment(p[i], p[(i+1)%n])))
				++cnt;
		if(cnt % 2 == 0) cout << 0 << "\n";
		else cout << 2 << "\n";
	}
}


Measured memory_bytes: 3244
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int n;
    cin >> n;
    if(n==0) break;
    vector<char> ops;
    vector<int> vs;
    ops.push_back('+');
    vs.push_back(0);
    for(int i = 0; i < n; i++) {
      string s;
      cin >> s;
      // cout << "read: " << s << endl;
      while(s.size() < ops.size()) {
        int v = vs.back();
        vs.pop_back();
        ops.pop_back();
        switch(ops.back()) {
        case '+': { (vs.back()) += v; break; }
        case '*': { (vs.back()) *= v; break; }
        default : { throw string("Something Wrong in while!"); }
        }
      }
      char c = s[ops.size()-1];
      // cout << "c = " << c << endl;
      switch(c){
      case '.' : { throw string("Something Wrong!"); }
      case '+' : {
        ops.push_back('+');
        vs.push_back(0);
        break;
      }
      case '*' : {
        ops.push_back('*');
        vs.push_back(1);
        break;
      }
      default : { // '0'--'9'
        switch(ops.back()) {
        case '+': { (vs.back()) += c - '0'; break; }
        case '*': { (vs.back()) *= c - '0'; break; }
        default : { throw string("Something Wrong in default!"); }
        }
      }
      }
    }
    while(1 < ops.size()) {
      int v = vs.back();
      vs.pop_back();
      ops.pop_back();
      switch(ops.back()) {
      case '+': { (vs.back()) += v; break; }
      case '*': { (vs.back()) *= v; break; }
      default : { throw string("Something Wrong in while!"); }
      }
    }
    cout << vs[0] << endl;
  }
  return 0;
}



Measured memory_bytes: 3200
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(n: int, a: int, b: int):
    # 1本選ぶ時→nC1、2本選ぶ時→nC2、...、n本選ぶ時→nCn
    # 二項定理の和の公式より、上記の和はnC1+nC2+...+nCn=2**n
    # ans=2**n-1-nCa-nCb # 「-1」は、0本選ぶ場合を除外している。(問題の制限がN>=1なので)
    # 数列nCaの総和 = ΣnCa = n/1 + n(n-1)/2*1 + n(n-1)(n-2)/3*2*1 + ... + n(n-1)(n-2)...(n-a+1)/a!
    # ΣnCa = Π(n-a)/a! # Π(パイ)は総乗(数列を掛け算した合計)のこと。Σ(シグマ)は総和。
    # 2**nは普通に**で求めるとTLEする。python3ならpow()を使用することでO(logn)で計算できる。「繰り返し二乗法」という。
    # 繰返し二乗法・・・f(x) = 2**x、f(2x) = f(x)**2、f(2x+1) = f(x)**2 * 2、f(N) = f(2/N)**2
    nCa = choose(n, a)
    nCb = choose(n, b)
    ans = (pow(2, n, MOD) - 1 - nCa - nCb) % MOD
    print(int(ans))


def choose(n, a):
    x = y = 1  # xが分子、yが分母
    for i in range(a):
        x *= n - i
        x %= MOD
        y *= i + 1
        y %= MOD
    return x * pow(y, MOD-2, MOD) % MOD


# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(n, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    vint a(n);
    rep(i,n) cin >> a[i];
    for (int i = k; i < n; i++) {
        if (a[i] > a[i-k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

const int INF = int(1e9);
const int N = 5555;

int n;
int x[N];
vector<int> g[N];

int dp[N], ndp[N];
int mn[N];

void gg() {
    puts("IMPOSSIBLE");
    exit(0);
}

void dfs(int v) {
    for (int u: g[v]) {
        dfs(u);
    }

    fill_n(dp, x[v] + 1, INF);
    dp[0] = 0;

    for (int u: g[v]) {
        for (int i = 0; i <= x[v]; i++) {
            int best = INF;
            if (i >= x[u]) {
                best = min(best, dp[i - x[u]] + mn[u]);
            }
            if (i >= mn[u]) {
                best = min(best, dp[i - mn[u]] + x[u]);
            }
            ndp[i] = best;
        }
        
        copy_n(ndp, x[v] + 1, dp);
    }

    mn[v] = *min_element(dp, dp + x[v] + 1);
    if (mn[v] == INF) {
        gg();
    }
}

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

    for (int i = 1; i < n; i++) {
        int p;
        scanf("%d", &p);
        p--;
        g[p].push_back(i);
    }

    for (int i = 0; i < n; i++) {
        scanf("%d", &x[i]);
    }

    dfs(0);

    puts("POSSIBLE");
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast,fast-math,unroll-loops")
 
#include <bits/stdc++.h>
 
#define int ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
#define PI 3.1415926535
 
using namespace std;
        
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair <int, int>;
using pld = pair <ld, ld>;

/*
const ll MAX_MEM = 25e7;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
*/
        
template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}
        
template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}
        
template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}
        
template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}
        
inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("lol.in", "r", stdin);
    //freopen("lol.out", "w", stdout);
}
signed main()
{
    Start();
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a + d - 1) / d >= (c + b - 1) / b)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int a, b;
  cin >> a >> b;
  cout << (a+b) / 2 << endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;int min=INT_MAX;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
    //   if(min<a[i])
    //   min=a[i];
  }
  int c=0;
  for(int i=0;i<n;i++)
  {
      if(a[i]<=min)
      c++;
      if(a[i]<=min)
      min=a[i];
  }
  cout<<c;
}

Measured memory_bytes: 1024
# Author: cr4zjh0bp
# Created: Fri Mar 20 22:48:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ns()
if n[0] == '9':
    print("Yes")
elif n[1] == '9':
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<set>
#include<bitset>
#include<vector>
#include<functional>
#include<deque>
#include<cctype>
#include<climits>
#include<complex>
#include<bits/stdc++.h>
#include<ctime>

using namespace std;

typedef long long LL;
typedef double DB;
typedef pair<int,int> PII;
typedef pair<DB,DB> PDD;
typedef complex<DB> CP;
typedef vector<int> VI;

#define mmst(a,v) memset(a,v,sizeof(a))
#define mmcy(a,b) memcpy(a,b,sizeof(a))
#define fill(a,l,r,v) fill(a+l,a+r+1,v)
#define re(i,a,b)  for(i=(a);i<=(b);i++)
#define red(i,a,b) for(i=(a);i>=(b);i--)
#define fi first
#define se second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define two(k) (1<<(k))
#define SZ(x) (int(x.size()))
#define all(x) (x).begin(),(x).end()
#define ire(i,v,x) for(i=0,v=i<SZ(x)?x[i]:0;i<SZ(x);v=x[++i])
#define ls (rt<<1)
#define rs (rt<<1|1)
#define MID ((l+r)>>1)

template<class T>inline T sqr(T x){return x*x;}
template<class T>inline void upmin(T &t,T tmp){if(t>tmp)t=tmp;}
template<class T>inline void upmax(T &t,T tmp){if(t<tmp)t=tmp;}

inline int sgn(DB x){if(fabs(x)<1e-9)return 0;return(x>0)?1:-1;}
const DB Pi=acos(-1.0);

int gint()
  {
		int res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=(res<<3)+(res<<1)+z-'0',z=getchar());
		return (neg)?-res:res;
	}
LL gll()
  {
  	LL res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=res*10+z-'0',z=getchar());
		return (neg)?-res:res;
	}
int gdb()
  {
  	string s;
  	cin>>s;
  	size_t p=s.find('.');
  	if(p==string::npos)
  	  s+="000";
  	else
  	  {
  	  	int d=s.length()-p-1;
  	  	s=s.substr(0,p)+s.substr(p+1);
  	  	while(d<3)s+="0",d++;
  	  }
  	istringstream is(s);
  	int res=0;
  	is>>res;
  	return res;
	}

const int MOD=1000000007;
const int maxn=60;
int n;
char s1[maxn],s2[maxn];
int m,a[maxn];

int main()
  {
  	/*freopen("D.in","r",stdin);
  	freopen("D.out","w",stdout);*/
  	int i;
  	n=gint();
  	scanf("%s",s1+1);
  	scanf("%s",s2+1);
  	re(i,1,n)if(s1[i]==s2[i])a[++m]=1;else a[++m]=2,i++;
  	LL ans=a[1]==1?3:6;
  	re(i,2,m)
  	  {
  	  	if(a[i-1]==1)ans=(ans+ans)%MOD;
  	  	if(a[i-1]==2 && a[i]==2)ans=(ans+ans+ans)%MOD;
  	  }
  	cout<<ans<<endl;
  	return 0;
  }

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

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

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc088/tasks/abc088_d
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int dp[3][3], h[3], w[3];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    REP(i, 3) REP(j, 3) cin >> dp[i][j];
    FOR(i, 1, 3) h[i] = dp[i][0] - dp[0][0];
    FOR(i, 1, 3) w[i] = dp[0][i] - dp[0][0];
    FOR(i, 1, 3) {
        FOR(j, 1, 3) {
            if (dp[i][j] - dp[0][j] != h[i] || dp[i][j] - dp[i][0] != w[j]) {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 256
//aoj 0121 Seven Puzzle
//七数?，字符串????理没什?好?的
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<string>
#include<map>
using namespace std;

string S;
map<string,int> dp;

int dir[4] = {-1,1,-4,4};
int a[10];

bool judge(int x1, int x2)
{
    if(x2==0 && (x1==0 || x1==4)) return false;
    if(x2==1 && (x1==3 || x1==7)) return false;
    if(x2==2 && x1<4) return false;
    if(x2==3 && x1>3) return false;
    return true;
}

void bfs()
{
    int p, ps;
    int shit;
    
    S = "01234567";
    //S[8] = 0;
    string s;
    queue<string> q;
    dp[S] = 0;
    q.push(S);
    while(!q.empty())
    {
        s = q.front(); q.pop();
        shit = dp[s];
        //printf("%s %d\n", s.c_str(), dp[s]);
        for(int i=0; i<8; ++i)
        {
            if(s[i]=='0') {p = i; break;}
        }
        for(int i=0; i<4; ++i)
        {
            if(judge(p,i))
            {
                ps = p+dir[i];
                swap(s[p],s[ps]);
                if(!dp.count(s)) {dp[s] = shit+1; q.push(s);}
                swap(s[p],s[ps]);
            }
        }
    }
}

void solve()
{
    printf("%d\n", dp[S]);
}

int main()
{
    bfs();
    while(scanf("%d", &a[0])!=EOF)
    {
        for(int i=1; i<8; ++i) scanf("%d", &a[i]);
        for(int i=0; i<8; ++i)
        {
            S[i] = a[i]-0+'0';
        }
        //S[8] = 0;
        solve();
    }
    return 0;
}

Measured memory_bytes: 5028
n, m = map(int, input().split())
d = {"1": -1, "2": -1, "3": -1}
for _ in range(m):
    s, c = input().split()
    if d[s] == -1:
        d[s] = int(c)
    elif d[s] != int(c):
        print(-1)
        exit()
n = str(4 - n)
if n != "3" and d["1"] == 0:
    print(-1)
elif n == "1":
    if d["1"] == -1:
        d["1"] = 1
    if d["2"] == -1:
        d["2"] = 0
    if d["3"] == -1:
        d["3"] = 0
    print(*d.values(), sep="")
elif n == "2":
    if d["1"] == -1:
        d["1"] = 1
    if d["2"] == -1:
        d["2"] = 0
    print(d["1"] * 10 + d["2"])
else:
    if d["1"] == -1:
        d["1"] = 0
    print(d["1"])

Measured memory_bytes: 9188
n = int(input())
a = list(map(int,input().split()))
count = 0
tmp = 1
if 1 in a:
    ind = a.index(1)
    count = count + ind
    if not ind == len(a):
        for i in range(ind+1,len(a)):
            if not a[i]-tmp == 1:
                count = count + 1
            else:
                tmp = a[i]
    print(count)

else:
    print(-1)

Measured memory_bytes: 26012
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int h,w,n;

int main(){
	cin>>h>>w>>n;
	vl dp(w);
	dp[0]++;
	for(int i=0;i<h;i++){
		vl DP(w);
		for(int j=0;j<1<<(w-1);j++){
			bool B=0;
			for(int k=1;k<w-1;k++) if(j&1<<k&&j&1<<(k-1)) B=1;
			if(B) continue;
			for(int k=0;k<w;k++){
				int x=k;
				if(k<w-1&&j&1<<k) x++;
				else if(k&&j&1<<(k-1)) x--;
				(DP[x]+=dp[k])%=mod;
			}
		}
		dp=DP;
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n,d,x;
  cin >> n >> d >> x;
  int a[n];
  REP(i,n) cin >> a[i];
  REP(i,n){
    int day = 1;
    while(day <= d){
      x++;
      day += a[i];
    }
  }
  
  cout << x << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2000000)
# import itertools
# import statistics
# import numpy as np
n = int(input())
#n = list(map(int, input().split()))
a = list(map(int, input().split()))
total = 0
for i in range(n):
    if a[i] % 2 == 0:
        count = 0
        while a[i] % 2 == 0:
            a[i] /= 2
            count += 1
        total += count
      
print(total)


Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	string S, T; cin >> S >> T;

	ll N = (ll)S.size();
	ll K = (ll)T.size();

	vector<string> res;
	for (ll i = 0; i < N-K+1; ++i)
	{
		string t;
		bool ok{true};

		for (ll ii = 0; ii < i; ++ii)
		{
			if (S[ii] == '?')
				t.push_back('a');
			else
				t.push_back(S[ii]);
		}
		
		for (ll j = 0; j < K; ++j)
		{
			ll k = i + j;
			if (S[k] == T[j])
			{
				t.push_back(S[k]);
			}
			else if (S[k] == '?')
			{
				t.push_back(T[j]);
			}
			else
			{
				ok = false;
				break;
			}
		}

		for (ll ii = i+K; ii < N; ++ii)
		{
			if (S[ii] == '?')
				t.push_back('a');
			else
				t.push_back(S[ii]);
		}

		if (ok) res.push_back(t);
	}

	sort(res.begin(), res.end());
	std::cout << (res.size()?res[0]:"UNRESTORABLE") << std::endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] line = sc.nextLine().split(" ", 0);
		double num = Double.parseDouble(line[0] + line[1]);
		double ans = Math.sqrt(num);

		//判定
		String ans_str = Double.toString(ans);
		if (ans_str.endsWith(".0")) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


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

using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define UNIQUE(o) (o).erase(unique(sort(all((o)))))

typedef long long ll;
const int N = 100;
const int S = 1000;
int n;
int c[S+1];

int main() {
  int s;
  scanf("%d ", &n);
  while (n) {
    memset(c, 0, sizeof(c));
    int res = 0;
    int max_idx = 0, min_idx = S;
    REP(i,n) {
      scanf("%d ", &s);
      c[s]++;
      max_idx = max(max_idx, s);
      min_idx = min(min_idx, s);
      res += s;
    }
    res -= max_idx;
    res -= min_idx;
    n -= 2;
    res /= n;
    printf("%d\n", res);
    scanf("%d ", &n);
  }

  return 0;
}

Measured memory_bytes: 3224
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int, input().split()))

H[0] -= 1
left = 0
for i in range(N):
    if left > H[i]:
        print("No")
        exit()
    elif H[i] > left:
        left = H[i] - 1
    else:
        left = H[i]
print("Yes")


Measured memory_bytes: 20588
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int long long
#define endl "\n"
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
#define RS(a) string  a; cin >> a;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n+1) {fr(j, 1, m+1) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
using vi=vector<int>;
const int inf = 1e18;
const int mod=1e9+7;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
bool isPrime(int n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
signed main()
{
    fastio;
    R(n);
    RA(a,n);
    RA(b,n);
    vector<pair<int,int>>v(n+1);
    int mx=0;
    map<int,int>m,mm;
    fr(i,1,n+1)
    {
        m[a[i]]+=1;
        mm[b[i]]+=1;
    }
    bool f=1;

    for(auto it=mm.begin();it!=mm.end();it++)
    {
        if(n-(it->se)<m[it->fi])
        {
            f=0;
        }
    }

    fr(i,0,n+1)
    {
        v[i]={0,0};
    }

    fr(i,1,n+1)
    {
        int j=i;
        while(j<=n&&b[j]==b[i])
        {
            j+=1;
        }
        j-=1;
        v[b[i]]={i,j};
        i=j;
    }

  fr(i,1,n+1)
    {
        if(v[a[i]].se<i)
        {
            continue;
        }
        else
        {
            mx=max(mx,v[a[i]].se-i+1);
        }
    }
   // cout<<mx<<endl;
    if(!f)
    {
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    for(int i=1+mx;i<=n;i++)
    {
        cout<<b[i]<<" ";
    }
    fr(i,1,mx+1)
    {
        cout<<b[i]<<" ";
    }


}


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

		using namespace std;

		int main()
		{ios_base::sync_with_stdio(false);
		    cin.tie(NULL);
		 	  int n,k;
		 	  cin>>n>>k;
		 	  int a[n];
		 	  for(int i=0;i<n;i++)
		 	  {
		 	  	cin>>a[i];
		 	  }
		 	  if(k==n)
		 	  {
		 	  	cout<<1<<endl;
		 	  }
		 	  else
		 	  {
		 	  	if((n-1)%(k-1)==0)cout<<(n-1)/(k-1);
    			else cout<<(n-1)/(k-1)+1<<endl;
		 	  }
			return 0;

		}

Measured memory_bytes: 4000
N=int(input())
from collections import deque
d = deque([int(input())]) 
import bisect

for i in range(N-1):
  a=int(input())
  if a>d[-1]:
    d[-1]=a
  elif d[0]>=a:
    d.appendleft(a)
  else:
    i=bisect.bisect_left(d,a)
    d[i-1]=a
print(len(d))

Measured memory_bytes: 7284
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        long h,w;
        h=scan.nextLong();
        w=scan.nextLong();
        if(h==1||w==1){
            System.out.println(1);
        }
        else if((h*w)%2==1){
            System.out.println(h*w/2+1);
        }
        else System.out.println(h*w/2);
    }
}

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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
const LL INT32 = (LL(MAXINT) + 1) * 2;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template <class T>
inline bool Read(T &ret)
{
    char c;
    int sgn;
    if (static_cast<void>(c = getchar()), c == EOF)
        return 0;
    while (c != '-' && (c < '0' || c > '9'))
        c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
        ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

template <class T>
inline void Write(T x)
{
    if (x < 0)
        putchar('-'), Write(x);
    if (x > 9)
        Write(x / 10);
    putchar(x % 10 + '0');
}

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i] != t[i])
            ans++;
    }
    cout << ans << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 3896
#!/mnt/c/Users/moiki/bash/env/bin/python
K,A,B = map(int, input().split())

# if A>=B:
if A >= B or A+2 >= B:
    print(1+K)
    exit(0)


ans = 1

K -= (A - 1)
ans += (A-1)

if K % 2 == 0:
    ans += (B-A) * (K//2)
else:
    ans += 1
    K -= 1
    ans += (B-A) * (K//2)
print(ans)
    










Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
ll a[13];
void make(ll i)
{
    a[i]=a[i-1]+pow(26,i);
    if(i<13)
    make(i+1);
    else
    return;
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
     
       ll n;
       cin>>n;
       ll a[n];
       input(a,n);
       map<ll,ll>m;ll sum=0;
       f(n){ m[a[i]]++;sum+=a[i];}
       ll q;
       cin>>q;
       f(q)
       {
           ll b,c;
           cin>>b>>c;
           sum=sum+(c-b)*m[b];
           m[c]+=m[b];m[b]=0;
           cout<<sum<<endl;
       }
    }
    return 0;
}

Measured memory_bytes: 10324
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    char cha[110];
    char hash[5] = {};
    for (int i = 0; i < N; i++) {
        cin >> cha[i];

        switch (cha[i]) {
        case'P':
            hash[0]++;
            break;
        case'W':
            hash[1]++;
            break;
        case'G':
            hash[2]++;
            break;
        case'Y':
            hash[3]++;
            break;
        }
    }
    int hashcount = 0;
    for (int i = 0; i < 4; i++) {
        if (hash[i] != 0)
            hashcount++;
    }
    if (hashcount == 4) {
        cout << "Four" << endl;
    }
    else {
        cout << "Three" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (){
int a,b;
cin >> a >> b;
if(a < b){
    cout<<"a < b"<<endl;
}else if(a == b){
    cout<<"a == b"<<endl;
}else if(a > b){
    cout<<"a > b"<<endl;
}
return 0;
}


Measured memory_bytes: 3092
/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
  
#define int long long int 
typedef vector<int> vi;
const int mod = 1e9 + 7; 

//#define CI cpp_int
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define debug(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " 
#define EB emplace_back
#define ALL(v) v.begin(), v.end() 
#define size(v) (int)v.size() 
#define endl "\n"
#define UMO unordered_map
#define USO unordered_set
#define setBits(n) __builtin_popcountll(n)
#define TC int t; cin >> t; while (t--) 

void Panda() {
    int a, b;
    cin >> a >> b;
    if(a >= 1 and b <= 9 and b >= 1 and a <= 9) cout << a * b << endl;
    else cout << -1 << endl;
}
  
int32_t main() {
 
    FAST;

   
    Panda();

    return 0; 
} 

Measured memory_bytes: 3548
const input = require('fs').readFileSync('/dev/stdin', 'UTF-8');

const printFrame = input => {
  const array = input.split('\n');

  for (let i = 0; i < array.length; i++) {
    const [h, w] = array[i].split(' ').map(Number);

    if (h === 0 && w === 0) {
      return false;
    }

    const topBottom = Array(w + 1).join('#') + '\n';
    const middle = '#' + Array(w - 1).join('.') + '#\n';

    console.log([topBottom, middle.repeat(h - 2), topBottom].join(''));
  }
};

printFrame(input);


Measured memory_bytes: 16140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
int a,b,c;
cin >> a >> b>>c;
if(a>b+c){
    cout << 0 << endl;
}else{
    cout <<(b+c)-a << endl;
}
return 0;
}

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

int main(void)
{
	char str[128] ;
  	char str1[128] = "ABC";
  	char str2[128] = "ARC";
    //printf("文字列を入力してください>");
    scanf("%s",str);
  	if(strcmp(str,str1) == 0)
    	{
          printf("ARC\n");
        }else{
      		if(strcmp(str,str2) == 0){
        		printf("ABC\n");
      		}else{
        		printf("先週開催されたコンテストをABCかARCで入力してください\n");
      		}
       }
	//printf("%s",str);
    return 0;
}

Measured memory_bytes: 1648
//When nothing comes in mind gcd laga lena
#include <bits/stdc++.h>

using namespace std;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define endl '\n'
#define MOD 1000000007

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<pair<int, int>> v;
    for (int i = 0; i < n; ++i) {
        int tp;
        cin >> tp;

        v.push_back({tp, i + 1});
    }
    sort(v.begin(), v.end());
    for (auto x:v)
        cout << x.second << " ";

    return 0;
}

Measured memory_bytes: 2544
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = ;
const long long INF_LL = 1e18+3; const int INF_int = 1e9+3;
#define ll long long
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto itr = a.begin();itr!=a.end();itr++) cout << *itr << " ";cout << endl;
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    cout << a*(n/(a+b)) + min(a,n%(a+b)) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	// 1 2 10
	// 2, 1 + 8 = 9
	// 3, 2 + 1 + 7 = 10
	// 1 2 10 10
	// 6, 5 + 4 + 4 + 4 = 17
	// 2, 1 + 8 + 8 = 17
	// 1, 1 + 9 + 9 = 19
	// 10, 9 + 8 = 17

	int Q; cin >> Q;
	priority_queue<ll> le;
	priority_queue<ll, vector<ll>, greater<ll>> ri;
	ll suml = 0, sumr = 0, sumb = 0;
	int cnt = 0;
	while (Q--) {
		int tp; cin >> tp;
		if (tp == 1) {
			ll a, b; cin >> a >> b;
			cnt++;
			sumb += b;

			if (ri.empty() || a >= ri.top()) {
				ri.push(a);
				sumr += a;
			}
			else {
				le.push(a);
				suml += a;
			}
			while (ri.size() > (cnt + 1) / 2) {
				ll v = ri.top();
				le.push(v);
				ri.pop();
				sumr -= v;
				suml += v;
			}
			while (le.size() > cnt / 2) {
				ll v = le.top();
				ri.push(v);
				le.pop();
				suml -= v;
				sumr += v;
			}
		}
		else {
			ll med = -1;
			if (cnt & 1) med = ri.top();
			else med = le.top();
			ll f = sumb;
			f += sumr - med*ri.size();
			f += med*le.size() - suml;
			cout << med << " " << f << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3828
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    if(a == b && b == c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

int main(void)
{
    int k; cin>>k;
    char s[105]; cin>>s;
    int len = strlen(s);
    if(len<=k) cout<<s;
    else{
        for(int i=0;i<k;++i) cout<<s[i];
        cout<<"...";
    }
    return 0;
}

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

using namespace std;

int main() {
	int n, x, t;
	cin >> n >> x >> t;

	int ans;

	if(n % x != 0) {
		ans = (n/x + 1) * t;
	} else {
		ans = n/x * t;
	}

	cout << ans ;

	return 0;
}

Measured memory_bytes: 3620