akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//https://www.youtube.com/watch?v=RDaGj_ztNz4&feature=youtu.be

//-----CODE------//


void solve(void)
{
  int n,k;
  cin>>n>>k;
  vector<int> vec (n,0);
  for (int i = 0; i < n; i++)
  {
     cin>>vec[i];
  }
  sort(ALL(vec));
  int l = -INF,r = INF;
  while(l + 1 < r){
    int mid = (l + r)/2;
    bool ok = [&]{
      int tot = 0;
      for (int i = 0; i < n; i++)
      {
        if(vec[i] < 0)
        {
          //minus
          int l = -1,r = n;
          while(l + 1 < r){
            int c = (l + r)/2;
            if(vec[c]*vec[i] < mid) r = c;else l = c;
          }
          tot += n - r;

        }
        else
        {
          //plus
          int l = -1,r = n;
          while(l + 1 < r){
            int c = (l + r)/2;
            if(vec[c]*vec[i] < mid) l = c;else r = c;
          }
          tot += r;
        }
        if(vec[i]*vec[i] < mid)tot--;
        
      }
      tot /= 2;
      return tot < k;
    }();
    if(ok) l = mid; else  r = mid;
  }
  cout<<l<<endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 4716
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = Integer.valueOf(scan.next());
        int[] ns = new int[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        boolean fg = true;
        int change = 0;
        int cnt=0;
        while(fg) {
        	fg = false;
        	for(int i=n-1;i>0;i--) {
        		if(ns[i] < ns[i-1]) {
        			change =  ns[i];
        			ns[i] = ns[i-1];
        			ns[i-1] = change;
        			cnt++;
        			fg=true;
        		}
        	}
        }
        for(int i=0;i<n-1;i++) {
        	System.out.print(ns[i]+" ");
        }
        System.out.println(ns[n-1]);
        System.out.println(cnt);
        scan.close();
    }
}


Measured memory_bytes: 26364
#include <iostream>
#include <vector>
#include <cfenv>
#include <cmath>
using namespace std;

int main() {
    while(1) {
        int n;
        cin >> n;
        if(n == 0) break;

        vector<float> step(3);
        step[0] = 1;
        step[1] = 2;
        step[2] = 4;

        for(int i = 3; i < n; i++) {
        int count = step[i-3] + step[i-2] + step[i-1];   
        step.push_back(count);
        }

        cout << ceil(step[n-1]/10/365) << endl;
        step.clear();
    }

return 0;
}


