akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int h,w;

// ll encode(int a[10][10]) {
//   ll res = 0;
//   REP(i,h)REP(j,w) res = res*3+a[i][j];
//   return res;
// }
// void decode(int a[10][10], ll e) {
//   for (int i=h-1; i>=0; --i) {
//     for (int j=w-1; j>=0; --j) {
//       a[i][j] = e%3;
//       e /= 3;
//     }
//   }
// }
typedef vector<int> vec;
typedef vector<vec> mat;

// int ba[10][10];
// int now[10][10];
// int nxt[10][10];

bool visited[10][10];

int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};

int ans;
void dfs(mat now, int d) {
  // cout << d << endl;
  // REP(i,h) {
  //   REP(j,w) cout << now[i][j];
  //   cout << endl;
  // }
    
  int col = now[0][0];
  queue<pii> Q;
  Q.push(pii(0,0));
  REP(i,h)REP(j,w)visited[i][j] = 0;
  visited[0][0] = 1;
  vector<pii> ps;
  bool ncol[3] = {};
  while(!Q.empty()) {
    pii p = Q.front(); Q.pop();
    ps.push_back(p);
    REP(i,4) {
      int y = p.first + dy[i];
      int x = p.second + dx[i];
      if (y<0||y>=h || x<0||x>=w)continue;
      if (now[y][x] != col) {
        ncol[now[y][x]] = 1;
        continue;
      }
      if (!visited[y][x]) {
        visited[y][x] = 1;
        Q.push(pii(y,x));
      }
    }
  }
  if (ps.size() == h*w) {
    ans = min(ans,d);
    return;
  }
  if (d == ans-1) return;
  REP(k,3) {
    if (ncol[k] == 0) continue;
    FOR(it, ps) {
      now[it->first][it->second] = k;
    }
    dfs(now, d+1);
  }
}

