akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vi = vector<int>;
using vll = vector<ll>;

using pi = pair<int, int>;
using pll = pair<ll, ll>;

constexpr auto MOD = 1e9 + 7;
constexpr auto INF = 0x3f3f3f3f;

#define rep(i, a, b) for (auto i = a; i < b; ++i)

template <class T> inline T square(T x) { return x * x; };

template <class T> void print(const T &val) { cout << val << '\n'; }

template <class Iterator> void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; ++it) {
    cout << *it << ' ';
  }

  cout << '\n';
}

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

  int n;
  cin >> n;

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

  vi dp(n + 1, 0);
  dp[1] = 0;
  dp[2] = abs(a[2] - a[1]);

  for (auto i = 3; i <= n; ++i) {
    dp[i] =
        min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
  }

  print(dp[n]);
}


Measured memory_bytes: 1024
#include <stdio.h>
 
#define M 100000

typedef struct {
  char suit;
  int num;
  int point;
}Card;
 
void quickSort(Card *a,int p,int r){
  int q;
   
  if(p<r){
    q = partition(a,p,r);
    quickSort(a,p,q-1);
    quickSort(a,q+1,r);
  }
}
 
int partition(Card *a,int p,int r){
 
  int i,j;
  Card t,x;
   
  x=a[r];
  i=p-1;
 
  for(j=p;j<r;j++){
    if (a[j].num <= x.num){
    i=i+1;
    t=a[i];
    a[i]=a[j];
    a[j]=t;
    }
  }
  t=a[i+1];
  a[i+1]=a[r];
  a[r]=t;
 
  return i+1;
}
 
int main(){
 
  int i,j,n,r,p=0,flag=0;
  char b;
  Card a[M];
 
  scanf("%d%c",&n,&b);
 
  for(i=0;i<n;i++){
    scanf("%c%d%c",&a[i].suit,&a[i].num,&b);
    a[i].point=i;
  }
 
  r=n-1;
   
  quickSort(a,p,r);
 
  for(i=0;i<r-1;i++){
    if(a[i].num==a[i+1].num&&a[i].point>a[i+1].point){
      printf("Not stable\n");
      flag = 1;
      break;
    }
  }
  if(flag==0) printf("Stable\n");
 
   
  for(i=0;i<n;i++) printf("%c %d\n",a[i].suit,a[i].num);
  
   return 0;
}

Measured memory_bytes: 1776
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>

using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)cin >> a[i];

    bool c[8] = {false};
    int cf = 0;

    rep(i, n){
        if(a[i] < 400)c[0]=true;
        else if(a[i] < 800)c[1] = true;
        else if(a[i] < 1200)c[2] = true;
        else if(a[i] < 1600)c[3] = true;
        else if(a[i] < 2000)c[4] = true;
        else if(a[i] < 2400)c[5] = true;
        else if(a[i] < 2800)c[6] = true;
        else if(a[i] < 3200)c[7] = true;
        else cf++;
    }

    int ans = 0;
    rep(i, 8)if(c[i])ans++;

    cout << max(1, ans) << " " << ans + cf << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int a[256];
    memset(a,0,sizeof(a));
    string s;
    cin>>s;
    int n=s.length();
    int c1=0,c2=0;
    for(int i=0;i<n;i++)
    {
        a[s[i]]++;
    }
    for(int i=60;i<95;i++)
    {
        if(a[i]>=1)
        c1++;
    }
    if(c1>2 || c1<2)
    {
        cout<<"No";
    }
    else if(c1==2)
    {
        for(int i=60;i<95;i++)
        {
            if(a[i]==2)
            c2++;
        }
        if(c2==2)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }
    }
    return 0;
}










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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N, M;
vector<int> A;