Measured memory_bytes: 3232
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    string S;
    cin >> S;

    ll jj = 0;

    rep(i, S.size()-1) {
        if (S[i] == S[i + 1]) {
            if (S[i + 1] == '0') { S[i + 1] = '1'; ++jj; }
            else if (S[i + 1] == '1') { S[i + 1] = '0'; ++jj; }
        }
    }

    cout << jj << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n, k ;
    cin >> n >> k ;
    vector<int> p(n), c(n) ;
    rep(i, n) cin >> p[i] ;
    rep(i, n) cin >> c[i] ;
    rep(i, n) p[i]-- ;
    ll ans =  -1e18 ;
    rep(si, n){
        int x = si ;
        vector<int> s; 
        ll tot = 0 ;
        while(1){
            x = p[x] ;
            s.push_back(c[x]) ;
            tot += c[x] ;
            if(x == si){
                break ;
            }
        }
        int l = s.size() ;
        ll now = 0 ;
        ll t = 0 ;
        rep(i, l){
            t += s[i] ;
            if(i + 1 > k){
                break;
            }
            ll now = t ;
            if(tot > 0){
                ll e = (k - i -1)/l ;
                now += tot*e ;
            }
            ans = max(ans, now) ;
        }
    } 
    cout << ans << endl ;
} 

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int x[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>x[i];
	}
	int ans=10000000,now;
	for (int i = 1; i <= 100; ++i)
	{
		now=0;
		for (int j = 0; j < n; ++j)
		{
			now+=(x[j]-i)*(x[j]-i);
		}
		ans=min(ans,now);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int d,u,n,l,gun;
int main()
{
	cin >>n>>l;
	d=l;
	u=n+l-1;
	if(d<=0&&u>=0)
	gun=0;
	else if(u<0)
	gun=u;
	else
	gun=d;
	cout <<(d+u)*n/2-gun<<endl;
	return 0;
}

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

void print_elements(int length, int elements[]) {
    cout << elements[0];
    for (int i = 1; i < length; i++) {
        cout << " " << elements[i];
    }
    cout << endl;
}

// Return how many times elements were swapped.
int bubble_sort(int N, int elements[]) {
    int n_swapped = 0;
    bool swapped  = true;

    while (swapped) {
        swapped = false;
        for (int i = N - 1; i > 0; i--) {
            int i_before = i - 1;
            if (elements[i] < elements[i_before]) {
                int bigger = elements[i_before];
                elements[i_before] = elements[i];
                elements[i] = bigger;
                swapped = true;
                n_swapped++;
            }
        }
    }
    return n_swapped;
}

/* ALDS1_2_A: Bubble Sort */
int main() {
    int N;
    cin >> N;

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

    int n_swapped = bubble_sort(N, elements);

    print_elements(N, elements);
    cout << n_swapped << endl;
    return 0;
}

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

using namespace std;

const int MXD = 1e3 + 10;

int n, d;
int large[MXD + MXD][MXD + MXD], cntlarge;
int small[MXD + MXD][MXD + MXD], cntsmall;
int cnt[MXD][MXD];

int sumlarge(int sx, int sy, int ex, int ey)
{
	if (sx == 0 && sy == 0)
	{
		return large[ex][ey];
	}
	if (sx == 0)
	{
		return large[ex][ey] - large[ex][sy - 1];
	}
	if (sy == 0)
	{
		return large[ex][ey] - large[sx - 1][ey];
	}
	return large[ex][ey] - large[ex][sy - 1] - large[sx - 1][ey] + large[sx - 1][sy - 1];
}

int sumsmall(int sx, int sy, int ex, int ey)
{
	if (sx == 0 && sy == 0)
	{
		return small[ex][ey];
	}
	if (sx == 0)
	{
		return small[ex][ey] - small[ex][sy - 1];
	}
	if (sy == 0)
	{
		return small[ex][ey] - small[sx - 1][ey];
	}
	return small[ex][ey] - small[ex][sy - 1] - small[sx - 1][ey] + small[sx - 1][sy - 1];
}

bool check(int x)
{
	bool flag;
	for (int i = 0; i < d; i++)
	{
		for (int j = 0; j < d; j++)
		{
			flag = true;
			int tmp = sumlarge(i, j, i + x, j + x); 
			if (tmp < cntlarge)
			{
				flag = false;
			}
			if (sumsmall(0, j, d - 1, j + x) + sumsmall(i, 0, i + x, d - 1) - sumsmall(i, j, i + x, j + x) < cntsmall)
			{
				flag = false;
			}
			if (flag)
				return true;
		}
	}
	return false;
}

int main ()
{
	scanf("%d%d", &n, &d);
	memset(cnt, 0, sizeof(cnt));
	for (int i = 1; i <= n; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		cnt[x % d][y % d]++;
	}

	int maxcnt = 0;
	for (int i = 0; i < d; i++)
	{
		for (int j = 0; j < d; j++)
		{
			maxcnt = max(maxcnt, cnt[i][j]);
			// cout << cnt[i][j] << " ";
		}
		// cout << endl;
	}

	int a = ceil(sqrt(maxcnt)) - 1;
	cntlarge = cntsmall = 0;
	memset(small, 0, sizeof(small));
	memset(large, 0, sizeof(large));
	for (int i = 0; i < d; i++)
	{
		for (int j = 0; j < d; j++)
		{
			if (cnt[i][j] <= a * (a + 1) && cnt[i][j] > a * a)
			{
				small[i][j] = true;
				cntsmall++;
			}
			else if (cnt[i][j] > a * (a + 1))
			{
				large[i][j] = true;
				cntlarge++;
			}
		}
	}
	for (int i = 0; i < d + d; i++)
		for (int j = 0; j < d + d; j++)
			if (!(i < d && j < d))
			{
				small[i][j] = small[i % d][j % d];
				large[i][j] = large[i % d][j % d];
			}
	for (int i = 0; i < d + d; i++)
		for (int j = 0; j < d + d; j++)
		{
			if (i > 0 && j > 0)
			{
				small[i][j] = small[i - 1][j] + small[i][j - 1] - small[i - 1][j - 1] + small[i][j];
				large[i][j] = large[i - 1][j] + large[i][j - 1] - large[i - 1][j - 1] + large[i][j];
			}
			else if (i > 0)
			{
				small[i][j] = small[i - 1][j] + small[i][j];
				large[i][j] = large[i - 1][j] + large[i][j];
			}
			else if (j > 0) 
			{
				small[i][j] = small[i][j - 1] + small[i][j];
				large[i][j] = large[i][j - 1] + large[i][j];
			}
		}

	// cout << "large = " << cntlarge << endl;
	// cout << "small = " << cntsmall << endl;
	int l = 0, r = d - 1, mid;
	if (check(0))
	{
		r = 0;
	}
	else
	{
		while (l < r - 1)
		{
			mid = l + r >> 1;
			if (check(mid))
			{
				r = mid;
			}
			else
			{
				l = mid;
			}
		}  
	}
	printf("%d", a * d + r);
	return 0;
}

Measured memory_bytes: 36096
n, x = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
A.sort()

for i in range(n):
    if x > A[i] and i != n - 1:
        x = x - A[i]
        ans = ans + 1
    elif x == A[i]:
        ans = ans + 1
        break
    else:
        break

print(ans)

Measured memory_bytes: 3064
def main():
    import sys
    input = sys.stdin.readline

    n, q = map(int, input().split())

    g = [set() for _ in range(n)]
    for _ in range(n - 1):
        a, b = (int(x) - 1 for x in input().split())
        g[a].add(b)
        g[b].add(a)

    ctr = [0] * n
    for _ in range(q):
        it = map(int, input().split())
        p = next(it) - 1
        x = next(it)
        ctr[p] += x

    st = [0]
    used = [0] * n
    used[0] = 1
    while st:
        v = st.pop()
        for u in g[v]:
            if used[u]: continue
            used[u] = 1
            ctr[u] += ctr[v]
            st.append(u)
    print(*ctr)


if __name__ == '__main__':
    main()


Measured memory_bytes: 80600
//In the Name of God
//Ya Ali

#include <bits/stdc++.h>

#define lng long long

#define err(A) cout << #A << " = " << (A) << endl

using namespace std;

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

  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i ++)
    cout << s[i] << t[i];
  cout << endl;
  
  return 0;
}


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

