akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s; cin >> s;
    vll lr(s.size()); // ->
    vll rl(s.size()); // <-
    ll lcnt = 0, rcnt = 0;
    rep(i, s.size() - 1) {
        if (s[i] == 'R') lcnt++;
        if (s[i] == 'R' && s[i + 1] == 'L') lr[i] = lcnt, lcnt = 0;
        if (s[s.size() - i - 1] == 'L') rcnt++;
        if (s[s.size() - i - 2] == 'R' && s[s.size() - i - 1] == 'L') rl[s.size() - i - 1] = rcnt, rcnt = 0;
    }
/*     cout << "lr: ";
    for (auto elem : lr) cout << elem << " "; cout << endl;
    cout << "rl: ";
    for (auto elem : rl) cout << elem << " "; cout << endl;
 */    vll nums(s.size(), 0);
    rep(i, s.size() - 1) {
        if (lr[i] == 0) continue;
        ll l = lr[i];
        ll r = rl[i + 1];
        if (l % 2 == 1) {
            nums[i] += (l + 1) / 2;
            nums[i + 1] += l / 2;
        } else {
            nums[i] += l / 2;
            nums[i + 1] += l / 2;
        }
        if (r % 2 == 1) {
            nums[i] += r / 2;
            nums[i + 1] += (r + 1) / 2;
        } else {
            nums[i] += r / 2;
            nums[i + 1] += r / 2;
        }
    }
    for (auto elem : nums) cout << elem << " "; cout << endl;
    
    return 0;
}

Measured memory_bytes: 3072
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
  int T, X;
  while (cin >> T >> X) {
    double res = (double)T / X;
    printf("%.20f\n", res);
  }
  return 0;
}


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

const double INF = DBL_MAX / 10;

int main()
{
    int n;
    cin >> n;
    vector<int> t(n), v(n);
    for(int i=0; i<n; ++i)
        cin >> t[i];
    for(int i=0; i<n; ++i)
        cin >> v[i];

    vector<double> dp(101, -INF);
    dp[0] = 0.0;
    for(int i=0; i<n; ++i){
        for(int j=0; j<t[i]; ++j){
            vector<double> nextDp(101, -INF);
            for(int k=0; k<=v[i]; ++k){
                nextDp[k] = max(nextDp[k], dp[k] + k);
                if(k < v[i]){
                    nextDp[k] = max(nextDp[k], dp[k] + k + 0.25);
                    nextDp[k+1] = max(nextDp[k+1], dp[k] + k + 0.5);
                }
                if(k > 0)
                    nextDp[k-1] = max(nextDp[k-1], dp[k] + k - 0.5);
            }
            dp.swap(nextDp);
        }
    }
    printf("%.10f\n", dp[0]);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    if (y < x) {
        swap(x, y);
        swap(a, b);
    }
    int pa = c * x * 2 + b * (y - x), pb = a * x + b * y, pc = c * y * 2;
    int min = pa;
    if (pb < min) min = pb;
    if (pc < min) min = pc;
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h,w,k;
    cin>>h>>w>>k;
    char arr[6][6];
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=0;j<w;j++){
            arr[i][j]=s[j];
        }
    }
    // . white # black K black left
    vector<string> row;
    vector<string> col;
    for(int i=0;i<(1<<h);i++){
        int p=i;
        string s="";
        for(int j=0;j<h;j++){
            if((p&1)==0){
                s+="0";
            }
            else
                s+="1";
            p/=2;
        }
        row.pb(s);
    }
    for(int i=0;i<(1<<w);i++){
        int p=i;
        string s="";
        for(int j=0;j<w;j++){
            if((p&1)==0){
                s+="0";
            }
            else
                s+="1";
            p/=2;
        }
        col.pb(s);
    }
    int ans=0;
    for(int i=0;i<row.size();i++){
        for(int j=0;j<col.size();j++){
            string p=row[i];
            string q=col[j];
            int count=0;
            for(int a=0;a<h;a++){
                for(int b=0;b<w;b++){
                    if(arr[a][b]=='#' && p[a]=='0' && q[b]=='0'){
                        count+=1;
                    }
                }
            }
            if(count==k){
                ans+=1;

            }

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


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using static System.Console;

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	Dictionary<string, int> d = new Dictionary<string, int>();

	long ans = 0;
	for (int i = 0; i < n; i++)
	{
	    string s = ReadLine();
	    char[] t = new char[s.Length];
	    for (int j = 0; j < s.Length; j++)
	    {
		t[j] = s[j];
	    }
	    Array.Sort(t);
	    string s2 = new string(t);

	    if (d.ContainsKey(s2))
	    {
		int x = d[s2];
		ans += x;
		d[s2] = x + 1;
	    }
	    else
	    {
		d.Add(s2, 1);
	    }
	}
	WriteLine(ans);
    }
}