int main(void) {
    cin >> N >> M;
    A.assign(N, 0);
    
    int sum = 0;
    rep(i, N) {
        cin >> A[i];
        sum += A[i];
    }

    double p = (double)sum / (4 * M);
    int count = 0;
    for(int i = 0; i < N; ++i) {
        if (A[i] >= p) count++;
    }

    if (count >= M) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

const int max_n = 200222, inf = 1000111222;

int t, n;

long long solve(vector<pair<int, int>> &v) {
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    long long res = 0;
    set<int> q;
    for (int i = 0; i < n; ++i) {
        q.insert(i);
    }
    for (auto p : v) {
        auto it = q.lower_bound(p.second);
        if (it == q.begin()) {
            continue;
        }
        --it;
        q.erase(it);
        res += p.first;
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        long long ans = 0;
        vector<pair<int, int>> a, b;
        for (int i = 0; i < n; ++i) {
            int k, l, r;
            scanf("%d%d%d", &k, &l, &r);
            ans += min(l, r);
            if (l > r) {
                a.push_back({l - r, k});
            } else {
                b.push_back({r - l, n - k});
            }
        }
        ans += solve(a);
        ans += solve(b);
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 14176
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int>black(N);
  for(int i = 0; i < N; i ++){
    cin >> black.at(i);
    }
  int count = 0;
  int i = 0;
  while(count == 0){
    for(int j = 0; j < N; j ++){
      int p = 2;
      for(int k = 0; k < i; k++){
        p *= 2;
      }
      if(black.at(j) % p  != 0){
        count ++;
        break;
      }
      if(j == N-1){
        i++;
      }
    }
  }
  cout << i << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = 3;
		int[] a = new int[N];
		Arrays.setAll(a, i -> sc.nextInt());
		
		int sum = Arrays.stream(a).sum();
		String ans = sum >= 22 ? "bust" : "win";
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 26964
#include <bits/stdc++.h>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef unordered_map<int,int> m32;
typedef map<ll,ll> m64;
typedef unordered_map<ll,set<ll> > m648;
typedef pair<ll,p64 > pp64;
ll MOD = 1e9 + 7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX
v64 dp;

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,w;
    cin >> n >> w;
    ll a[n][2];
    forn(i,n) forn(j,2) cin >> a[i][j];
    ll dp[n+1][w+1];
    forn(j,n+1) forn(i,w+1) dp[j][i]=0;
    forn(i,n){
    	forn(j,w+1){
    		if(j-a[i][0]<0){
    			dp[i+1][j]=dp[i][j];
    			if(j!=0) dp[i+1][j]=max(dp[i+1][j],dp[i+1][j-1]);
    		}
    		else 
    			dp[i+1][j]=max(dp[i][j],dp[i][j-a[i][0]]+a[i][1]);
    			if(j!=0) dp[i+1][j]=max(dp[i+1][j],dp[i+1][j-1]);
    	}
    }
    // forn(i,n+1){
    // 	forn(j,w+1){
    // 		cout << dp[i][j] << " ";
    // 	}
    // 	cout << ln;
    // }
    // ll ans=0;
    cout << dp[n][w] << ln;
    // rforn(i,w-1){
    // 	ans = max(dp[n][i],ans); 
    // }
    // cout << ans << ln;
    return 0;
}

Measured memory_bytes: 79232
import java.util.Stack

fun main(args: Array<String>) {
    //val n = readLine()!!.toInt()
    val list: List<String> = readLine()!!.split(" ").map { it.toString() }
    val calc: Stack<Int> = Stack()
    var first :Int
    var second:Int
    list.forEach{ i ->
        if (i =="+")
        {
            second = calc.pop().toInt()
            first = calc.pop().toInt()
            calc.push(first+ second)
        }
        else if(i=="-")
        {
            second = calc.pop().toInt()
            first = calc.pop().toInt()
            calc.push(first - second)
        }
        else if (i=="*")
        {
            second = calc.pop().toInt()
            first = calc.pop().toInt()
            calc.push(first * second)
        }
        else
        {
            calc.push(i.toInt())
        }
    }
    println(calc.pop())
}


Measured memory_bytes: 31996
n = int(input())
a = list(map(int, input().split()))

i = 0
m = 100
M = -100

s = 0
while i < n:
    s += a[i]
    i+=1

s1 = s//n
s2 = s1 + 1

i = 0
x1 = 0
x2 = 0
while i < n:
    x1 += (s1-a[i])**2
    x2 += (s2-a[i])**2
    i+=1

if x1<x2:
    ans = x1
else:
    ans = x2
print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;
 
template <ll MOD>
struct modint{
    ll x;
    modint() : x(0) {}
    modint(ll a): x((a % MOD + MOD) % MOD) {}
    
    
 
    bool operator!() const{return !x;}
 
    bool operator<(const modint &a) const{
        modint res(*this);
        return res.x < a.x;
    }
    
    bool operator>(const modint &a) const{
        modint res(*this);
        return res.x > a.x;
    }
 
    modint &operator+=(const modint &a){
        if((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator-=(const modint &a){
        if((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator*=(const modint &a){
        (x *= a.x) %= MOD;
        return *this;
    }
 
    modint &operator/=(const modint &a){
        *this *= a.inv();
        return *this;
    }
 
    modint &operator%=(const modint &a){
        x %= a.x;
        return *this;
    }
 
    modint operator-() const{ return modint(-x); }
 
    modint operator+(const modint &a) const{ return modint(*this) += a; }
    modint operator-(const modint &a) const{ return modint(*this) -= a; }
    modint operator*(const modint &a) const{ return modint(*this) *= a; }
    modint operator/(const modint &a) const{ return modint(*this) /= a; }
    modint operator%(const modint &a) const{ return modint(*this) %= a; }
    bool operator==(const modint &a) const{ return x == a.x; }
    bool operator!=(const modint &a) const{ return x != a.x; }
 
 
    modint pow(ll n) const{
        modint res(1), a(x);
        while(n > 0){
            if(n & 1) res *= a;
            a *= a;
            n /= 2;
        }
        return res;
    }
 
    modint inv() const{
        return this->pow(MOD-2);
    }
 
    friend ostream &operator<<(ostream &os, const modint &m){
        return os << m.x;
    }
 
    friend istream &operator>>(istream &is, modint &m){
        ll t;
        is >> t;
        m = modint<MOD>(t);
        return (is);
    }
    
    static ll get_mod(){ return MOD; }
};
using mint = modint<MOD>;


signed main(){
    ll n,m;
    cin >> n >> m;

    mint fact[m+1] = {};
    fact[0] = 1; fact[1] = 1;
    rep(i,2,m+1){
        fact[i] = fact[i-1]*i;
    }

    mint sum = 0;
    rep(i,1,n+1){
        if(i % 2 == 0) sum += fact[n]/fact[i]/fact[n-i]*fact[m-i]/fact[m-n];
        else sum -= fact[n]/fact[i]/fact[n-i]*fact[m-i]/fact[m-n];
    }
    sum = fact[m]/fact[m-n] + sum;
    mint ans = fact[m]/fact[m-n]*sum;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7404
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

template<class T>struct costflowGraph{
	typedef pair<T, int> P;
	struct edge{
		int to, cap, rev;
		T cost;
		edge(int to, int cap, T cost, int rev) :
			to(to), cap(cap), cost(cost), rev(rev){
			}
	};
	
	int n, *prevv, *preve;
	T *dist;
	vector<vector<edge> > G;
	
	costflowGraph(int sz) : n(sz){
		G.resize(n);
		dist = new T[n];
		prevv = new int[n]; preve = new int[n];
	}
	~costflowGraph(){
		delete dist;
		delete prevv; delete preve;
	}
	
	int add(int s, int t, int cap, T cost){
		G[s].pb(edge(t, cap, cost, G[t].size()));
		G[t].pb(edge(s, 0, -cost, G[s].size() - 1));
		return G[s].size() - 1;
	}
	T min_cost_flow(int s, int t, int f){
		T res = 0;
		while(f > 0){
			fill(dist, dist + n, inf);
			dist[s] = 0;
			while(1){
				bool update = 0;
				rep(v, n){
					if(dist[v] == inf) continue;
					rep(i, G[v].size()){
						edge &e = G[v][i];
						if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + EPS){
							dist[e.to] = dist[v] + e.cost;
							prevv[e.to] = v;
							preve[e.to] = i;
							update = 1;
						}
					}
				}
				if(!update) break;
			}
			if(dist[t] == inf) return -1;
		
			int d = f;
			for(int v = t; v != s; v = prevv[v]) d = min(d, G[prevv[v]][preve[v]].cap);
			f -= d;
			res += d * dist[t];
			for(int v = t; v != s; v = prevv[v]){
				edge &e = G[prevv[v]][preve[v]];
				e.cap -= d;
				G[v][e.rev].cap += d;
			}
		}
		return res;
	}
};

int n, w[100][100], e[100][100], id[100][100];
char c[100][101];

int main(){
	cin >> n;
	rep(i, n) rep(j, n) cin >> w[i][j], w[i][j];
	rep(i, n) rep(j, n) cin >> e[i][j], e[i][j];
	rep(i, n) cin >> c[i];
	
	int ans = 0;
	int s = n * n + 2 * n, t = s + 1;
	costflowGraph<int> g(t + 1);
	rep(i, n) rep(j, n){
		int co;
		if(c[i][j] == 'o') co = -e[i][j], ans += e[i][j];
		else co = w[i][j];
		id[i][j] = g.add(n * n + i, i * n + j, 1, co);
		g.add(i * n + j, n * n + n + j, 1, 0);
	}
	rep(i, n){
		g.add(s, n * n + i, 1, 0);
		g.add(n * n + n + i, t, 1, 0);
	}
	cout << ans + g.min_cost_flow(s, t, n) << endl;
	vector<pi> v;
	rep(i, n) rep(j, n){
		if((g.G[n * n + i][id[i][j]].cap == 0) != (c[i][j] == 'o')){
			v.pb(mp(i, j));
		}
	}
	cout << v.size() << endl;
	rep(i, v.size()) cout << v[i].first + 1 << " " << v[i].second + 1 << " " <<
	(c[v[i].first][v[i].second] == 'o' ? "erase" : "write") << endl;
	
	return 0;
}

Measured memory_bytes: 2588
#!/usr/bin python3
# -*- coding: utf-8 -*-

from fractions import gcd   #for python3.4
#from math import gcd        #for python3.8

def lcm(a,b):
    G = gcd(a, b) #最大公約数
    L = (a//G)*b #最小公倍数
    return L

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    L = lcm(N,M)
    if S[::L//M]==T[::L//N]:
        print(L)
    else:
        print(-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 5340
#include "bits/stdc++.h"
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
 
template <typename T>
void cetak(T t){cout << t << ')' << endl;}
template <typename T, typename... V>
void cetak(T t, V... v) {cout << t; if (sizeof...(v)) cout << ", "; cetak(v...);}
 
#define debug(x...) cout << '(' << #x << ") = ("; cetak(x) 
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())


const int MOD = 1e9 + 7;

int add(int x, int y){
    int ret = x + y;
    if(ret >= MOD) ret -= MOD;
    return ret;
}
int sub(int x, int y){
    int ret = x - y;
    if(ret < 0) ret += MOD;
    return ret;
}
int mul(int x, int y){
    return (long long)x * y % MOD;
}


const int mx = 1e5 + 10;
int POW(int a, int b){
    int ret = 1;
    while(b > 0){
        if(b & 1) ret = mul(ret, a);
        b >>= 1;
        a = mul(a, a);
    }
    return ret;
}


void solve(){
    int n, k;
    cin >> n >> k;
    vector<int> x(n), fak(n + 1), inv(n + 1);
    fak[0] = 1;
    for(int i = 1; i <= n; i++) fak[i] = mul(fak[i - 1], i);
    inv[n] = POW(fak[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) inv[i] = mul(inv[i + 1], i + 1);
    for(int i = 0; i < n; i++) cin >> x[i];
    sort(ALL(x));
    function<int(int, int)> C = [&](int n, int k){
        if(n < k) return 0;
        return mul(fak[n], mul(inv[k], inv[n - k]));
    };
    int ans = 0;
    for(int i = 1; i < n; i++){
        int total = C(n, k);
        int kiri = C(i, k);
        int kanan = C(n - i, k);
        total = sub(total, add(kiri, kanan));
        total = mul(total, sub(x[i], x[i - 1]));
        ans = add(ans, total);
        // debug(i, ans, kiri, kanan);
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>
#include <deque>

using namespace std;

int main() {
	long long n, k;
	cin >> n >> k;

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

	deque<int> deq;
	set<int> visited;
	int pos = 1;

	while (visited.count(pos) == 0) {
		deq.emplace_back(pos);
		visited.insert(pos);
// printf("pos %d -> ", pos);
		pos = a[pos];
// printf("pos %d\n", pos);
		k--;
		if (k == 0) {
			cout << pos << endl;
			return 0;
		}
	}

	while (deq.front() != pos) {
		deq.pop_front();
	}


	int n_loop = deq.size();
	k %= n_loop;
// printf("n_loop %d\n", n_loop);
	cout << deq[k] << endl;
	return 0;
}


Measured memory_bytes: 11856
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
#define ll long long
using namespace std;
int n,k;
int pos[100008];
int ans=2e9;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>pos[i];
	for(int i=1;i<=n-k+1;i++)
	{
		int j=i+k-1;
		ans=min(ans,min(abs(pos[j]),abs(pos[i]))+abs(pos[i]-pos[j]));
	}cout<<ans;
	return 0; 
}

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

int main() {
	long long X;
	cin >> X;

	for(int a = -1000; a <= 1000; a++) {
		for(int b = -1000; b <= 1000; b++) {
			long long A = pow(a, 5);
			long long B = pow(b, 5);
			if(A - B == X) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}

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

using namespace std;
char N[3];

int main(){
    cin >> N;
    if(N[0] == '7' || N[1] == '7' || N[2] == '7'){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

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

#define ioso ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define kholo freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
#define laglo cerr << "Ti : " << clock() * 1.0 / CLOCKS_PER_SEC  << endl;
#define endl '\n';
#define ll long long

int main() {
	ioso; //kholo;
	string s;
	cin >> s;
	if(s[0]==s[1] and s[1]==s[2] and s[0]==s[2]) {
		cout << "No\n";
	}
	else cout << "Yes\n";
	//laglo;
}

Measured memory_bytes: 256
import math
import itertools
import functools
import numpy as np
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_DOWN


a, b = map(str, input().split())
print((Decimal(a) * Decimal(b)).quantize(Decimal('0'), rounding=ROUND_DOWN))
# print(math.floor(2.5))




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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().ToCharArray();

        var s1 = new char[(input.Length - 1) / 2];
        var s2 = new char[(input.Length - 1) / 2];
        Array.Copy(input, 0, s1, 0, (input.Length-1)/2);
        Array.Copy(input, (input.Length + 3)/2 - 1 , s2, 0, (input.Length-1)/2);

        for (int i = 0; i < input.Length; i++)
        {
            if (input[i] != input[input.Length - 1 - i])
            {
                Console.WriteLine("No");
                return;
            }

        }
        for (int i = 0; i < s1.Length; i++)
        {
            if (s1[i] != s1[s2.Length - 1 - i])
            {
                Console.WriteLine("No");
                return;
            }

        }
        for (int i = 0; i < s2.Length; i++)
        {
            if (s2[i] != s2[s2.Length - 1 - i])
            {
                Console.WriteLine("No");
                return;
            }

        }
        Console.WriteLine("Yes");
        

    }
}


Measured memory_bytes: 13140
#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;
        std::cin >> n;
        std::vector<int> a(n);
        rep(i,n) std::cin >> a[i];
        bool ok =true;
        rep(i,n){
            if (a[i]%2 ==1) continue;
            if (a[i]%3 != 0 && a[i]%5 != 0) ok = false;
        }
        
        if (ok) std::cout << "APPROVED" << "\n";
        else std::cout << "DENIED" << "\n";
        return 0;
    }
    


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a, b;

    while (true) {
      a = scanner.nextInt();
      b = scanner.nextInt();
      if (a == 0 && b == 0) break;
      for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) System.out.printf("#");
        System.out.println();
      }
      System.out.println();
    }
  }
}


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


int call(int x, int y)
{
    int sum=0;
    while(x>0)
    {
        sum+=x%10;
        x/=10;
    }
    while(y>0)
    {
        sum+=y%10;
        y/=10;
    }
    return sum;
}

int main()
{
    int n;
    cin>>n;
    int ans=1e9;
    for(int i=1;i<=n-1;i++)
    {
        ans=min(ans,call(i,n-i));
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n = 100000;
lli q;
vll p;
vll ans;

bool isp(lli x){
  for(lli j = 2;j*j <= x;j++){
    if(x%j == 0) return false;
  }
  return true;
}

int main(){
  p = vll(n+1);
  ans = vll(n+1);
  p[2] = 1;
  for(lli i = 3;i <= n;i+=2){
    if(isp(i)) p[i] = 1;
  }
  for(lli i = 3;i <= n;i+=2){
    if(p[i] == 1 && p[(i+1)/2] == 1) ans[i] = 1;
  }
  for(lli i = 1;i <= n;i++){
    ans[i] += ans[i-1];
  }
  cin >> q;
  for(lli i = 0;i < q;i++){
    lli l,r;
    cin >> l >> r;
    cout << ans[r]-ans[l-1] << endl;
  }
  return 0;
}


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

int main() {
	int N, A, X[200000];
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A;
		X[i - 1] = A - i;
	}
	sort(X, X + N);
	long long int ans;
	if (N % 2 == 1) {
		int Y = X[(N - 1) / 2];
		long long int ans1 = 0;
		for (int i = 0; i < N; i++) {
			ans1 += abs(X[i] - Y);
		}
		ans = ans1;
	}
	else {
		int Y1 = X[N / 2 - 1], Y2 = X[N / 2];
		long long int ans1 = 0, ans2 = 0;
		for (int i = 0; i < N; i++) {
			ans1 += abs(X[i] - Y1);
			ans2 += abs(X[i] - Y2);
		}
		ans = min(ans1, ans2);
	}
	cout << ans;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define leps(j,n) for(int j=1; j<(n); j++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

#define return(Z) re:(Z)

long long h[10000010],x[10000010],z[10000010];

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;

    cout<<48-n<<'\n';
}

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

struct dice{
	vector<int>d,init;
	void insert(){
		for(int i=0;i<6;++i){
			int n; cin>>n;
			d.emplace_back(n);
			init.emplace_back(n);
		}
	}
	void roll(char c){
		int&top=d.at(0),&dow=d.at(1),&rig=d.at(2)
		,&lef=d.at(3),&upp=d.at(4),&btm=d.at(5);
		if(c=='N')swap(top,upp),swap(top,btm),swap(top,dow);
		else if(c=='E')swap(top,rig),swap(top,btm),swap(top,lef);
		else if(c=='S')swap(top,dow),swap(top,btm),swap(top,upp);
		else if(c=='W')swap(top,lef),swap(top,btm),swap(top,rig);
	}
	void prtop(){
		cout<<d.at(0)<<"\n"s;
	}
	void prrig(int top,int dow){
		vector<string>v={"-"s,"N"s,"W"s,"WW"s,"E"s,"N"s};
		vector<int>tmp=d; d=init;
		int&nwtop=d.at(0),&nwdow=d.at(1),&nwrig=d.at(2)
		,&nwlef=d.at(3),&nwupp=d.at(4);
		auto rotate=[&](){
			swap(nwdow,nwrig),swap(nwdow,nwupp),swap(nwdow,nwlef);
		};
		for(auto&&i:v){
			for(auto&&j:i){
				roll(j);
			}
			for(int j=0;j<4;++j){
				if(top==nwtop&&dow==nwdow){
					cout<<nwrig<<"\n"s;
					d=tmp;
					return;
				}
				rotate();
			}
		}
	}
};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	dice a; a.insert();
	int q; cin>>q;
	for(int i=0;i<q;++i){
		int top,dow; cin>>top>>dow;
		a.prrig(top,dow);
	}
}


Measured memory_bytes: 3212
from itertools import accumulate as acc

def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x) - 1, input().split()))


if __name__ == "__main__":
    N, M, Q = LI()
    LR = [[0]*N for _ in range(N)]
    for i in range(M):
        l, r = LI_()
        LR[l][r] += 1

    # 二次元累積和
    S = [[0] * N for _ in range(N)]
    for i, row in enumerate(LR):
        LR[i] = list(acc(row))
    for i, col in enumerate(zip(*LR)):
        S[i] = list(acc(reversed(col)))

    for _ in range(Q):
        p, q = LI()
        # 必ず正方形だから、
        print(S[q-1][N-p])


Measured memory_bytes: 13940
N=input();K=input();x=input().split();Ans=int(0)
x.sort(key=int)
for i in range(0,len(x)):
    if(int(x[i])>(int(K)/2)):
        Ans += 2*(int(K)-int(x[i]))
    else:
        Ans += 2*int(x[i])
print(int(Ans))


Measured memory_bytes: 3060
N,M,X,Y=map(int,input().split())
xN =list(map(int, input().split()))
xN.append(X)
maxX=max(xN)

yM =list(map(int, input().split()))
yM.append(Y)
minY=min(yM)
if(maxX>=minY):
    print("War")
else:
    
    print("No War")

#print("X=",X,"<",minY,"≤",Y,"=Y")
#print(xN,"<",minY)
#print(yM,"≥",minY)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int intinput() {
	int x;
	cin >> x;
	return x;
}
vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	vector<int> s(10);
	string ss;
	cin >> ss;
	for(int i = 0;i < ss.length();i++){
		s[i] = ss.at(i) - '0';
	}
	int cnt =100000;
	for(int i = 0;i < ss.length()-2;i++){
		if(100*s[i] + 10*s[i+1] + s[i+2] -753 <= 0){
			if((100*s[i] + 10*s[i+1] + s[i+2] - 753)*-1 < cnt){
				cnt = (100*s[i] + 10*s[i+1] + s[i+2] - 753)*-1;
			}
		}else{
			if(100*s[i] + 10*s[i+1] + s[i+2] - 753 < cnt){
				cnt = 100*s[i] + 10*s[i+1] + s[i+2] - 753;
			}
		}
	}
	cout << cnt << endl;
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll ans = 0;
    if (b - 1 <= n) {
        ans = a * (b - 1);
    } else {
        ans = a * (n == b ? n - 1 : n);
    }
    ans /= b;
    cout << ans << endl;
}

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

using namespace std;

const int MAXN = 200005;

typedef long long LL;

int P;

char s[MAXN];
//考虑一个起点，这个起点开始的哪些终点可以作为结尾的呢？
//当终点加1作为起点的数字与整体同余的时候是可以的
//p=2,5特判

int buk[10005];

int n;

int mod(int x){
    return (x%P+P)%P;
}

int main(){
    scanf("%d%d", &n, &P);
    scanf("%s", s+1);

    LL res=0;
    int num=0;
    int pw=1;

    if(P==2||P==5){
        for(int i=1;i<=n;++i){
            if((s[i]-'0')%P==0){
                res+=i;
            }
        }
        cout<<res;
        return 0;
    }

    buk[0]=1;
    for(int i=n;i>=1;--i){
        num=mod(num+(s[i]-'0')*pw);
        res+=buk[num];
        ++buk[num];//bug
        pw=mod(pw*10);
    }

    cout<<res;
    return 0;
}


Measured memory_bytes: 512
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

k = [
[1, 1, 1],
[1, 1, -1],
[1, -1, 1],
[1, -1, -1],
[-1, 1, 1],
[-1, 1, -1],
[-1, -1, 1],
[-1, -1, -1]]

p = ""

for i in k:
  if (a + b * i[0] + c * i[1] + d * i[2]) == 7:
    p += str(a)
    p += "+" if i[0] == 1 else "-"
    p += str(b)
    p += "+" if i[1] == 1 else "-"
    p += str(c)
    p += "+" if i[2] == 1 else "-"
    p += str(d)
    p += "=7"
    print(p)
    break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int N;
pii p[1010];

int calc(vector<int> v, int w) {
  vector<vector<int>> dp(1010,vector<int>(1010,0));
  dp[0][0] = 1;
  REP(i,v.size()) REP(j,1010) if (dp[i][j]) {
    dp[i+1][j] |= dp[i][j];
    if (j+v[i] <= w) dp[i+1][j+v[i]] |= dp[i][j];
  }
  int ans = 0;
  REP(i,1010) if (dp[v.size()][i]) ans = i;
  return ans;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> N, N) {
    REP(i,N) cin >> p[i].first >> p[i].second;
    sort(p,p+N);
    int sum = 0;
    REP(i,N-1) sum += p[i].first;
    int sumw = 0;
    REP(i,N) sumw += p[i].second;
    if (sum >= p[N-1].first) {
      cout << sum + p[N-1].first + sumw << endl;
    } else {
      vector<int> v;
      REP(i,N-1) v.push_back(p[i].second);
      cout << max(2*p[N-1].first+sumw-calc(v,p[N-1].first-sum),p[N-1].first+sum+sumw) << endl;
    }
  }

  return 0;
}


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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	int N;
	cin >> N;
	vector<LL> a(N), b(N);
	int id = -1;
	LL ret = 0;
	for (int i : range(N)) {
		cin >> a[i] >> b[i];
		if (a[i] > b[i])id = i;
	}
	if (id == -1) {
		cout << 0 << endl;
	}
	else {
		LL sum = 0;
		for (int i : range(N)) {
			sum += a[i];
		}
		for (int i : range(N)) {
			if(a[i]>b[i])chmax(ret,sum-a[i]+a[i]-b[i]);
		}
		cout << ret << endl;
	}

	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define inf 20021225
#define ll long long
#define mxn 100010
using namespace std;

bool vis[mxn];
int d[mxn];

int main()
{
	int x,y,n,m,ans=0;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)	d[i]++;
	vis[1]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		d[x] --;
		d[y] ++;
		if(vis[x])	vis[y]=1;
		if(!d[x])	vis[x]=0;
	}
	for(int i=1;i<=n;i++)	if(vis[i])	ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

pub fn gcd<T: PrimInt>(a: T, b: T) -> T {
    if b == zero() {
        a
    } else {
        gcd(b, a % b)
    }
}
pub fn gcd_list<T: PrimInt>(vec: Vec<T>) -> T {
    assert!(vec.len() > 1);
    vec.iter().fold(vec[0], |acc, x| gcd(*x, acc))
}

fn _make_sieve<T: PrimInt>(mut maxu: usize) -> Vec<T> {
    maxu += 1;
    let mut sieve: Vec<T> = (0..maxu).map(|x| T::from(x).unwrap()).collect();

    let mut i = 2;
    while i*i < maxu {
        dbg!(&i);
        if sieve[i].to_usize().unwrap() < i { i+=1; continue; }
        for j in (i*i..maxu).step_by(i) {
            if sieve[j].to_usize().unwrap() == j { sieve[j] = T::from(i).unwrap() }
        }
        i += 1;
    }

    sieve
}

#[derive(Debug, Clone)]
pub struct OsaK<T: PrimInt + std::hash::Hash + NumAssign > {
    sieve: Vec<T>
}

impl<T: PrimInt + std::hash::Hash + NumAssign > OsaK<T> {
    pub fn new(max: T) -> Self {
        let maxu = max.to_usize().unwrap();
        let sieve = _make_sieve(maxu);

        Self { sieve }
    }

    pub fn from(vec: &Vec<T>) -> Self {
        let max = vec.iter().max().unwrap();
        let maxu = max.to_usize().unwrap();
        let sieve = _make_sieve(maxu);
        
        Self { sieve }
    }

    pub fn is_prime(&self, x: T) -> bool {
        if x == one() { return false }

        self.sieve[x.to_usize().unwrap()] == x
    } 

    pub fn prime_factorize(&self, mut n: T) -> std::collections::HashMap<T, T> {
        let mut res: std::collections::HashMap<T, T> = std::collections::HashMap::new();
        while n > one() {
            *res.entry(self.sieve[n.to_usize().unwrap()]).or_insert(zero()) += one();
            n /= self.sieve[n.to_usize().unwrap()]
        }
        res
    }
}

#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        n: usize,
        a_vec: [usize; n]
    }

    let osa_k: OsaK<usize> = OsaK::from(&a_vec);

    let mut prime_count: HashMap<usize, usize> = HashMap::new();
    for &a in a_vec.iter() {
        let prime_factors = osa_k.prime_factorize(a);
        // dbg!(&prime_factors);
        for k in prime_factors.keys() {
            *prime_count.entry(*k).or_insert(0) += 1;
        }
    }

    if prime_count.values().all(|x| *x == 1) {
        println!("pairwise coprime");
    } else if gcd_list(a_vec) == 1 {
        println!("setwise coprime");
    } else {
        println!("not coprime")
    }
    
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

slime_list = list(map(int, input().split()))

count = 0
for i in range(N - 1):

  if slime_list[i] == slime_list[i + 1]:
    if slime_list[i + 1] > 0:
      slime_list[i + 1] = 0
    else:
      slime_list[i + 1] = 1
    count += 1

print(count)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    vector<int> v1(26, 0), v2(26, 0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
        v1[s[i] - 'a']++;
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        v2[s[i] - 'a']++;
        int r = 0;
        for (int j = 0; j < 26; j++) {
            if (v2[j] > 0 && v1[j] - v2[j] > 0) {
                r++;
            }
        }
        res = max(res, r);
    }
    cout << res << endl;
}


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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;

const int mod = 1e9 + 7;


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

	int n;
	cin >> n;
	int x;
	if(n % 2 == 0){
		x = n / 2;
	}else{
		x = n / 2 + 1;
	}
	double ans = (double)x / (double)n;
	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() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string A, B, C;
	cin >> A >> B >> C;
	if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

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

    static class BAcCepted {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            boolean answer = valid(s);

            out.println(answer ? "AC" : "WA");
        }

        private boolean valid(String s) {
            if (s.charAt(0) != 'A')
                return false;

            int c = 0;
            for (int i = 2; i <= (s.length() - 2); i++) {
                if (s.charAt(i) == 'C')
                    c++;
            }
            if (c != 1)
                return false;

            int notLower = 0;
            for (int i = 0; i < s.length(); i++) {
                if (!(s.charAt(i) <= 'z' && s.charAt(i) >= 'a'))
                    notLower++;
            }

            if (notLower != 2)
                return false;

            return true;
        }

    }

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

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

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

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <sstream>
using namespace std;
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define F first
#define S second
#define MP make_pair
typedef long long ll;
const int oo = 1e9;