char a[26];
int num[26];
main()
{
	cin >> a;
	for(int i=0;a[i]!='\0';i++)
	{
		num[a[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(num[i]>1)
		{
			cout << "no";
			return 0;
		}
	}
	cout << "yes";
}

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

using namespace std;

int fre[30];

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

    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        fre[s[0]-'A']++;
    }

    vector<int> v;
    for(int i = 0; i < 30; i++)
        v.push_back(fre[i]);

    sort(v.rbegin(), v.rend());

    int ans = 0;
    while(v[k-1] != 0){
        ans++;
        for(int i = 0; i < k; i++){
            v[i]--;
        }
        sort(v.rbegin(), v.rend());
    }

    cout << ans << endl;

    return 0;
}

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


def getDiv(n):
    count = 0
    for i in range(2, n // 2 + 1):
        if n % i == 0:
            count += 1
            # print("{}:{}, count:{}".format(n, i, count))
    return count


count = 0
for i in range(1, N + 1):
    if (i % 2 != 0) and (getDiv(i) == 8-2):
        count += 1

print(count)


Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
    int W,H;
    cin>>H>>W;
    vector<string> vec(H);
    for(int i=0;i<H;++i){
        cin>>vec[i];
    }

    for(auto &x:vec){
        cout<<x<<endl;
        cout<<x<<endl;
    }

}



Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(s: Vec<char>) -> u64 {
    use std::collections::HashMap;

    let n = s.len() / 2;
    let ls = s.iter().take(n).cloned().collect::<Vec<char>>();
    let rs = s.iter().rev().take(n).cloned().collect::<Vec<char>>();

    let mut map: HashMap<(String, String), (u64, u64)> = HashMap::new();

    for i in 0..(1 << n) {
        let mut red = Vec::new();
        let mut blue = Vec::new();

        for j in 0..n {
            if (i >> j) & 1 == 1 {
                red.push(ls[j]);
            } else {
                blue.push(ls[j]);
            }
        }
        let key = (red.into_iter().collect::<String>(),
                   blue.into_iter().collect::<String>());

        if map.contains_key(&key) {
            let (v1, v2) = map[&key];
            map.insert(key, (v1+1, v2));
        } else {
            map.insert(key, (1, 0));
        }
    }

    for i in 0..(1 << n) {
        let mut red = Vec::new();
        let mut blue = Vec::new();

        for j in 0..n {
            if (i >> j) & 1 == 1 {
                red.push(rs[j]);
            } else {
                blue.push(rs[j]);
            }
        }
        let key = (red.into_iter().collect::<String>(),
                   blue.into_iter().collect::<String>());

        if map.contains_key(&key) {
            let (v1, v2) = map[&key];
            map.insert(key, (v1, v2+1));
        }
    }

    let mut ret = 0;
    for &(v1, v2) in map.values() {
        ret += v1 * v2;
    }

    ret
}