int main() {
  while(cin>>w>>h,h||w) {
    mat ba(h,vec(w));
    REP(i,h) {
      REP(j,w) {
        char c; cin >> c;
        if (c == 'R') ba[i][j] = 0;
        else if (c == 'G') ba[i][j] = 1;
        else ba[i][j] = 2;
      }
    }
    ans = 19;
    dfs(ba, 0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll lg=31;
const ll N=1e5+5;
const ll INF=3e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;

#define f first
#define s second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repp(i, a, b) for(int i = a; i > (b); --i)
#define sz(x) (int)(x).size()
#define pb push_back
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
	FASTIO;
	ld d, t, s;
	cin >> d >> t >> s;
	ld tt = d / s;
	if (tt <= t) {
	    cout << "Yes" << endl;
	}else {
	    cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>

#define MAX_DAYS 100000

using namespace std;

int main()
{
    int n, a, b, c;
    int events[MAX_DAYS][3];
    int dp[MAX_DAYS][3];

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> a >> b >> c;
        events[i][0] = dp[i][0] = a;
        events[i][1] = dp[i][1] = b;
        events[i][2] = dp[i][2] = c;
    }   

    for(int i = 1; i < n; i++)
    {
        dp[i][0] = max(dp[i-1][1] + events[i][0], dp[i-1][2] + events[i][0]);
        dp[i][1] = max(dp[i-1][0] + events[i][1], dp[i-1][2] + events[i][1]);
        dp[i][2] = max(dp[i-1][0] + events[i][2], dp[i-1][1] + events[i][2]);
    }

    cout << max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

bool solve(){
  ll n;cin>>n;
  ll m;cin>>m;
  UnionFind uf(n);
  vector<ll>p(n);
  rep(i,n){
	cin>>p[i];
	p[i]--;
  }
  rep(i,m){
	ll x,y;cin>>x>>y;x--;y--;
	uf.unite(x,y);
  }
  ll ans=0;
  rep(i,n){
	if(uf.find(p[i])==uf.find(i)){
		ans++;
	}
  }
  cout<<ans<<endl;
  return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


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

int toInt(string s)
{
	int res = 0;
	for(int i=0; i<s.size(); i++) {
		res *= 10;

		res += s[i]-'0';
	}

	return res;
}

int res,cnt;
vector<int> pat;

void solve(int T, int n, int s, vector<int>& a, string seq)
{
	if(n == seq.size()) {
		if(s == res) cnt++;
		else if(s > res) {
			cnt = 0;
			res = s;
			pat = a;
		}
	}

	for(int i=1; i<=6; i++) {
		if(seq.size() - n < i) continue;
		int num = toInt(seq.substr(n, i));
		int sum = s + num;

		if(sum > T) continue;

		a.push_back(num);
		solve(T, n+i, sum, a, seq);
		a.pop_back();
	}
}

int main()
{
	int T;
	string N;
	while(cin >> T >> N, (T||N!="0")) {
		res = -1;
		cnt = 0;
		vector<int> a;

		solve(T,0,0,a,N);

		if(res == -1) cout << "error" << endl;
		else if(cnt >= 1) cout << "rejected" << endl;
		else { 
			cout << res;
			for(int i=0; i<pat.size(); i++)
				cout << " " << pat[i];

			cout << endl;
		}
	}

}

Measured memory_bytes: 0
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val k = cin.nextInt()

    val connect = Array<MutableList<Int>>(n, { mutableListOf() })
    val parent = Array<Int>(n, { -1 })

    for (i in 0..n-2) {
        val a = cin.nextInt() - 1
        val b = cin.nextInt() - 1
        connect[a].add(b)
        connect[b].add(a)
    }

    var now = -1
    val queue: MutableList<Int> = mutableListOf(0)
    var ans: Long = k.toLong()
    var mod = 1000000007

    while (queue.size != 0) {
        now = queue.removeAt(0)
        var i = 1
        if (now != 0) {
            i += 1
        }
        for (c in connect[now]) {
            if (c != parent[now]) {
                queue.add(c)
                parent[c] = now
                ans = ans*((k - i).toLong()) % mod
                i += 1
            }
        }
    }
    println(ans)
}

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

using namespace std;


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

  vector<string> choices{"dream", "dreamer", "erase", "eraser"};
  string s;
  cin >> s;

  int p = 0;
  int n = s.size();
  if (n < 5) cout << "NO" << endl;
  else {
    while (p+5 <= n) {
      string sub = s.substr(p, 5);
      p += 5;
      if (sub == "dream") {
        if (p+2 <= n && s.substr(p, 2) == "er") {
          if (p+5 > n || (p+5 <= n && s.substr(p,5) != "erase")) {
            p += 2;
          } 
        }
      } else if (sub == "erase") {
        if (p+1 <= n && s.substr(p,1) == "r") {
          p++;
        }
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
    if (p == n) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string S;cin>>S;
    int N=S.size();
    vector<int> ans(N,1);
    REP(i,N-1){
        if(S[i]=='R'){
            if(S[i+1]=='R'){
                ans[i+2]+=ans[i];
                ans[i]=0;
            }
        }
    }
    for(int i=N-1;i>0;--i){
        if(S[i]=='L'&&S[i-1]=='L'){
            ans[i-2]+=ans[i];
            ans[i]=0;
        }
    }
    REP(i,N) cout<<ans[i]<<" \n"[i+1==N];
}


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

struct Point{double high,x,y;};

bool Intersection(Point p1,Point p2,Point p3,Point p4,Point *ret){
    double d = (p2.x-p1.x)*(p4.y-p3.y)-(p2.y-p1.y)*(p4.x-p3.x);
    double u = ((p3.x-p1.x)*(p4.y-p3.y)-(p3.y-p1.y)*(p4.x-p3.x))/d;
    double v = ((p3.x-p1.x)*(p2.y-p1.y)-(p3.y-p1.y)*(p2.x-p1.x))/d;
    if(d==0 || u<0 || u>1 || v<0 || v>1)return false;
    ret->x = p1.x+u*(p2.x-p1.x);
    ret->y = p1.y+u*(p2.y-p1.y);
    return true;
}

bool comp(Point a,Point b) {return (a.x==b.x ? a.y<b.y : a.x<b.x);}

int main(void){
    int N,n,o,l;
    cin>>N;
    while(N--){
        Point a,b;
        vector<Point> cross;
        cin>>a.x>>a.y>>b.x>>b.y>>n;
        rep(i,n){
            Point s,t;
            cin>>s.x>>s.y>>t.x>>t.y>>o>>l;
            Point ret={o==l};
            if(Intersection(a,b,s,t,&ret)){
                cross.push_back(ret);
            }
        }

        sort(cross.begin(),cross.end(),comp);
        int cnt=0;
        for(int i=0;i+1<cross.size();i++){
            cnt+=(cross[i].high!=cross[i+1].high);
        }
        cout<<cnt<<endl;
    }

    return 0;
}

Measured memory_bytes: 1260
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

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

  int n;
  cin >> n;
  vector<pair<int, int>> x(n);
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    x[i] = make_pair(v, i);
  }
  sort(x.begin(), x.end());
  vector<int> m(n);
  for (int i = 0; i < x.size(); ++i) {
    int prev = x[i].second;
    m[prev] = i;
  }

  const int mid = n / 2;
  for (int i = 0; i < n; i++) {
    if (m[i] < mid) {
      cout << x[mid].first << endl;
    } else {
      cout << x[mid - 1].first << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4608
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<math.h>
#include<utility>

using namespace std;
stack<int> st;


void DFS(vector <vector<int> > &graph,vector<int> &vis,int i){
	if(vis[i])
		return;
	vis[i]=1;
	for(int j=0;j<graph[i].size();j++)
		if(!vis[graph[i][j]])
			DFS(graph,vis,graph[i][j]);
	st.push(i);
}

int main(){
	int n,m,a,b;
	cin>>n>>m;
	vector<int> vis(n+1,0);
	vector <vector<int> > graph(n+1);
	for(int i=0;i<m;i++){
		cin>>a>>b;
		graph[a].push_back(b);
	}
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			DFS(graph,vis,i);
		}
	}
	fill(vis.begin(),vis.end(),0);
	vector<int> dp(n+1,0);
	while(!st.empty()){
		int top = st.top();
		st.pop();
		for(int i=0;i<graph[top].size();i++){
			if(dp[graph[top][i]]<dp[top]+1)
				dp[graph[top][i]]=dp[top]+1;
		}
	}
	int maxe = 0;
	for(int i=1;i<n+1;i++){
		maxe = max(maxe,dp[i]);
	}
	cout<<maxe;
}

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

typedef pair<int, int> pii;

#define F first
#define S second
#define pb push_back

const int inf = 2e9;
const int N = 2010;

int n, k;
vector<int> g[N];
pii edges[N];

void dfs(int v, int &res, int p = -1, int d = 0) {
	if (d > k / 2) res++;
	for (int to: g[v])
		if (to != p) dfs(to, res, v, d + 1);
}

int get(int x) {
	int res = 0;
	dfs(x, res);
	return res;
}

int getEdge(int x) {
	int res = 0;
	dfs(edges[x].F, res, edges[x].S);
	dfs(edges[x].S, res, edges[x].F);
	return res;
}

int main() {
	cin >> n >> k;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		edges[i] = {a, b};
		g[a].pb(b);
		g[b].pb(a);
	}	
	int ans = inf;
	if (k % 2 == 0) {
		for (int i = 1; i <= n; i++)
			ans = min(ans, get(i));
	} else {
		for (int i = 1; i < n; i++)
			ans = min(ans, getEdge(i));
	}
	cout << ans;
}


Measured memory_bytes: 3856
from sys import stdin

# 標準入力の受取
# sdi = stdin.readline().rstrip()
# a, b, c = stdin.readline().rstrip().split()
# a, b, c = [x for x in stdin.readline().rstrip().split()]
a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
v = 0
while b - a >= 0:
    b = b - a
    v += 1
    if v == c:
        break

print(v)


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

//const int mxH = 10, mxW = 1e3;
//int h, w, k, ans = 1e9;
//string g[mxH];
//vector<int> v[mxW];

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

	ll K, N;
	cin >> K >> N;
	ll Ai, A0, Aprev;
	cin >> A0;
	Aprev = A0;
	ll dist = 0;
	for (ll i = 1; i < N; i++) {
		cin >> Ai;
		if (dist < Ai - Aprev) {
			dist = Ai - Aprev;
		}
		Aprev = Ai;
	}
	if (dist < A0 + (K - Ai)) {
		dist = A0 + (K - Ai);
	}
	cout << K - dist << endl;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,x;cin>>k>>x;
  vector<int>v;
  	for(int i=x-k+1;i<=x-1;i++)
     {
     	cout<<i<<" ";
     }
  	cout<<x<<" ";
  	
  	for(int i=x+1;i<x+k;i++){
    	cout<<i<<" ";
    }
}

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

int const NMAX = 100000;
int n;
int h[NMAX];
int dp[NMAX];

void read() {
  std::cin >> n;
  for(int i = 0; i < n; ++i) std::cin >> h[i];
}

inline int abs(int x) { return x<0? -x: x; }

void calc() {
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  for(int i=2; i<n; ++i) {
    dp[i] = std::min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
  }
}

int main() {
  read();
  calc();
  std::cout << dp[n-1] << std::endl;
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e10;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double



////////////////////////////////////////////////////////////////////

template<typename T>
struct edge {
  int to, from;T cost;
  edge(int to) : from(-1), to(to), cost(-1) {}
  edge(int to, T cost) : from(-1), to(to), cost(cost) {}
  edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};
template<typename T>
using edges = vector<edge<T>>;
template<typename T>
using graph = vector<edges<T>>;
template<typename T>
using matrix = vector<vector<T>>;

template<typename T>
bool compByCost(const edge<T>& left, const edge<T>& right){
  return left.cost < right.cost; 
}

vector<int> prevn(1100);

template<typename T>
vector<T> dijkstra(int s, graph<T> &g){
  vector<T> dist(g.size()+10, INF);dist[s] = 0;rep(i,1100)prevn[i] = -1;prevn[s] = INF;
  priority_queue<P, vector<P>, greater<P>> que;que.push(P(0,s));
  while(!que.empty()){
    P p = que.top();que.pop();
    int v = p.second;
    if(dist[v] < p.first)continue;
    rep(i, g[v].size()){
      edge<T> e = g[v][i];
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        prevn[e.to] = v;
        que.push(P(dist[e.to], e.to));
      }
    }
  }
  return dist;
}

#define dijkstra dijkstra<int>

////////////////////////////////////////////////////////////////////


int n,m;graph<int> g(1100), h(1100);
vector<int> d1, d2;

signed main(){
  cin>>n>>m;
  rep(i,m){
    int a,b;cin>>a>>b;a--;b--;
    g[a].push_back(edge<int>(b, 1));
    h[b].push_back(edge<int>(a, 1));
  }
  int ans = INF, from, to;
  rep(i,n){
    d1 = dijkstra(i, g);
    d2 = dijkstra(i, h);
    
    rep(j,n){
      if(i == j)continue;
      if(chmin(ans, d1[j]+d2[j])){
        from = i;to = j;
      }
    }
  }
  if(ans == INF){
    cout << -1 << endl;return 0;
  }
  dijkstra(from, g);
  stack<int> st;st.push(to);
  queue<int> ret;
  while(prevn[st.top()] != INF){
    st.push(prevn[st.top()]);
  }
  while(!st.empty()){
    ret.push(st.top()+1);st.pop();
  }
  dijkstra(to, g);st.push(from);
  while(prevn[prevn[st.top()]] != INF){
    st.push(prevn[st.top()]);
  }
  while(!st.empty()){
    ret.push(st.top()+1);st.pop();
  }
  cout << ret.size()-1 << endl;
  while(ret.size()>1){
    cout << ret.front() << endl;ret.pop();
  }
}


Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
constexpr ll mod = 1000000007;

pair<ll, ll> extgcd(ll a, ll b) {
    if (b == 0) return make_pair(a, 0);
    auto t = extgcd(b, a % b);
    return make_pair(t.second, t.first - t.second * (a / b));
}

ll inv_mod(ll n) {
    ll t = extgcd(n, -mod).first;
    return ((t % mod) + mod) % mod;
}

ll cmb(ll n, ll k) {
    ll r = 1;
    for (ll i = 1; i <= k; i++) {
        r = (r*inv_mod(i)) % mod;
        r = (r * (n - (i - 1))) % mod;
    }
    return r;
}

ll pow2(ll n) {
    if(n == 0) return 1;
    ll t = pow2(n/2);
    if(n % 2) {
        return (t * t * 2) % mod;
    } else return (t * t) % mod;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll r = pow2(n);
    r = ((r - (cmb(n, a) + cmb(n, b))) + mod * 4) % mod;
    cout << r - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int h, w;
struct indata
{
    vector<int> masme;
    int inh, inw;
};
vector<int> dx;
vector<int> dy;

int main() {
    cin >> h >> w;
    vector< vector < int > > s(h, vector<int>(w, 0));
    vector< vector < bool > > sb(h, vector<bool>(w, false));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            char ins;
            cin >> ins;
            if(ins == '#') {
                s.at(i).at(j) = -1;
            }else {
                s.at(i).at(j) = ins - '0';
            }
        }
    }

    dx.push_back(0);
    dx.push_back(1);
    dx.push_back(0);
    dx.push_back(-1);
    dy.push_back(-1);
    dy.push_back(0);
    dy.push_back(1);
    dy.push_back(0);

    indata first;
    first.masme.push_back(5);
    first.masme.push_back(3);
    first.inh = 0;
    first.inw = 0;
    queue<indata> que;
    que.push(first);
    sb.at(first.inh).at(first.inw) = true;

    bool flg = false;
    int ue = 0;
    int migi = 0;
    int sita = 0;
    int hidari = 0;
    while(!que.empty()) {
        indata exe = que.front();
        que.pop();
        if(exe.inh == h-1 && exe.inw == w-1) {
            flg = true;
            break;
        }else {
            int under = s.at(exe.inh).at(exe.inw);
            for(int i = 0; i < 4; ++i) {
                int nex = exe.inw + dx.at(i);
                int ney = exe.inh + dy.at(i);
                if(nex >= 0 && nex < w && ney >= 0 && ney < h && s.at(ney).at(nex) != -1 && (!sb.at(ney).at(nex))) {
                    ue = exe.masme.at(0); migi = exe.masme.at(1);
                    sita = 7-ue; hidari = 7-migi;
                    vector<int> check;
                    check.push_back(ue);
                    check.push_back(migi);
                    check.push_back(sita);
                    check.push_back(hidari);
                    if(s.at(ney).at(nex) == check.at(i)) {
                        indata next;
                        next.inh = ney;
                        next.inw = nex;
                        sb.at(ney).at(nex) = true;
                        if(i == 0) {
                            next.masme.push_back(7-under);
                            next.masme.push_back(check.at(1));
                        }else if(i == 1) {
                            next.masme.push_back(check.at(0));
                            next.masme.push_back(7-under);
                        }else if(i == 2) {
                            next.masme.push_back(under);
                            next.masme.push_back(check.at(1));
                        }else {
                            next.masme.push_back(check.at(0));
                            next.masme.push_back(under);
                        }
                        que.push(next);
                    }
                }
            }
        }
    }
    if(flg) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  int keta=log10(n)+1;
  int N=n;
  int t;
  for(int i;i<keta;i++){
    t+=n%10;
    n/=10;
  }
  if(N%t==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f first 
#define s second
int32_t main(){
     int n;
     cin>>n;
     int arr[n];
     int dp[100006]={0};
     int sum = 0;
     for(int i = 0 ; i < n;i++){
         cin>>arr[i];
         sum += arr[i];
         dp[arr[i]]++;
     }
     int q;
     cin>>q;
     while(q--){
           int x , y;
           cin>>x>>y;
        //   cout<<"x : "<<x<<" y : "<<y<<endl;
        //   cout<<"dp[x]: "<<dp[x]<<" "<<endl;
           sum += (y*dp[x] - dp[x]*x);
           dp[y] += dp[x];
           dp[x] =0;
           cout<<sum<<endl;
     }
     
    
}

Measured memory_bytes: 5152
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll a;
    cin >> a;
    ll ans = 0;
    if(a <= 599){
        ans = 8;
    } else if(a <= 799){
        ans = 7;
    }else if(a <= 999){
        ans = 6;
    }else if(a <= 1199){
        ans = 5;
    }else if(a <= 1399){
        ans = 4;
    }else if(a <= 1599){
        ans = 3;
    }else if(a <= 1799){
        ans = 2;
    } else {
        ans = 1;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
S = input()

l = 0
for x in S[::-1]:
	if x == ")":
		l += 1
	elif x == "(" and 0 < l:
		l -= 1
r = 0
for x in S:
	if x == "(":
		r += 1
	elif x == ")" and 0 < r:
		r -= 1

print("("*l + S + ")"*r)



Measured memory_bytes: 10440
// ALDS1_6_B.cpp
// Sort II - Partition

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

int Partition(vector<int>& A, int p, int r)
{
	int tmp = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++) {
		if (A[j] <= tmp) {
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[++i], A[r]);
	return i;
}

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	int pivot = Partition(A, 0, n - 1);
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		if (i == pivot) printf("[%d]", A[i]);
		else cout << A[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int k = 0;
    int count = 0;
    vector<int>gusu;
    vector<int>kisu;
    cin >> k;
    for (int i = 0; i < k; ++i) {
        if (i % 2== 0){
            gusu.push_back(i);
        } else {
            kisu.push_back(i);
        }
    }
    for (int j = 0; j < gusu.size(); ++j) {
        for (int i = 0; i < kisu.size(); ++i) {
            count++;
        }
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 256
#方針 最短経路以外を黒に塗れば良い
#最短経路が複数あってもその時通る白マスの数は不変なので、黒く塗れる白マスの数も不変である。
#したがって最短経路を求め(この時+1が実際に通る白マスの数になる)元々の白マスの数から
#最短経路+1を減算すれば答えは求まることになる。

from collections import deque

H,W = map(int,input().split())
maze = [list(input()) for _ in range(H)]

white_panel_cnt = 0
for y in range(H):
    for x in range(W):
        if maze[y][x] == '.':
            white_panel_cnt += 1
que = deque()

#スタート位置は(1,1)※list的には(0,0)になっている
sx,sy,gx,gy = (0,0,W-1,H-1)
que.append((sx,sy))
distance_from_start = [[-1]*W for _ in range(H)]
distance_from_start[sy][sx] = 0
move = [[1,0],[-1,0],[0,1],[0,-1]]

def minimum_distance():
    while len(que) != 0:
        x,y = que.popleft()
        #for i in range(len(distance_from_start)):
            #print(distance_from_start[i])
        if x == gx and y == gy:
            return distance_from_start[y][x]
        for i in range(4):
            next_x = x + move[i][0]
            next_y = y + move[i][1]
            #print(next_x,next_y)
            if next_x < 0 or next_x >= W or next_y < 0 or next_y >= H or distance_from_start[next_y][next_x] != -1 or maze[next_y][next_x] == '#':
                continue
            #print(distance_from_start[y][x])
            distance_from_start[next_y][next_x] = distance_from_start[y][x] + 1
            que.append((next_x,next_y))
        #for i in range(len(distance_from_start)):
            #print(distance_from_start[i])

distance = minimum_distance()
#print('distance={}'.format(distance))
if distance == None:
    score = -1
else :
    score = white_panel_cnt-(distance+1)

print(score)


Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[1000010];int a[1000010];
int main(){
	scanf("%s",s);int n=strlen(s),i,j,sum=0,k;
	for(i=1;i<=n;i++) a[i]=(s[n-i]-'0')*9;
	for(i=1;i<=n;i++){
		a[i+1]+=a[i]/10;a[i]%=10;
	}
	if(a[n+1]) n++;
	for(i=1;i<=n;i++) sum+=a[i];
	for(k=1;k<=n*10;k++){
		a[1]+=9;sum+=9;
		j=1;
		while(j<=n){
			if(a[j]<10) break;
			sum-=10;a[j]-=10;
			sum++;a[j+1]++;
			j++;
			if(j==n&&a[j+1]) n++;
		}
		if(sum<=9*k){
			printf("%d\n",k);return 0;
		}
	}
}

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

int main(){
	bool exists['z'-'a'+1];
	string S;
	cin >> S;
	for(int i='a';i<='z';i++){
		exists[i-'a']=false;
	}
	for(const auto& c : S){
		if(exists[c-'a']){
			cout << "no" << endl;
			return 0;
		}else{
			exists[c-'a']=true;
		}
	}
	cout << "yes" << endl;
	return 0;
}


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

#define ll long long
using namespace std;
 
int main(){
    int n; string s;
    cin>>n>>s;
    for(size_t i = 0; i < s.length(); ++i){
        if(s.at(i) <= 'Z'-n){s[i]+= n;}
      else{s[i]+=n-26;}
    }
    cout <<s<< endl;
}

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

int main(void) {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		ans += (a-1);
	}
	cout << ans << endl;
  return 0;
}


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

using namespace std;

// using ll = long long;
// using P = pair<int, int>;
// using minpq = priority_queue<int, vector<int>, greater<int> >;

int main() {
    while (true) {
        long n, i, j;
        cin >> n >> i >> j;
        if (n == 0) break;
        long pow = 1;
        for (int id=0; id<n; id++) pow *= 2;
        bool up[n];
        for (int id=n-1; id>=0; id--) {
            up[id] = (i <= pow/2); 
            if (i > pow / 2) 
                i -= pow/2;
            else 
                i = pow/2 - i + 1;
            pow /= 2;
        }
        pow = 1;
        for (int id = 0; id < n; id++) pow *= 2;
        for (int id=0; id<n; id++) {
            if (j > pow / 2 && up[id]) {
                cout << 'R';
                j = pow - j + 1;
            } else if (j > pow / 2 && !up[id]) {
                cout << 'L';
                j = j - pow/2;
            } else if (up[id]) {
                cout << 'L';
                j = pow / 2 - j + 1;
            } else {
                cout << 'R';
            }
            pow /= 2;
        }
        cout << '\n';
    }
    return 0;
}



Measured memory_bytes: 2952
Scanf.scanf "%d" (fun q ->
    let isprime =
        let p = Array.init 100001 (fun i -> if i < 2 then 0 else i) in
        let rec loop_i i =
            let rec loop_j j =
                if j > 100000 then loop_i (i + 1) else (
                    p.(j) <- 0; loop_j (j + i)
                )
            in
            if i * i <= 100000 then loop_j (i * i)
        in
        loop_i 2;
        (fun i -> p.(i) <> 0)
    in
    let b = Array.init 100001 (fun i ->
        if i mod 2 = 0 then 0 else
        if isprime i && isprime ((i + 1) / 2) then 1 else 0
    )
    in
    let a = Array.make 100001 0 in
    let rec loop j =
        if j < 100000 then (a.(j) <- a.(j - 1) + b.(j); loop (j + 1))
    in
    loop 1;

    for i = 1 to q do
        Scanf.scanf " %d %d" (fun l r -> Printf.printf "%d\n" @@ a.(r) - a.(l - 1))
    done
)

Measured memory_bytes: 8356
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

int main(){
    int d,l,r,rta=0;
    cin >> l >> r >> d;
    for(int i=l;i<=r;i++){
        if(i%d==0) rta++;
    }
    cout << rta << endl;
    return 0;
}



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

int main(void){
  int N;
  long int power = 1;
  cin >> N;
  for(int i = 1; i <= N; i++){
    power *= i;
    if(power > pow(10.0, 9.0) + 7){
      power = power % ((long int)pow(10.0, 9.0) + 7);
    }
  }
  cout << power << endl;
  return 0;
}


Measured memory_bytes: 256
def multi_chain_multiplication(n, P):
    M = [[0]*(n+1) for _ in range(n+1)]

    if n > 1:
        for l in range(2, n+1):
            for i in range(1, n-l+2):
                j = i + l - 1
                M[i][j] = float('inf')
                for k in range(i, j):
                    M[i][j] = min(M[i][j], M[i][k] + M[k+1][j] + P[i-1] * P[k] * P[j])
        return M[i][j]
    else:
        return 0

def read_and_print_min_multiplication(n):
    P = [0] * (n+1)
    for i in range(n):
        A = [int(i) for i in input().split()]
        if i == 0:
            P[i] = A[0]
            P[i+1] = A[1]
        else:
            P[i+1] = A[1]
    print(multi_chain_multiplication(n, P))

n = int(input())
read_and_print_min_multiplication(n)


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

typedef long long ll;

int main() { 
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = 0;
	for (ll i = 1; i <= n; ++i) {
		ll p = i;
		ll sum = 0;
		while (p > 0) {
			sum += p % 10;
			p /= 10;
		}
		if (sum >= a && sum <= b) {
			ans += i;
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
   int n,i,r=0;
   int c[50]={},v[50]={};
   cin >> n;
    for(i=0;i<n;i++){
        cin >> v[i];
    }
        for(i=0;i<n;i++){
        cin >> c[i];
    }
    for(i=0;i<n;i++){
        v[i]-=c[i];
        if(v[i]>0)r+=v[i];
    }
    printf("%d\n",r);
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<ll,ll> P;

char c;
ll n;

void rian(ll a){
	string aa = to_string(a);
	string bb = to_string(n);
	if((a < n && aa < bb) || (a > n && aa > bb))c = 'Y';
	else c = 'N';
	cout << c << endl;
}

void ixmel(ll l) {
	ll r = l * 10;
	while(r - l > 1){
		ll mid = (l + r) / 2;		
		cout << "? " << mid * 10 << endl;
		cin >> c;
//		rian(mid * 10);
		if(c == 'Y')r = mid;
		else l = mid;
	}
	cout << "! " << r << endl;
}

void valuna() {
	ll out = 100000000;
	while(1){
		cout << "? " << out << endl;
		cin >> c;
//		rian(out);
		if(c == 'Y'){
			ixmel(out);
			return;
		}
		out /= 10;
	}
}

void seica(){
	ll out = 2;
	REP(i, 10){
		cout << "? " << out << endl;
		cin >> c;
//		rian(out);
		if(c == 'Y'){
			cout << "! " << out / 2 << endl;
			return;
		}
		out *= 10;
	}
}

int main(){
	
	cout << "? 1000000000" << endl;
	cin >> c;
//	rian(1000000000);
	if(c == 'Y')seica();
	else valuna();
	
	return 0;
}


Measured memory_bytes: 596
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << P + Q + R - max({P, Q, R}) << "\n";
}

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

int main()
{
	char a, b, c;
	int i = 2;
	int flag = 0;
	cin >> a;
	cin >> b;
	if (a == b) {
		cout << 1 << ' ' << 2 << endl;
		return 0;
	}
	while (cin >> c) {
		if (b == c) {
			flag = 1;
			break;
		}
		else if (a == c) {
			flag = 2;
			break;
		}
		a = b;
		b = c;
		i++;
	}
	if (flag == 1) {
		cout << i << ' ' << (i + 1) << endl;
	}
	else if (flag == 2) {
		cout << (i - 1) << ' ' << (i + 1) << endl;
	}
	else {
		cout << -1 << ' ' << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define REP(x,b) for(int x=0;x<b;x++)
#define FORSIZE(x,A) for(int x=0;x<A.size();x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define SORT(x) sort(x.begin(),x.end())
#define RSORT(x) sort(x.rbegin(),x.rend())
#define rsort(x,n) sort(x, x+n, greater<int>())
#define REV(x) reverse(x.begin(),x.end())
using namespace std;
typedef long long ll;
inline int toInt(std::string s) {int v; std::istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {std::ostringstream sout;sout<<x;return sout.str();}

int main( int argc, const char* argv[] )
{
    int n;
    int a, b, c;
    cin >> n;
    REP(i, n) {
        cin >> a >> b >> c;
        if ((a*a+b*b==c*c) || (a*a+c*c==b*b) || (b*b+c*c==a*a)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>
#include <sstream>
typedef long long ll;

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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}
/*
ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}*/
vector<ll> v(100005);
vector<ll> vis(100005, 0); ll c = 0, check = 0;
queue<ll>que;
/*void bfs(ll a, ll src) {
	vis[a] = src;
	que.push(src);
	while (!que.empty()) {
		src = que.front();
		for (ll x = 1; x <= v[src];x++) {
			if (vis[x] == 0) {
				c++;
				vis[x] = src;
				que.push(x);
			}
		}
		que.pop();
	}
}*/
int main() {
	ll a;
	string b;
	cin >> a >> b;
	int p = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
	ll res = a * p / 100;
	cout << res << endl;
}

Measured memory_bytes: 4680
N, T = map(int, input().split())
lst = []
ans = 10 ** 6
for _ in range(N):
    cost, time = map(int, input().split())
    if time <= T:
        ans = min(ans, cost)
if ans < 10 ** 6:
    print(ans)
else:
    print('TLE')


Measured memory_bytes: 2940
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long long ll;
typedef long double ld;

const int inf = (int) 1e9 + 100;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 505;
int n, m;
char c[maxn][maxn], a[maxn][maxn], b[maxn][maxn];

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

void solve() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      a[i][j] = '.';
      b[i][j] = '.';
    }
  }
  for (int i = 0; i < n; i++) {
    a[i][0] = '#';
    b[i][m - 1] = '#';
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (i & 1) {
        a[i][j] = '#';
      }
      else {
        b[i][j] = '#';
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j] == '#') {
        a[i][j] = '#';
        b[i][j] = '#';
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%s\n", a[i]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("%s\n", b[i]);
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen("text.in", "r", stdin));
  assert(freopen("text.out", "w", stdout));
#endif

  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time: %.18f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n, m, l, a, b, c, q, s, t;
    int g1[333][333], g2[333][333];
    cin>>n>>m>>l;
    rep(i, n){
        rep(j, n){
            g1[i][j] = g2[i][j] = INF;
        }
    }
    rep(i, m){
        cin>>a>>b>>c;
        a--, b--;
        g1[a][b] = g1[b][a] = c;
    }
    rep(i, n){
        rep(j, n){
            rep(k, n){
                chmin(g1[j][k], g1[j][i] + g1[i][k]);
                if(g1[j][k] <= l){
                    g2[j][k] = 1;
                }
            }
        }
    }
    rep(i, n){
        rep(j, n){
            rep(k, n){
                chmin(g2[j][k], g2[j][i] + g2[i][k]);
            }
        }
    }
    cin>>q;
    rep(i, q){
        cin>>s>>t;
        s--, t--;
        cout<<((g2[s][t]==INF)?0:g2[s][t]) - 1<<endl;
    }
}


Measured memory_bytes: 2176
inf = 10**15
mod = 10**9+7
n,m = map(int, input().split())
h = list(map(int, input().split()))
judge = [1 for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    if h[a-1] > h[b-1]:
        judge[b-1] = 0
    elif h[b-1] > h[a-1]:
        judge[a-1] = 0
    else:
        judge[b - 1] = 0
        judge[a - 1] = 0
print(sum(judge))

Measured memory_bytes: 85028
#include<bits/stdc++.h>
#define ll          long long
#define dl          double
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main(){
	string t,s;cin>>t>>s;
	ll f[26]={0};
	vector<ll> v[26];
	for(ll i=0;i<t.size();i++){
		v[t[i]-'a'].push_back(i);
	}
	for(ll i=0;i<s.size();i++){
		if(v[s[i]-'a'].size()==0)return cout<<"-1",0;
	}
	ll inx=0;
	ll n=t.size();
	//cout<<n<<endl;
	ll c=0;
	for(ll i=0;i<s.size();i++){
		ll c=inx-f[s[i]-'a'];
		//cout<<"c "<<inx<<endl;
		ll x=lower_bound(all(v[s[i]-'a']),c)-v[s[i]-'a'].begin();
		//cout<<"x "<<x<<" "<<v[s[i]-'a'].size()<<endl;
		
		if(x==v[s[i]-'a'].size()){
			for(ll j=0;j<26;j++)f[j]+=n;		
			//cout<<"f[s[i]-'a'] "<<f[s[i]-'a']<<endl;
			inx=f[s[i]-'a']+v[s[i]-'a'][0]+1;
			//cout<<"inx1 "<<inx<<endl;
		}
		else{
			//cout<<"f[s[i]-'a'] "<<f[s[i]-'a']<<endl;						
			inx=f[s[i]-'a']+v[s[i]-'a'][x]+1;
			//cout<<"inx2 "<<inx<<endl;			
		}
	}
    cout<<inx<<endl;
}

Measured memory_bytes: 1724
#include <iostream>
using namespace std;
int main() {

	int a, b, c, count=0;

	cin >> a >> b >> c;

	for (int i = a; i <= b; i++) {
		if (c%i == 0) {
			count++;
		}
	}

	cout << count << "\n";

	return 0;
}

Measured memory_bytes: 1164