Measured memory_bytes: 31192
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long l = sc.nextLong();
    long r = sc.nextLong();
    
    r   = Math.min(r, l+2019);
    long min = 2018;
    for(long i = l; i <= r; i++)
      for(long j = i+1; j <= r; j++)
          min = Math.min(min, i*j%2019);
    System.out.println(min); 
  }
}

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

int main(){
    int N,M;
    cin >> N >> M ;
    vector<int> L(N);
    vector<int> R(N);
    rep(i,N){
        cin >> L.at(i);
    }
    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        R.at(a) = max(L.at(b),R.at(a));
        R.at(b) = max(L.at(a),R.at(b));
    }
    int ans = 0;
    rep(i,N){
        if(R.at(i) < L.at(i)){
            ans ++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    double ans=a[0];
    for(int i=1;i<n;i++)
        ans=(ans+a[i])/2;
    printf("%.10f\n",ans);
    return 0;
}


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

using namespace std;

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

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;

const double EPS = 1e-10;

const int INF = 1000*1000*1000;
const int N = 500000;
const int M = 20;
int n, m;
int dp[M+1][N+1];
int c[N+1];

int main() {
  int i, j, k;
  scanf("%d%d ", &n, &m);
  for (i=0; i<m; i++)
    scanf("%d ", c+i+1);

  for (i=0; i<=m; i++)
    for (j=0; j<=n; j++)
      dp[i][j] = INF;

  for (j=0; j<=n; j++)
    if (!(j%c[1])) dp[1][j] = j/c[1];

  for (i=2; i<=m; i++)
    for (j=0; j<=n; j++) {
      if (j-c[i]<0)
        dp[i][j] = dp[i-1][j];
      else
        dp[i][j] = min(dp[i-1][j], dp[i][j-c[i]]+1);
    }
  printf("%d\n", dp[m][n]);

	return 0;
}

Measured memory_bytes: 40396
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int H,W;
		String work[] = new String[2];

		while(true){

			try {
				work = br.readLine().split("[\\s]+");

				if(work[0].equals("0") && work[1].equals("0"))break;

				H = Integer.parseInt(work[0]);
				W = Integer.parseInt(work[1]);

				StringBuilder ans = new StringBuilder();

				for(int row = 0; row < H; row++){
					for(int col = 0; col < W; col++){
						if((row+col)%2 == 0){
							ans.append("#");
						}else{
							ans.append(".");
						}
					}
					ans.append("\n");
				}

				System.out.println(ans.toString());


			} catch (IOException e) {

				e.printStackTrace();
			}
		}
	}
}





Measured memory_bytes: 25724
N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
pq = [list(map(int, input().split())) for _ in range(Q)]

XY = [[0 for _ in range(N)] for _ in range(N)]
for l, r in LR:
    XY[l - 1][r - 1] += 1

for i in range(N):
    for j in range(N):
        if i == 0 and j == 0:
            pass
        elif i == 0:
            XY[i][j] += XY[i][j - 1]
        elif j == 0:
            XY[i][j] += XY[i - 1][j]
            pre_im1_j = XY[i - 1][j]
        else:
            if XY[i - 1][j] == pre_im1_j:
                XY[i][j] += XY[i][j - 1]
            else:
                XY[i][j] += XY[i][j - 1] + XY[i - 1][j] - pre_im1_j
                pre_im1_j = XY[i - 1][j]