fn main() {
    read_line!();

    let s = read_line!();

    println!("{}", solve(s.chars().collect()));
}

#[test]
fn solve_test() {
    assert_eq!(solve("cabaacba".chars().collect()), 4);
    assert_eq!(solve("mippiisssisssiipsspiim".chars().collect()), 504);
    assert_eq!(solve("abcdefgh".chars().collect()), 0);
    assert_eq!(solve("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".chars().collect()), 9075135300);
}


Measured memory_bytes: 65696
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = int64_t;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];

vec<ll> ans, tmp;
stack<ll> st;
vec<ll> g[114514];
ll h[114514];

signed main(){
	IOS;
	ll V, E;
	cin >> V >> E;
	REP(i, E){
		ll s, t;
		cin >> s >> t;
		g[s].push_back(t);
		h[t]++;
	}
	REP(i, V){
		if(h[i] == 0)st.push(i);
	}
	while(!st.empty()){
		ll i = st.top();
		st.pop();
		ans.push_back(i);
		for(auto& j : g[i]){
			h[j]--;
			if(h[j] == 0)st.push(j);
		}
	}
	for(auto& i : ans)dump(i);
}


Measured memory_bytes: 6412
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : September 19, 2020 6:12 PM
 *    Problem Name  : C - A x B + C
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc179/tasks/abc179_c
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
#define ll long long int 
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);

    ll n,cnt=0;
    cin >> n;

    n = n - 1;

    for(ll i=1; i<=n; i++) {
        for(ll j=1; j<=n; j++) {
            if(i*j <= n) cnt++;
            else if(i*j > n) {
                break;
            }
        }
    }

    cout << cnt << endl;

    return 0 ;
}


Measured memory_bytes: 3644
S = input()

if S[0]==S[1]==S[2]=="R":
    print(3)
elif S[0]==S[1]=="R" or S[1]==S[2]=="R":
    print(2)
elif S[0]=="R" or S[1]=="R" or S[2]=="R":
    print(1)
else:
    print(0)


Measured memory_bytes: 9108
object Main extends App {
  @scala.annotation.tailrec
  def loop(ints: Seq[Int], count: Int, rest: Int): Int = ints match {
    case Seq(x) => if (x == rest) count + 1 else count
    case x :: xs if x <= rest => loop(xs, count + 1, rest - x)
    case _ => count
  }
  val sc = new java.util.Scanner(System.in)
  val n, x = sc.nextInt()
  val ints = List.fill(n)(sc.nextInt()).sorted
  println(loop(ints, 0, x))
}

Measured memory_bytes: 55384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
    string res="";
    rep(i,tx-sx) res.push_back('R');
    rep(i,ty-sy) res.push_back('U');
    rep(i,tx-sx) res.push_back('L');
    rep(i,ty-sy) res.push_back('D');
    res.push_back('D');
    rep(i,tx-sx+1) res.push_back('R');
    rep(i,ty-sy+1) res.push_back('U');
    res.push_back('L');
    res.push_back('U');
    rep(i,tx-sx+1) res.push_back('L');
    rep(i,ty-sy+1) res.push_back('D');
    res.push_back('R');

    cout<<res<<endl;
    return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  for (ll i = 0; i < N; i++) {
    char c; cin >> c;
    if (c == 'Y') {
      cout << "Four\n";
      return 0;
    }
  }
  cout << "Three\n";

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>

using namespace std;

struct Pos {
    int r, c;

    Pos() {}
    Pos(int r, int c) : r(r), c(c) {}
};

inline int toidx(char c) {
    return c - 'A';
}

inline int sign(int n) {
    if(n == 0) return 0;
    return n < 0 ? -1 : 1;
}

inline int dist(const Pos &p1, const Pos &p2) {
    return abs(p1.r-p2.r) + abs(p1.c-p2.c);
}