int main() {_
    ll a,b;
    cin >> a >> b;
    cout << a*b-(a+b-1);
}


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

int main()
{
    string s;
    string ABC = "ABC";
    string ARC = "ARC";
    cin >> s;
    if (s==ABC) {
        cout << ARC << endl;
    }
    else {
        cout << ABC << endl;
    }
}

Measured memory_bytes: 3576
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (ll)1e9+7
#define LLINF (ll)1e30
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,h[100010],dp[100010]={};
    cin>>n>>k;
    rep(i,n) cin>>h[i];
    rep2(i,1,n){
        ll a=min(i,k);
        ll b=LLINF;
        rep2(j,1,a+1){
            b=min(b,dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i]=b;
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

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


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

    cout << "Yes" << endl;
}

Measured memory_bytes: 3592
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))

dbl = [[0] * 61 for _ in range(N)]
for i in range(N): dbl[i][0] = a[i] - 1

for k in range(60):
  for i in range(N):
    x = dbl[i][k]
    dbl[i][k + 1] = dbl[x][k]

x = 0
while K:
  x = dbl[x][K.bit_length() - 1]
  K -= 1 << (K.bit_length() - 1)
print(x + 1)

Measured memory_bytes: 201016
#include<iostream>
using namespace std;
int m[60], f[60], r[60];
int main(){
	char rank;
	int s = 0;
	for (int a = 0; a < 50; a++){
		cin >> m[a]>> f[a] >> r[a];
		if (m[a] == -1 && f[a] == -1) break;
		
		s++;
	}
	for (int a = 0; a < s; a++){
		if (m[a] == -1) cout << 'F';
		
	else if (f[a] == -1)cout << 'F';
		else if (m[a] + f[a] >= 80)cout << 'A';
		else if (m[a] + f[a] >= 65 && m[a] + f[a] < 80)cout << 'B';
		else if (m[a] + f[a] >= 50 && m[a] + f[a] < 65)cout << 'C';
		else if (m[a] + f[a] >= 30 && m[a] + f[a] < 50){
			if (r[a] >= 50) cout << 'C';
			else if (r[a] < 50)cout << 'D';

		}
		 else if (m[a] + f[a]  < 30)cout << 'F';
		
		cout << endl;
	}





	return 0;
}