for p, q in pq:
    if p != 1:
        print(XY[q - 1][q - 1] + XY[p - 2][p - 2] - XY[p - 2][q - 1] - XY[q - 1][p - 2])
    else:
        print(XY[q - 1][q - 1])



Measured memory_bytes: 77196
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n) {
    cin >> a >> b;
    sum += a * b;
    cnt += b;
  }
  ans = cnt - 1;
  sum -= 9;
  sum = max(sum, 0LL);
  ans += (sum + 8) / 9;
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3652
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

using namespace std;

const ll MOD = 1000000007;

ll modpow(ll a, int b) {
    if(b == 0) return 1LL;
    else {
        if(b&1) return modpow(a, b-1)*a%MOD;
        else {
            ll k = modpow(a, b/2);
            return k*k%MOD;
        }
    }
}

int main() {
    int n; cin >> n;
    if(n == 1) cout << 0 << endl;
    else {
        ll ans = modpow(10, n) - modpow(9, n)*2 + modpow(8, n);
        cout << (ans+MOD*5)%MOD << endl;
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

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


int main(){
    int k, x;
    cin >> k >> x;
    if( k * 500 >= x){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

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

int main(){
	
	char S[100010],T[100010],revS[100010],dream[]="maerd",dreamer[]="remaerd",erase[]="esare",eraser[]="resare";
	int i,moji=0,count;
	
	
	scanf("%s",S);
	
	for(i=1;i<=strlen(S);i++){
		
		revS[i-1]=S[strlen(S)-i];
		
	}
	
	
	
	while(moji<strlen(S)){
	count=0;
	
	for(i=0;i<5;i++){
		
		if(revS[moji+i]!=dream[i]){
		break;
		}
		if(i==4){
		count=1;
		
	}
	}
	for(i=0;i<7;i++){
		if(revS[moji+i]!=dreamer[i]){
		break;
		}
		if(i==6){
		count=2;
		
	}
	}
	for(i=0;i<5;i++){
		
		if(revS[moji+i]!=erase[i]){
		break;
		}
		if(i==4){
		count=3;
		
	}
	}
	for(i=0;i<6;i++){
		
		if(revS[moji+i]!=eraser[i]){
		break;
		}
		if(i==5){
		count=4;
		
	}
	}
	if(count==0){
		printf("\nNO\n\n");
		return 0;
	}else if(count==1){
		moji+=5;
	}else if(count==2){
		moji+=7;
	}else if(count==3){
		moji+=5;
	}else if(count==4){
		moji+=6;
	}
	}
	
	
	
	printf("\nYES\n\n");
	
	
	return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main() {
  int n, m, *s, *a, i, t, p;
  long long sum = 0;
  cin >> n >> m;
  s = new int [n];
  a = new int [m];
  s[0] = 0;
  for(i = 1; i < n; i++) {
    cin >> t;
    s[i] = s[i-1] + t;
  }
  p = 0;
  for(; m > 0; m--) {
    cin >> t;
    sum += t < 0 ? s[p] - s[p+t] : s[p+t] - s[p];
    p += t;
  }
  cout << sum%100000 << endl;
  return 0;
}

Measured memory_bytes: 1568
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;	//using vi = vector<int>;

#define rep(i, N) for (int i = 0; i < N; i++)

int main()
{
	int a, b, n;
	cin >> n >> a >> b;
	
	if (a*n >= b)cout << b << endl;
	else cout << a * n << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	//xとyの距離
	int d=0;
	
	//1匹目のトンボxの位置
	int x=0;
	
	//2匹目のトンボyの位置
	int y=0;
	
	//2匹のトンボの位置を入力(x y)
	scanf("%d %d",&x,&y);
	
	/*↓xとyの距離（絶対値）を算出*/
	
	//xの位置の大きさがy以上の時
	if(x>=y)
	{
		d=x-y;
	}
	
	//yの位置の大きさがxより大きいとき
	else
	{
		d=y-x;
	}
	
	/*距離の算出終了*/
	
	//xとyの距離を表示
	printf("%d\n",d);
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define F first
 #define S second
#define PB push_back
#define MP make_pair
#define ll long long int


using namespace std;

int main()
{
 	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	if(s == "ARC") cout << "ABC\n";
	else cout << "ARC\n";
return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
string S; cin >> S;
map <string, int> D;
D["SUN"]=7;D["MON"]=6;D["TUE"]=5;D["WED"]=4;D["THU"]=3;D["FRI"]=2;D["SAT"]=1;
cout << D[S] << "\n";
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int a, b;

int main(void){
    cin >> a >> b;
    rep(i, 10000){
        int x = i+1;
        if((a <= 0.08*x) && (0.08*x < a+1) && (b <= 0.10*x) && (0.10*x < b+1)){
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio> 
#include <iostream>
using namespace std;
const int N=3010,mo=1e9+7;
int n,m,f[N][N],mx[N],sum[N];
int main()
{
    scanf("%d%d\n",&n,&m);
    for (int i=1;i<=n;i++) sum[i]=getchar()-'0';
    for (int i=1;i<=n+1;i++) sum[i]+=sum[i-1];
    for (int i=1;i<=n+1;i++) mx[i]=i;
    for (int i=1,x,y;i<=m;i++) scanf("%d%d",&x,&y),mx[x]=max(mx[x],y);
    for (int i=1;i<=n;i++) mx[i]=max(mx[i],mx[i-1]) ;
    f[1][sum[mx[1]]]=1;
    for (int i=1,l,r,x,y;i<=n;i++) for (int j=0;j<=n;j++) if (f[i][j])
	{
    	l=mx[i]+1,r=mx[i+1],x=j,y=mx[i]-i+1-j;
        if (y) (f[i+1][j+sum[r]-sum[l-1]]+=f[i][j])%=mo;
        if (x) (f[i+1][j-1+sum[r]-sum[l-1]]+=f[i][j])%=mo;
    }
    printf("%d\n",f[n+1][0]);
}

Measured memory_bytes: 33920
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int H = stdIn.nextInt();
		int W = stdIn.nextInt();
		stdIn.nextLine();
		String[] C = new String[H];
		for(int i=0;i<H;i++){
			C[i] = stdIn.nextLine();
		}
		for(String Ci :C){
			System.out.println(Ci);
			System.out.println(Ci);
		}
	}
}


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

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;

double lmin=INF,lmax=-INF,rmin=INF,rmax=-INF,umin=INF,umax=-INF,dmin=INF,dmax=-INF,xcmin=INF,xcmax=-INF,ycmin=INF,ycmax=-INF;

double xlength(double t){
  return max({rmax+t,lmax-t,xcmax})-min({rmin+t,lmin-t,xcmin});
}
double ylength(double t){
  return max({umax+t,dmax-t,ycmax})-min({umin+t,dmin-t,ycmin});
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  for(ll i=0;i<N;i++){
    double x,y;char d;cin>>x>>y>>d;
    if(d=='R'){
      rmin=min(rmin,x);
      rmax=max(rmax,x);
      ycmin=min(ycmin,y);
      ycmax=max(ycmax,y);
    }else if(d=='L'){
      lmin=min(lmin,x);
      lmax=max(lmax,x);
      ycmin=min(ycmin,y);
      ycmax=max(ycmax,y);
    }else if(d=='U'){
      umin=min(umin,y);
      umax=max(umax,y);
      xcmin=min(xcmin,x);
      xcmax=max(xcmax,x);
    }else{
      dmin=min(dmin,y);
      dmax=max(dmax,y);
      xcmin=min(xcmin,x);
      xcmax=max(xcmax,x);
    }
  }
  double ans=xlength(0)*ylength(0);
  if(0<=xcmin-rmin)ans = min(ans,xlength(xcmin-rmin)*ylength(xcmin-rmin));
  if(0<=lmin-xcmin)ans = min(ans,xlength(lmin-xcmin)*ylength(lmin-xcmin));
  if(0<=(lmin-rmin)/2)ans = min(ans,xlength((lmin-rmin)/2)*ylength((lmin-rmin)/2));
  if(0<=xcmax-rmax)ans = min(ans,xlength(xcmax-rmax)*ylength(xcmax-rmax));
  if(0<=lmax-xcmax)ans = min(ans,xlength(lmax-xcmax)*ylength(lmax-xcmax));
  if(0<=(lmax-rmax)/2)ans = min(ans,xlength((lmax-rmax)/2)*ylength((lmax-rmax)/2));
  if(0<=ycmin-umin)ans = min(ans,xlength(ycmin-umin)*ylength(ycmin-umin));
  if(0<=dmin-ycmin)ans = min(ans,xlength(dmin-ycmin)*ylength(dmin-ycmin));
  if(0<=(dmin-umin)/2)ans = min(ans,xlength((dmin-umin)/2)*ylength((dmin-umin)/2));
  if(0<=ycmax-umax)ans = min(ans,xlength(ycmax-umax)*ylength(ycmax-umax));
  if(0<=dmax-ycmax)ans = min(ans,xlength(dmax-ycmax)*ylength(dmax-ycmax));
  if(0<=(dmax-umax)/2)ans = min(ans,xlength((dmax-umax)/2)*ylength((dmax-umax)/2));
  printf("%.10lf\n",ans);
  return 0;
}


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

int main(){
    string s;
    cin >> s;

    bool isBad=false;
    if (s[0]==s[1]) isBad=true;
    else if(s[1]==s[2]) isBad=true;
    else if(s[2]==s[3]) isBad=true;
    else if(s[3]==s[4]) isBad=true;
    else{}

    if (isBad) cout << "Bad" << endl;
    else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;


//幅優先探索 bfs 範囲が広いなら 同一重み 一度行ったらもう更新しない
const int MAXN = 200010;
vector<int> G[MAXN]; //ノードにつながる辺の集合、どこのnode(int)につながっているか
int depth[MAXN]; //ノードの深さ(スタートからの距離),行ったことあるなら正,ないなら-1
int ct[MAXN];
int cter[MAXN];

void bfs(int s) {
    fill(depth, depth+MAXN, -1);
    deque<int> dq; //探索予定地 必要ならpairにしてどこから来たのか記録
    dq.push_back(s); // 始点を探索予定地に
    depth[s]=0; // 始点の深さを0に
    ct[s]=cter[s];
    while(!dq.empty()) {
        int v = dq.front();//行く元
        dq.pop_front();
        for(int i = 0; i < (int)G[v].size(); i++) {
            int e = G[v][i];//行き先
            if(depth[e]==-1) {
              depth[e]=depth[v]+1;
              ct[e]=ct[v]+cter[e];
              dq.emplace_back(e);
            }
        }
    }
}
int main() {
    int N,Q;
    cin>>N>>Q;
    for (int i = 0; i < N-1; i++) {
        int a,b; cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i,Q){
      int p,x;
      cin>>p>>x;

      cter[p]+=x;
    }

    bfs(1);

    reps(i,1,N+1){
      std::cout << ct[i] <<" ";
    }

    return 0;
}


Measured memory_bytes: 16372
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long L = scanner.nextInt();
        long R = scanner.nextInt();
        if(R - L >= 2019){
            System.out.println(0);
        }
        else {
            int min = 2019;
            for(long i = L; i <= R; i++){
                for(long j = i + 1; j <= R; j++){
                    long t = (i * j)%2019;
                    min = (int) Math.min(min, t);
                }
            }
            System.out.println(min);
        }

    }

}


Measured memory_bytes: 21844
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int N;
int K;
int ans = 1;

int main()
{
	scanf("%d %d", &N, &K);
	
	for(int i = 0; i < N; i++)
	{
		ans = min((2 * ans), ans + K);
	}
	printf("%d\n", ans);
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- conding: utf-8 -*-
import itertools
import sys
import math

for line in sys.stdin.readlines():
    n = int(line.strip())
    if n > 36:
        print(0)
        continue
    elif n == 36:
        print(1)
        continue
    cnt = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                d = n - (a + b + c)
                if 0 <= d and d <= 9:
                    cnt += 1
    print(cnt)

Measured memory_bytes: 7592
#include<iostream>
using namespace std;
char c[55][55];
int main()
{
	int h,w;
	cin>>h>>w;
	for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) cin>>c[i][j];
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++) 
			if(c[i][j]=='#')
				if(c[i-1][j]=='#'||c[i+1][j]=='#'||c[i][j-1]=='#'||c[i][j+1]=='#') continue;
				else
				{
					cout<<"No";
					return 0;
				}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	int ans = 10000;
	for(int n = 0;n < N;n++){
		int A;
		cin >> A;
		int temp = 0;
		while (A % 2 == 0) {
			A >>= 1;
			temp++;
		}
		ans = min(ans, temp);
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3196
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000007
#define ll long long
#define mp make_pair
int main()
{
	int n,k;
	cin>>n>>k;
	if(n%k)cout<<1<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


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


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=998244353;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,m,color[100010],timing[100010][11];
vector<int>G[100010];
void dfs(int v,int d,int c,int idx){
    if(timing[v][d]!=INF)return;
    timing[v][d]=idx;
    if(d==0)return;
    for(int i:G[v]){
        dfs(i,d-1,c,idx);
    }
    dfs(v,d-1,c,idx);
}
signed main(){
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    rep(i,n){
        rep(j,11){
            timing[i][j]=INF;
        }
    }
    int q;
    cin>>q;
    int v[100010],d[100010],c[100010];
    rep(i,q){
        cin>>v[i]>>d[i]>>c[i];
        v[i]--;
    }
    for(int i=q-1;i>=0;i--){
        dfs(v[i],d[i],c[i],i);
    }
    rep(i,n){
        if(timing[i][0]==INF)cout<<0<<endl;
        else cout<<c[timing[i][0]]<<endl;
    }
    return 0;
}

Measured memory_bytes: 17780
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;


int main()
{
    int a;
    int k;
    for(int i=1;i<6;i++)
    {
        cin>>a;
        if(a==0)
        {
          k=i;
        }
    }
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include"stdio.h"
#include <string.h>
int main()
{
	char txt[27];
	char tmp;
	int a, b;
	int len;
	scanf("%s", txt);
	len = strlen(txt);
	for (a = 0; a < len; a++){ 
		if (txt[a] == '\n') { break; }
		for (b = a + 1; b < len; b++) {
			if (txt[b] == '\n') { break; }//比較先がnullなら抜ける
			if (txt[b] == txt[a]) {
				printf("no\n");
				return 0;
			}
		}
	}

	printf("yes\n");
	return 0;

}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n, k;
    cin >> n >> k;
    int  cnt = 0;
    while(n > 0){
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

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

using namespace std;

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

signed main() {
	int N, K;
	cin >> N >> K;

	vector<int> h(N);
	rep(i, N) cin >> h[i];

	sort(all(h));

	int ret = INT_MAX;
	rep(i, N - K + 1) {
		ret = min(ret, h[i + K - 1] - h[i]);
	}
	cout << ret << endl;
}


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

int N; long long A, B;

int p[5005];
int rev[5005];
long long dp[5005][5005];

int main(){
    scanf("%d%lld%lld", &N, &A, &B);

    for(int i = 1; i <= N; i ++){
        scanf("%d", &p[i]);
        rev[p[i]] = i;
    }

    for(int j = 1; j <= N+1; j ++){
        dp[0][j] = 0;
    }

    for(int i = 1; i <= N; i ++){
        long long ans = 1LL << 61;
        for(int j = 1; j <= N+1; j ++){
            if(j < rev[i]){
                ans = min(ans, B + dp[i-1][j]);
            }else if(j == rev[i]){
                ans = min(ans, dp[i-1][j]);
            }else{
                ans = min(ans, A + dp[i-1][j]);
            }

            dp[i][j] = ans;
        }
    }

    printf("%lld", dp[N][N+1]);
    return 0;
}


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

const int maxn=2e6+7;
int w[maxn],e[maxn],a[maxn];

vector<pair<int,int> >vec;

bool cmp(pair<int,int>a,pair<int,int> b) {return a.second<b.second;}

int main (){
    int n,m;cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y;cin>>x>>y;
        vec.push_back(make_pair(x,y));
    }
    sort(vec.begin(),vec.end(),cmp);
    int ans=0;
    int tmp=0;
    for(int i=0;i<m;i++) if(tmp<=vec[i].first) ans++,tmp=vec[i].second;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  vector<ll> A(N + 1, 0);
  for (ll i = 0; i < N; ++i)
  {
    ll a;
    cin >> a;
    A.at(i + 1) = (A.at(i) + a) % M;
    // if (a % M == 0)
    // {
    //   ans += 1;
    // }
  }
  // for (int i = 0; i < N + 1; ++i)
  // {
  //   cout << A.at(i) << ' ';
  // }
  // cout << endl;
  sort(A.begin(), A.end());
  // for (int i = 0; i < N + 1; ++i)
  // {
  //   cout << A.at(i) << ' ';
  // }
  // cout << endl;
  ll cnt = 0;
  ll before = -1;
  for (ll i = 0; i < N + 1; ++i)
  {
    if (A.at(i) == before)
    {
      cnt += 1;
    }
    else
    {
      // cout << "cnt" << cnt << endl;
      ans += (cnt - 1) * cnt / 2;
      cnt = 1;
      before = A.at(i);
    }
  }
  ans += cnt * (cnt - 1) / 2;
  cout << ans << endl;
}


Measured memory_bytes: 1024
void main() {
	auto ip = readAs!(int[]), K = ip[0], S = ip[1];
	ulong res;
	foreach(X; 0..K+1) foreach(Y; 0..K+1) {
		auto Z = S - X - Y;
		debug writefln("%d, %d, %d", X, Y, Z);
		if(Z >= 0 && Z <= K) res++;
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,l;
  cin >> n >> l;
  vector<string> vs(n);
  rep(i,n) cin >> vs[i];

  sort(all(vs));

  rep(i,n){
    cout << vs[i];
  }

  cout << endl;
	return 0;
}


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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;

vector <int> adj[100005];
int dp[100005];

int dfs(int node)
{
  if(dp[node] != -1)
    return dp[node];

  dp[node] = 0;

  for(int i=0;i<adj[node].size();i++)
      dp[node] = max(dp[node], dfs(adj[node][i]) + 1);

  return dp[node];
}

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

  memset(dp, -1, sizeof dp);

  int n, m, x, y;
  cin>>n>>m;
  for(int i=0;i<m;i++)
  {
    cin>>x>>y;
    adj[x].push_back(y);
  }

  y = 0;
  for(int i=1;i<=n;i++)
    y = max(y, dfs(i));

  cout<<y<<endl;
  return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back
// #define endl "\n"
#define MAXN 5000000
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
int Ceil(int a, int b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p; 
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}

bool isPowerOfTwo (int x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}  

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a); 
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b; 
}

int powerCount(int num, int x){
    int count = 0;
    while(!(num%x)){
        count++;
        num/=x;
    }
    return count;
}

vector <int> SieveOfEratosthenes(int n) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    vector<int> vec;
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) {
        vec.push_back(p);
          // cout << p << " ";
        } 
    return vec;
} 

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t = 1;
    while(t--){
        double a,b,h,m;
        cin>>a>>b>>h>>m;
        double angle = abs(30*h - 5.5*m), c;
        angle = min(angle, 360 - angle);
        // cout<<angle<<" ";
        c = sqrt(a*a + b*b - 2*a*b*cos(angle*PI/180));
        cout<<setprecision(100)<<c;
    }
    return 0;
}


Measured memory_bytes: 4196
a, b, c, d = gets.split(' ').map{|item| item.to_i}

while a > 0 && c > 0
  c = c - b
  if c <= 0
    puts "Yes"
    break
  end
  a = a - d
  if a <= 0
    puts "No"
    break
  end
end

Measured memory_bytes: 14300
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
    let d: u32 = read();
    let g: usize = read();
    let mut a: Vec<(usize, usize)> = vec![];
    let mut minv = std::u32::MAX;

    for _ in 0..d {
        let p: usize = read();
        let c: usize = read();
        a.push((p, c));
    }

    for i in 0..2_u32.pow(d) {
        let mut ans = 0;
        let mut cnt = 0;
        let mut maxv = 0;
        for j in 0..d as usize {
            if (i & 1 << j) != 0 {
                cnt += a[j].0;
                ans += a[j].0 * (j + 1) * 100 + a[j].1;
            }

            if (i & 1 << j) == 0 {
                maxv = max(maxv, j);
            }
        }

        if ans >= g {
            minv = min(minv, cnt as u32);
            continue;
        }


        let mut scnt = 0;
        while scnt < a[maxv].0 - 1 {
            ans += (maxv + 1) * 100;
            scnt += 1;
            cnt += 1;
            if ans >= g {
                minv = min(minv, cnt as u32);
                continue;
            }
        }
    }
    println!("{}", minv);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<iostream>
#include <bits/stdc++.h>

using namespace std;


int main(void)
{
	double N,D;
	cin >> N >> D;
	double ans = (N) / (D * 2 + 1 );
	ans = (int)(ans+0.99999999);
	
	cout << ans << endl;
	cerr << "-----" << endl;
	cerr << ans << endl;
	cerr << "-----" << endl;
	
	return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    cout << 3 * n * n << endl;
    return 0;
}


Measured memory_bytes: 764
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	
	void run() {
		
		int a,b,c,d,e,f;
		
		while ( sc.hasNext() ) {
			
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			d = sc.nextInt();
			e = sc.nextInt();
			f = sc.nextInt();
			
			System.out.printf( "%.3f %.3f\n",(double)(e*c-b*f)/(a*e-b*d)+0.00005,(double)(a*f-c*d)/(a*e-b*d)+0.00005 );
			
		}
		
	}
	
	public static void main(String[] args) {
		
		new Main().run();
		
	}
}

Measured memory_bytes: 12000
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[m];
        int b[] = new int[m];
        TreeSet<Integer> set = new TreeSet<Integer>();
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < m; i++) {
            if (b[i] == n) {
                set.add(a[i]);
            }
        }
        boolean pos = false;
        for (int i = 0; i < m; i++) {
            if (a[i] == 1 && set.contains(b[i])) {
                pos = true;
                break;
            }
        }
        if (pos) {
            System.out.println("POSSIBLE");
        } else {
            System.out.println("IMPOSSIBLE");
        }
    }
}

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

int main(){
	int n;
	float sum=0;
	cin>>n;
	int f[100000];
	for (int i=1;i<=n;i++){
		cin>>f[i];
		sum+=f[i];
	}
	sum = sum / n;
	int tmp = sum;
	if ( sum - tmp > 0.5 )
		tmp++;
	int ans=0;
	for ( int j = 1; j <= n; j++ )
			ans += ( tmp - f[j] ) * ( tmp - f[j] );
		printf ( "%d\n", ans );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
int main(){
   string s;
   int n;
   cin>>n>>s;
   for (int i = 0; i < s.size(); i++)
   {
       /* code */
       int x=s[i]-'A';
       x=(x+n)%26;
       char ans='A'+x;
       cout<<ans;

   }
   
   }


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	if(N%K==0){
		cout<<"0"<<endl;
	}else{
		cout<<"1"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256