int main() {
    ios::sync_with_stdio(0);

    int R, C;
    cin >> R >> C;

    vector<string> v;
    vector<vector<Pos> > pos(26);
    for(int i = 0; i < R; ++i) {
        string line;
        cin >> line;

        for(int j = 0; j < line.size(); ++j) {
            if(isalpha(line[j])) {
                pos[toidx(line[j])].push_back(Pos(i, j));
            }
        }

        v.push_back(line);
    }

    int score = 0;
    vector<int> used(26, 0);
    while(true) {
        bool modified = false;

        for(int i = 0; i < pos.size(); ++i) {
            if(used[i]) continue;
            if(pos[i].size() == 0) continue;

            const Pos &p1 = pos[i][0];
            const Pos &p2 = pos[i][1];
            if(dist(p1, p2) == 1) continue;

            int r1 = p1.r;
            int c1 = p2.c;
            bool ok = true;
            for(int c = c1; c != p1.c; c += sign(p1.c-c)) {
                if(v[r1][c] != '.' && v[r1][c] != i+'A') ok = false;
            }
            for(int r = r1; r != p2.r; r += sign(p2.r-r)) {
                if(v[r][c1] != '.' && v[r][c1] != i+'A') ok = false;
            }
            if(!ok) {
                int r2 = p2.r;
                int c2 = p1.c;
                ok = true;
                for(int c = c2; c != p2.c; c += sign(p2.c-c)) {
                    if(v[r2][c] != '.' && v[r2][c] != i+'A') ok = false;
                }
                for(int r = r2; r != p1.r; r += sign(p1.r-r)) {
                    if(v[r][c2] != '.' && v[r][c2] != i+'A') ok = false;
                }
            }

            if(ok) {
                score += 2;
                v[p1.r][p1.c] = v[p2.r][p2.c] = '.';
                used[i] = true;
                modified = true;
            }
        }

        if(!modified) break;
    }

    cout << score << endl;

    return 0;
}

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

int main() {
  int A;  //最小の整数
  int B;  //最大の整数
  
  cin >> A >> B;  //入力
  
  int X1, X2, X3, X4, X5;  //各桁の整数
  int num = 0;  //回文数の個数
  
  for (int i = A; i <= B; i++){
    //X1 ~ X5を求める
    X1 = i % 10;
    X5 = i / 10000;
    X2 = ( i / 10 ) % 10;
    X4 = ( i / 1000) % 10;
    
    
    //回文数かどうかチェック
    if (X1 == X5 && X2 == X4){
   	  num += 1;
    }
  }
  //出力
  cout << num << endl;
}


Measured memory_bytes: 256
# ARC064C - Boxes and Candies (ABC048C)
def main():
    n, x = map(int, input().rstrip().split())
    A = list(map(int, input().rstrip().split()))

    # modify A[0] if >x
    ans = 0 if A[0] < x else A[0] - x
    A[0] = min(A[0], x)
    
    prv = A[0]
    for i in range(1, n):
        dif = prv + A[i] - x
        if dif > 0:
            A[i] -= dif
            ans += dif
        prv = A[i]
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14152
n=int(input())
v_list=[int(i) for i in input().split()]
c_list=[int(i) for i in input().split()]
total_list=[]

for i in range(n):
    total_list.append(v_list[i]-c_list[i])
    
total_list.sort(reverse=True)
#print(total_list)

sum=0
for i in total_list:
    if i>0:
        sum+=i
    else:
        break
    
print(sum)

Measured memory_bytes: 9188
/************************Code by Hardik Aggarwal!!!!***********************************/

#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;


int main()
{	
	IOS
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(ll i=0;i<n;++i)
		cin>>a[i];


	ll dp[k+1];
	dp[0]=0;
	for(ll i=1;i<=k;i++)
	{	
		dp[i]=0;
		for(ll j=0;j<n;j++)
		{
			if(i-a[j]>=0)
			{
				if(dp[i-a[j]]==0)
				{
					dp[i]=1;
					break;
				}
			}
		}
	}


	if(dp[k]==1)
	{
		cout<<"First";
	}
	else
		cout<<"Second";
}
    
 
    
    


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

void tate_yose(vector<vector<int> >& origami, int h_shift) {
    for (int i = 0; i < origami.size() - h_shift; i++) {
        for (int j = 0; j < origami[i].size(); j++) {
            origami[i][j] = origami[i + h_shift][j];
        }
    }
}

void yoko_yose(vector<vector<int> >& origami, int w_shift) {
    for (int i = 0; i < origami.size(); i++) {
        for (int j = 0; j < origami[i].size() - w_shift; j++) {
            origami[i][j] = origami[i][j + w_shift];
        }
    }
}

void tate_ori(vector<vector<int> >& origami, int c) {
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < origami[i].size(); j++) {
            origami[2 * c - i - 1][j] += origami[i][j];
            origami[i][j] = 0;
        }
    }
    tate_yose(origami, c);
}

void yoko_ori(vector<vector<int> >& origami, int c) {
    for (int i = 0; i < origami.size(); i++) {
        for (int j = 0; j < c; j++) {
            origami[i][2 * c - j - 1] += origami[i][j];
            origami[i][j] = 0;
        }
    }
    yoko_yose(origami, c);
}