Measured memory_bytes: 3104
#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 n; cin >> n;
  ll ans = 1e18;
  for(ll i=1; i*i<=n; ++i){
    if(n % i != 0) continue;
    ll j = n / i;
    ans = min(i + j - 2, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <algorithm>
#include <vector>

template <class Dragons>
class LIS{ // 最長増加部分列を求める
private:
    #define repeat(i, n) for(int (i) = 0; (i) < (n); ++(i))
    #define allRange(A) A.begin(), A.end()

    const int n; // 配列のサイズ
    std::vector<Dragons> V; // 内容本体
    // LongestIncreasingSubsequence[i] := 長さ i の最長増加部分列の末尾の最小要素
    std::vector<Dragons> LongestIncreasingSubsequence;
public:
    // コンストラクタ : vectorを入れる
    LIS(std::vector<Dragons> & VV): n( VV.size() ){ 
        V = VV; LongestIncreasingSubsequence.resize(n+1);
    }
    // コンストラクタ　: 長さ指定
    LIS(int nn): n(nn){ V.resize(nn); LongestIncreasingSubsequence.resize(nn+1);}
    // Vの中身を更新する
    void update(int index, Dragons& element){
        V.at(index) = element;
    }
    // 初期値 : 無限大を入れる
    int compute(Dragons infinity){
        std::fill( allRange(LongestIncreasingSubsequence), infinity);
        repeat(i, n){
            // この要素 : V[i] 未満の最大インデックスを求める : 
            // ただし, 以下の場合は if(LIS[med] '<=' V[i])
            int ok = 0, ng = n + 1;
            while(ng - ok > 1){
                int med = (ok + ng) / 2;
                if(LongestIncreasingSubsequence[med] >= V[i]) ok = med;
                else ng = med;
            }
            LongestIncreasingSubsequence.at(ok+1) = V[i];
        }
        /* 無限大になっていないものを二分探索で検索 */   
        int ok = 0, ng = n + 1;
        while(ng - ok > 1){
            int med = (ok + ng) / 2;
            if(LongestIncreasingSubsequence[med] == infinity) ng = med;
            else ok = med;
        }
        return ok;
    }
    #undef allRange
    #undef repeat
};

int main(void){
    int n; scanf("%d", &n);
    LIS<int> D(n);
    for(int i = 0; i < n; ++i){
      int a; scanf("%d", &a);
      D.update(i, a);
    }
    printf("%d\n", D.compute(-1));
    return 0;
}

Measured memory_bytes: 1024
# ABC065d
import sys
from operator import itemgetter
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def dist(x1, y1, x2, y2):
    return min(abs(x1-x2), abs(y1-y2))


n = int(input())
Aedges = []
Aedges2 = []
for i in range(n):
    x, y = map(int, input().split())
    Aedges.append((x, y, i))
    Aedges2.append((x, y, i))
Aedges.sort()
Aedges2.sort(key=itemgetter(1))
# print(Aedges)
# print(Aedges2)

edges = []

for i in range(1, n):
    edges.append((Aedges[i][0]-Aedges[i-1][0], Aedges[i][2], Aedges[i-1][2]))
for i in range(1, n):
    edges.append((Aedges2[i][1]-Aedges2[i-1][1],
                  Aedges2[i][2], Aedges2[i-1][2]))

edges.sort()


class UnionFind:
    def __init__(self, n):
        self.tree = [i for i in range(n)]

    def root(self, x):
        if(self.tree[x] == x):
            return x
        self.tree[x] = self.root(self.tree[x])
        return self.tree[x]  # 経路圧縮

    def same(self, x, y):  # xとyが同じ木に属するか
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if(x == y):
            return
        self.tree[x] = y


def kruskal(n, edges):  # edges: wでソート済み
    U = UnionFind(n)
    res = 0
    for e in edges:
        w, s, t = e
        if not U.same(s, t):
            res += w
            U.unite(s, t)
    return res


print(kruskal(n, edges))


Measured memory_bytes: 56532
#include <iostream>

using namespace std;

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

  bool flag = true;
  if(a > 8 || b > 8) flag = false;
  else{
    int lnum = max(a, b);
    int snum = min(a, b);
    if( snum > (lnum-1) + (16-(2*lnum-1))/2 + 1) flag = false;

  }

  if(flag) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] f = new boolean[1000000];
		Arrays.fill(f, true);//???????????¨????´????true????????????

		/*
			for?????¨??????????????????????????§false???????´?
		*/

		for(int i=2;i<1000000;i++){
			if(f[i]){
				for(int j=i*2;j<1000000;j+=i){//j 
					f[j]=false;
				}
			}
		}//false?????????
		while(sc.hasNext()){
			int n = sc.nextInt();
			int c = 0;
			for(int i=2;i<=n;i++)c+=f[i]?1:0;//true??????1?¶???????false??????0?¶????
			System.out.println(c);
		}
	}
}

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

int main() {
    map<char, int> mp;
    for (int i = 0; i < 3; ++i) {
        char c;  cin >> c;
        ++mp[c];
    }
    cout << (mp.size() == 2 ? "Yes" : "No") << endl;
}


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

int main() {
	int a[3];
	
	cin >> a[0]>>a[1] >>a[2];
	
	sort(a, a + 3);

	cout << a[0] << " " << a[1] << " " << a[2] << endl;


	//system("pause");
		return 0;
}

Measured memory_bytes: 3124