void solve(int n, int m, int t, int p) {
    vector<vector<int> > origami(3 * m + 3, vector<int>(3 * n + 3, 0));
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) origami[i][j] = 1;
    }
    int d, c;
    for (int i = 0; i < t; i++) {
        cin >> d >> c;
        if (d == 1) yoko_ori(origami, c);
        else tate_ori(origami, c);
    }
    int x, y;
    vector<int> ans(p);
    for (int i = 0; i < p; i++) {
        cin >> x >> y;
        ans[i] = origami[y][x];
    }
    for (int i = 0; i < p; i++) cout << ans[i] << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, T, P;
    while (true) {
        cin >> N >> M >> T >> P;
        if (N == 0 && M == 0 && T == 0 && P == 0) break;
        solve(N, M, T, P);
    }
    return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, n;
    cin >> a >> b >> n;
    if(b == 1){
    	cout << 0 << endl;
    	return 0;
    }
    if(n >= b-1){
    	ll num = a * (b-1);
    	cout << num/b << endl;
    	return 0; 
    }
    cout << a*n/b << endl;
    return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
int main(){
  int a,result;
  while(1){
  scanf("%d",&a);

  if(1>a || a>100){
    continue;

  }else{
      break;
  }
  }
  result = a * a * a;

  printf("%d\n",result);

  return 0;
}

Measured memory_bytes: 2736
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int32_t main(){_
   
   cin>>n;

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

   int ans = 0;
   for(auto it: M){
      ans += ((it.S) * (it.S-1)) / 2;
   }
   
   tr(ans);
   int tmp = ans;
   for (int i = 0; i < n; ++i)
   {
      ans -= (M[a[i]]) * (M[a[i]] - 1) / 2;
      M[a[i]]--;
      ans += (M[a[i]]) * (M[a[i]] - 1) / 2;
      cout<<ans<<endl;
      M[a[i]]++;
      ans = tmp;
   }

   return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,a,b;
	cin>>n>>a>>b;
	vector<ll> ans(n);
	if(a*b<n) {
		cout<<-1<<endl;
		return 0;
	}
	if(a+b>n+1) {
		cout<<-1<<endl;
		return 0;
	}
	vector<ll> cut(b);
	ll nokori=n;
	REP(i,b) {
		if(nokori>b-1-i) {
			cut[i]=min(a,nokori-(b-1-i));
			nokori-=cut[i];
		}
	}
	ll sum=0;
	ll idx=0;
	REP(i,b) {
		REP(j,cut[i]) {
			ans[idx]=n-sum-(cut[i]-1-j);
			idx++;
		}
		sum+=cut[i];
	}
	DUMP(ans);
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << '=' << x << '\n'
const long long MOD=1e9+7;
//const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?'\n':' ');
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    vector<int> H(N); cin >> H;
    vector<int> check(N,1);
    for (int i=0;i<M;++i){
        int A,B; cin >> A >> B; --A,--B;
        if (H[A]<=H[B]) check[A]=0;
        if (H[B]<=H[A]) check[B]=0;
    }
    int ans=accumulate(check.begin(),check.end(),0);
    cout << ans << '\n';
}

Measured memory_bytes: 3992
def solve():
    import sys
    s = list(map(int, sys.stdin.read().split()))
    x, y, z = s[0] + s[4] + s[8], s[1] + s[5] + s[6], s[2] + s[3] + s[7]
    if x == y == z:
        print("Yes")
    else:
        print("No")


solve()


Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a; cin >> a;
    string s; cin >> s;
    ll b = 0;
    rep(i,0,s.size()){
        if(s[i]=='.') continue;
        b *= 10;
        b += ctoi(s[i]);
    }
    a *= b;
    a /= 100ll;
    cout << a << endl;
}


Measured memory_bytes: 3680
n,k = map(int,input().split())
x = list(map(int,input().split()))
res = 10**9
for i in range(n-k+1):
    a = x[i]
    b = x[i+k-1]
    res = min(res,abs(a)+abs(a-b),abs(b)+abs(b-a))
print(res)

Measured memory_bytes: 14392
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
const int N=55556;
vector<int> isprime(N,1);
vector<int> prime;
void  solve(){
	rep(i,2,N){
		for(int j=2*i;j<N;j+=i) isprime[j]=0;
	}
	rep(i,2,N) if(isprime[i]) prime.pb(i);
	int n,i=0;
	cin>>n;
	while(n>0 && i<prime.size()){
		if(prime[i]%5==1) cout<<prime[i]<<" ",n--;
		i++;
	}
	cout<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3668
n = int(input())
abc = [list(map(int,input().split())) for _ in range(n)]

dp = [[0 for _ in range(3)] for _ in range(n+1)]

for i in range(1,n+1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i][k] = max(dp[i][k],dp[i-1][j] + abc[i-1][k])

ans = 0
for i in range(3):
    ans = max(ans,dp[n][i])
print(ans)

Measured memory_bytes: 74840
#include <iostream>
#include <algorithm>
#include <cctype>
#include <string>
using namespace std;

int main() {
  string s;
  getline(cin,s);

  for (int i=0; i<s.length(); i++) {
    s[i] = toupper(s[i]);
  }
  cout << s<< endl;
}

Measured memory_bytes: 0
import math
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
A = [0]*(10**3)
mod = 10**9+7
for i in range(2,N+1):
    for j in factorization(i):
        A[j[0]-1] += j[1]
ans = 1
for a in A:
    if a != 0:
        ans *= a+1
print(ans%mod)

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

int main(){
  int n;string s;cin>>n>>s;
  ll r=0,g=0,b=0,ans;
  REP(i,n){
    if(s.at(i)=='R') r++;
    else if(s.at(i)=='G') g++;
    else b++;
  }
  ans=r*g*b;
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      if(s.at(i)!=s.at(j)){
        int k=2*j-i;
        if((k<n)&&(s.at(j)!=s.at(k))&&(s.at(k)!=s.at(i))) ans--;
      }
    }
  }

  cout<<ans;
}


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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(A) A.begin(), A.end()
#define SZ(A) (ll)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 1e6;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h, a;
	cin >> h >> a;
	if (h % a == 0) cout << h / a << "\n";
	else cout << (h / a + 1) << "\n";
 	return 0;
}

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

ll n, m, w[109], v[109], dp[109][100009];

ll call(ll pos, ll make)
{
    if(make == 0)
        return 0;
    if(pos == n)
        return INT_MAX;
    if(dp[pos][make] != -1)
        return dp[pos][make];

    dp[pos][make] = call(pos+1, make);
    if(make >= v[pos])
        dp[pos][make] = min(call(pos+1, make), call(pos+1, make - v[pos]) + w[pos]);

    return dp[pos][make];
}

int main()
{
    ll i, j, sum = 0, ans = 0;
    cin >> n >> m;
    for(i = 0; i < n; i++)
    {
        cin >> w[i] >> v[i];
        sum += v[i];
    }

    memset(dp, -1, sizeof dp);

    for(i = 1; i <= sum; i++)
    {
        if(call(0, i) <= m)
            ans = max(ans, i);
    }

    cout << ans;
}


Measured memory_bytes: 85504
#include<iostream>

using namespace std;

int f(int N)
{
	if (N<0)
		return 0;
	else if (N==0)
		return 1;
	return f(N-4)+f(N-7);
}

int main()
{
	int n;
	cin>>n;
	if (f(n))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
k=int(input())
a=[]
def judge(x):
    if x> 3234566667:
        return
    a.append(x)
    for i in range(10):
        if abs(x%10-i)<=1:
            judge(x*10+i)

for i in range(1,10):
    judge(i)

a.sort()
print(a[k-1])

Measured memory_bytes: 7616
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define MOD 1000000007

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

    ll A;
    double b;
    cin>>A>>b;
    ll B = llround(b*100);
    cout<<(A*B)/100LL;
}

Measured memory_bytes: 3768
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  int n,m,i,j,t;
  string s;
  cin>>n>>s;
  int east[n],west[n];
  east[0]=(s[0]=='E'?1:0);
  for(i=1;i<n;i++)
  {
  	if(s[i]=='E')
  		east[i]=east[i-1]+1;
  	else
  		east[i]=east[i-1];
  }
  west[n-1]=(s[n-1]=='W'?1:0);
  for(i=n-2;i>=0;i--)
  {
  	if(s[i]=='W')
  		west[i]=west[i+1]+1;
  	else
  		west[i]=west[i+1];
  }
  for(i=0;i<n;i++)
  {
  	if(s[i]=='E')
  		east[i]--;
  	else if(s[i]=='W')
  		west[i]--;
  }
  int ans=1000000;
  
  for(i=0;i<n;i++)
  {	
  	if(i==0)
  		ans=min(ans,n-1-west[i]);
  	else if(i==n-1)
  		ans=min(ans,n-1-east[i]);
  	else
  		ans=min(ans,n-1-west[i]-east[i]);
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 2948
#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)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    multiset<int> st;
    rep(i, N) {
       auto itr = st.lower_bound(A[i]);
       if (itr == st.begin()) {
           st.insert(A[i]);
       } 
       else {
           itr--;
           st.erase(itr);
           st.insert(A[i]);
       }
    }

    cout << (int)st.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <cstdio>

const int maxn = 2e5;
int n, a[maxn + 3];

bool check(int x) {
	for (int i = 0; i <= n - 1; i++) {
		if ((a[n - i] < x && a[n - i - 1] < x) || (a[n + i] < x && a[n + i + 1] < x)) {
			return false;
		}
		if ((a[n - i] >= x && a[n - i - 1] >= x) || (a[n + i] >= x && a[n + i + 1] >= x)) {
			return true;
		}
	}
	return a[1] >= x;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= 2 * n - 1; i++) {
		scanf("%d", &a[i]);
	}
	int l = 1, r = 2 * n - 1, mid;
	while (l < r) {
		mid = (l + r + 1) / 2;
		if (check(mid)) {
			l = mid;
		} else {
			r = mid - 1;
		}
	}
	printf("%d\n", l);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define pb push_back
#define int long long int
#define mod 1000000007
#define inf (1LL<<60)
#define f(i,a,b) for (int i= a; i <b; ++i)
using namespace std;

int fact[200005];
int inv[200005];

int power(int a,int n)
{
    if(n==0)
        return 1;
    if(n%2==0)
        return power((a*a)%mod,n/2);
    else
        return (a*power((a*a)%mod,n/2))%mod;
}

int preprocess()
{
    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<=200005;i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
        inv[i]=power(fact[i],mod-2);
    }
}

int nCrmod(int n,int r)
{
    return (fact[n]*((inv[n-r]*inv[r])%mod))%mod;
}

int path(pair<int,int> a,pair<int,int> b)
{
    if(a.first<=b.first&&a.second<=b.second)
    {
        int down=b.first-a.first;
        int right=b.second-a.second;
        return nCrmod(right+down,down);
    }
    return 0;
}

int solve(int h,int w,vector<pair<int,int>> v)
{
    int ways=path({1,1},{h,w});
    vector<int> pathobs;
    pathobs.pb(path({1,1},v[0]));
    for(int i=1;i<v.size();i++)
    {
        int paths=path({1,1},v[i]);
        for(int j=i-1;j>=0;j--)
        {
            paths=(mod+paths-((pathobs[j]*path(v[j],v[i]))%mod))%mod;
        }
        pathobs.pb(paths);
    }
    for(int i=0;i<pathobs.size();i++)
    {
        ways=(mod+ways-((pathobs[i]*path(v[i],{h,w}))%mod))%mod;
    }
    return ways;
}

bool comp(pair<int,int> p1,pair<int,int> p2)
{
    return (p1.first+p1.second<p2.first+p2.second);
}

signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    preprocess();
    int h,w,n;
    cin>>h>>w>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end(),comp);
    cout<<solve(h,w,v);
}



Measured memory_bytes: 3584
#include <iostream>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N = 1e6 + 10;
using namespace std;
string s1,s2,u;
int a,b;
int main() {
  ios::sync_with_stdio(false);
  cin>>s1>>s2>>a>>b>>u;
  if(u==s1)   a--;
  else  b--;
  cout<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int   n = sc.nextInt();
        
        int[] h = new int[n+1];
        
        h[0] = Integer.MIN_VALUE;
        for (int i = 1; i <= n; i++) {
            h[i] = sc.nextInt();
        }
        
        for (int i = n/2; i >= 1; i--) {
            maxHeapify(h, i);
        }
        for (int i = 1; i <= n; i++) {
            System.out.print(" " + h[i]);
        }
        System.out.println();
    }
    
    static void maxHeapify(int[] h, int idx) {
        int n = h.length - 1;
        int l = l(idx);
        int r = r(idx);
        int maxNodeIdx = 0;
        if (l <= n && h[l] > h[idx]) {
            maxNodeIdx = l;
        } else {
            maxNodeIdx = idx;
        }
        if (r <= n && h[r] > h[maxNodeIdx]) {
            maxNodeIdx = r;
        }
        if (maxNodeIdx != idx) {
            int temp = h[idx];
            h[idx]        = h[maxNodeIdx];
            h[maxNodeIdx] = temp;
            maxHeapify(h, maxNodeIdx);
        }
    }
    
    static int l(int i) {
        return 2*i;
    }
    static int r(int i) {
        return 2*i + 1;
    }
}


Measured memory_bytes: 168068
#include <bits/stdc++.h>
using namespace std;
int n;
int a[200009];
int b[200009];
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i],b[i]=a[i];
    sort(b,b+n);
    for(int i=0;i<n;i++){
        if(a[i] == b[n-1]) cout<<b[n-2]<<endl;
        else cout<<b[n-1]<<endl;
    }
}       


Measured memory_bytes: 3200