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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n,k,q,ng = 1e9;
    int a[2010],b[2010],c[2010];
    cin >> n >> k >> q;
    for (int i = 0;i < n;++i) scanf("%d",&a[i]);
    a[n] = -1;
    int ans = 1e9;
    for (int i = 0;i < n;++i) if (a[i] < ng) {
        int cnt1 = 0,cnt2 = 0;
        for (int j = 0;j < n+1;++j) {
            if (a[j] < a[i]) {
                sort(b,b+cnt1);
                for (int l = 0;l < cnt1-k+1;++l) c[cnt2++] = b[l];
                cnt1 = 0;
            } else b[cnt1++] = a[j];
        }
        if (cnt2 < q) {
            ng = min(ng,a[i]);
            continue;
        }
        sort(c,c+cnt2);
        ans = min(ans,c[q-1]-c[0]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
(n,m,k),as,bs=$<.map{|s| s.split.map &:to_i }
bsums=[t=0]
ans=0
bs.each{|b|
  t+=b
  break if t>k
  bsums.push(t)
  ans+=1
}
bsums.push(k+1)
#p [n,m,k,as,bsums,ans]
as.each_with_index{|a,i|
  break if 0>k-=a
  j=bsums.bsearch_index{|e| e>k }
  ans=[ans,i+j].max
#  p [ans,k,i,j]
}
puts ans

Measured memory_bytes: 41496
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll X, A, B;
  cin>>X>>A>>B;
  if(B<=A) cout<<"delicious"<<endl;
  else if(B<=A+X) cout<<"safe"<<endl;
  else cout<<"dangerous"<<endl;
}


Measured memory_bytes: 3536
n, a, b, c, d = map(int, input().split())
a, b, c, d = a-1, b-1, c-1, d-1
s = input()

if "##" in s[a:d]:
    print("No")
    exit()

if c < d:
    for i in range(b, d):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "#" and s[i-1] == "." and s[i+1] == ".":
            print("Yes")
            exit()

    print("No")

Measured memory_bytes: 3636
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <deque>
using namespace std;

int main()
{
	int fh[3],eh[3],fm[3],em[3],fs[3],es[3],sh[3] = {0},total[3] = {0},sm[3] = {0},ss[3] = {0};
	for(int i=0; i<3; i++)
		cin>>fh[i]>>fm[i]>>fs[i]>>eh[i]>>em[i]>>es[i];

	for(int i=0; i<3; i++)
	{
		total[i] += (eh[i] * 3600 + em[i] * 60 + es[i])
					- (fh[i] * 3600 + fm[i] * 60 + fs[i]);
		sh[i] = total[i] / 3600;
		sm[i] = (total[i] % 3600) / 60;
		ss[i] = (total[i] % 60);
	}

	for(int i=0; i<3; i++)
		cout<<sh[i]<<" "<<sm[i]<<" "<<ss[i]<<endl;

	return 0;

}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();

		double p = 0;
		for (int i = 1; i <= n; i++) {
			int j = i;
			int c = 1;
			while (j < k) {
				j = j << 1;
				c = c << 1;
			}
			p += (1.0 / n) * (1.0 / c);
		}

		System.out.println(p);
	}
}


Measured memory_bytes: 21204
fun main(args: Array<String>) {

    val n = readLine()!!
    val h = readLine()!!.split(" ").map(String::toLong)

    println(method139C(n, h))
}

fun method139C(n: String, h: List<Long>): Any? {

    var current = 0
    var max = 0

    val length = n.toInt() - 1

    for (index in 0 until length) {

        if (h[index] >= h[index + 1]) {
            // 移動可能
            current++
        } else {
            // 不可能
            if (max < current) {
                max = current
            }
            current = 0
        }
    }

    // 右橋が最大のとき
    if (max < current) {
        max = current
    }
    return max
}


Measured memory_bytes: 59588
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fr first
#define se second
#define pb push_back

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string S;cin>>S;
  for(int i=S.size()-2;;i-=2){
    if(S.substr(0,i/2)==S.substr(i/2,i/2)){
      print(i);
      return 0;
    }
  }

}


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

int main(){
  string s;
  cin >> s;
  int a, b;
  a = 10*(s[0]- '0') + (s[1] - '0');
  b = 10*(s[2]- '0') + (s[3] - '0');
  bool can[4];
  can[0] = false, can[2] = false;
  can[1] = true, can[3] = true;
  if(1 <= a && a <= 12) can[0] = true;
  if(a != 0) can[1] = true;
  if(1 <= b && b <= 12) can[2] = true;
  if(can[0] && can[1] && can[2] && can[3]) cout << "AMBIGUOUS" << endl;
  else if(can[0] && can[3]) cout << "MMYY" << endl;
  else if(can[1] && can[2]) cout << "YYMM" << endl;
  else cout << "NA" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                var read = Console.ReadLine();
                var temp_string = read.Split(' ');
                decimal a = int.Parse(temp_string[0]), b = int.Parse(temp_string[1]);
                decimal d,r;
                decimal f;

                d = Math.Floor(a/b);
                r = a % b;
                f =  a / b;

                Console.WriteLine(d+" "+r+" "+f);
            }
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first 
#define S second

int main(){
	ld l;
	cin >> l;
	cout << fixed << setprecision(12);
	cout << ((l / 3.0) * (l / 3.0) * (l / 3.0));
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc096/tasks/abc096_c
# C - Grid Repainting 2

h, w = list(map(int, input().split()))
s_list_list = []

for _ in range(h):
    s_list = list(input().split()[0])
    s_list_list.append(s_list)

done_list_list = [[False] * w for _ in range(h)]
is_ok = True

for h_i, s_list in enumerate(s_list_list):

    for w_i, s in enumerate(s_list):

        if s == '.':
            continue

        # 左から右、上から下に見ていく
        # 当該マスより左、上にある#は塗りつぶし済のはず

        # 右、下に#があったら優先的に塗りつぶす
        if h_i + 1 < h and s_list_list[h_i+1][w_i] == '#':
            done_list_list[h_i][w_i] = True
            done_list_list[h_i+1][w_i] = True

        if w_i + 1 < w and s_list_list[h_i][w_i+1] == '#':
            done_list_list[h_i][w_i] = True
            done_list_list[h_i][w_i+1] = True

        if not done_list_list[h_i][w_i]:
            is_ok = False
            break

    if not is_ok:
        break

# for d in done_list_list:
#     print(d)

ans = 'Yes' if is_ok else 'No'
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    int x;
    cin >> x;
    int res = 1;
    for(int i = 2;i*i<=x;i++){
        int tmp = i;
        for(int j = 2;j<=x;j++){
            tmp*=i;
            if(tmp<=x){
                res = max(res,tmp);
            }
            else{
                break;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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


int main()
{
  int label[7];
  for(int i=1; i<=6; ++i){ std::cin >> label[i]; }

  std::string tmp;
  std::string dir;
  std::cin >> dir;
  for(int i=0; i<dir.length(); ++i){
    if( dir[i] == 'E' ){
      tmp = label[1];
      label[1] = label[4];
      label[4] = label[6];
      label[6] = label[3];
      label[3] = tmp[0];
    }else if( dir[i] == 'N' ){
      tmp = label[1];
      label[1] = label[2];
      label[2] = label[6];
      label[6] = label[5];
      label[5] = tmp[0];
    }else if( dir[i] == 'S' ){
      tmp = label[1];
      label[1] = label[5];
      label[5] = label[6];
      label[6] = label[2];
      label[2] = tmp[0];
    }else if( dir[i] == 'W' ){
      tmp = label[1];
      label[1] = label[3];
      label[3] = label[6];
      label[6] = label[4];
      label[4] = tmp[0];
    }
  }
  std::cout << label[1] << std::endl;

return 0;
}



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

const int N = 105;
int in[N];

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) scanf("%d", in + i);
    int res = 0;
    for(int i = 1; i < n; ++i) {
        if(in[i] == in[i - 1]) {
            res++;
            i++;
        }
    }
    printf("%d\n", res);
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] num = new int[6];
        int[] a = new int[6];
         for (int i=0; i<6; i++) {
            num[i] = sc.nextInt();
            a[i] = num[i];
        }
        String str = sc.next();
        for (int i=0; i<str.length(); i++) {
            if (str.charAt(i)=='E') {
                num[0] = a[3];
                num[2] = a[0];
                num[5] = a[2];
                num[3] = a[5];
                a = num.clone();
            } else if (str.charAt(i)=='N') {
                num[0] = a[1];
                num[4] = a[0];
                num[5] = a[4];
                num[1] = a[5];
                a = num.clone();
            } else if (str.charAt(i)=='S') {
                num[0] = a[4];
                num[1] = a[0];
                num[5] = a[1];
                num[4] = a[5];
                a = num.clone();
            } else {
                num[0] = a[2];
                num[3] = a[0];
                num[5] = a[3];
                num[2] = a[5];
                a = num.clone();
            }
        }
        System.out.println(num[0]);
    }
}



Measured memory_bytes: 26388
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <set>
#include <map>
#include <assert.h>

using namespace std;

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

typedef long long ll;

string parse_target;
string::const_iterator iter, last;

bool consume(char expected) { if(*iter == expected) { iter++; return true; } else { assert(false); } }
bool consume_if(char expected) { if(*iter == expected) { consume(expected); return true; } return false; }
void debugger() { for(auto tmp = iter;tmp!=last;tmp++) cout << *tmp; cout << endl; }

double number() {
  string str;
  for(; isdigit(*iter) || *iter=='-'; iter++) {
    str += *iter;
  }
  return stod(str);
}

typedef complex<double> Point;
typedef vector<Point> Line;
enum { undefined_style, line_style, point_style };
struct result_type
{
  int style_;
  Line line_; Point point_;
  result_type(Point const& a, Point const& b): style_(line_style), point_() { line_.push_back(a), line_.push_back(b); }
  result_type(Point p): style_(point_style), line_(), point_(p) {}
  result_type(double x, double y): style_(point_style), line_(), point_(x, y) {}
  result_type(): style_(undefined_style), line_(), point_() {}
};

double dot(Point const& a, Point const& b) { return real(conj(a)*b); }
double cross(Point const& a, Point const& b) { return imag(conj(a)*b); }

Point intersection(Line const& a, Line const& b) {
  Point va = a[1]-a[0], vb = b[1]-b[0];
  return a[0] + va * cross(vb, b[0]-a[0]) / cross(vb, va);
}

Point projection_point(Line const& l, Point const& p) {
  double k = dot(l[1]-l[0], p-l[0]) / norm(l[1]-l[0]);
  return l[0]+k*(l[1]-l[0]);
}
 
Point reflection_point(Line const& l, Point const& p) {
  return p + 2.*(projection_point(l, p) - p);
}

result_type make_symmetric_point(result_type line, result_type p) {
  if(line.style_ == point_style) swap(line, p);
  return result_type(reflection_point(line.line_, p.point_));
}

result_type rec();

result_type term() {
  result_type ret;
  if((*iter == '(') && (isdigit(*(iter+1)) || *(iter+1)=='-')) {
    consume('(');
    auto lhs = number();
    consume(',');
    auto rhs = number();
    consume(')');
    return {lhs, rhs};
  }
  else if(consume_if('(')) {
    auto expr = rec();
    consume(')');
    return expr;
  }
  else {
    if(ret.style_ == undefined_style) ret = rec();
    consume(')');
    return ret;
  }
}

result_type rec() {

  result_type ret = term();

  for(;iter<last;) {
    if(consume_if('@')) {
      auto rhs = term();
      if(ret.style_ == point_style      && rhs.style_ == point_style) ret = {ret.point_, rhs.point_};
      else if(ret.style_ == line_style  && rhs.style_ == line_style)  ret = intersection(ret.line_, rhs.line_);
      else ret = make_symmetric_point(ret, rhs);
    }
    else {
      break;
    }
  }
  return ret;
}

int main() {

  for(;getline(cin, parse_target);) {
    if(parse_target == "#") { break; }
    iter = parse_target.begin(), last = parse_target.end();
    auto res = rec();
    printf("%.8f %.8f\n", res.point_.real(), res.point_.imag());
  }

  return 0;
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

string S,T,U;
int a,b,c;
vi A,B,C;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    int h1,m1,h2,m2,K;cin>>h1>>m1>>h2>>m2>>K;
    int ji = h2 - h1;
    int hu = m2 - m1;
    int all = ji*60+hu;
    cout << all - K << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Apr  4 21:00:23 JST 2020
 **/

signed main() {
    Int n, m;
    std::cin >> n >> m;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Int lim = std::accumulate(a.begin(), a.end(), 4 * m - 1) / (4 * m);
    Int cnt = 0;
    REP(i, n) cnt += a[i] >= lim;
    std::cout << (cnt >= m ? "Yes" : "No") << std::endl;
}


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

int main() {
	int N;
	long A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	if(abs(B-A)>D*(N-1)){
	    cout << "NO" << endl;
	    return 0;
	}
	long mx=min(C+D, 1+(D-C)*(N-1)), sa=A+D*(N-1)-B;
	cout << (sa%(C+D)<mx ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main (){
  ll n;
  cin>>n;
  vector<ll>c(n,0);
  for(ll i=0;i<n;i++){
    cin>>c[i];
    c[i]--;
  }
  vector<ll>dp(n,0);
  vector<ll>v(n,0);
  vector<ll>vv(n,-1);
  dp[n-1]=1;
  if(n!=1){
  v[c[n-1]]=1;
  vv[c[n-1]]=n-1;
  
  for(ll i=n-2;i>=0;i--){
    if(v[c[i]]==0||vv[c[i]]-i==1){
      dp[i]=dp[i+1];
      v[c[i]]=dp[i];
    }
    else{
      dp[i]=dp[i+1]+v[c[i]];
      v[c[i]]=dp[i];
    }
    vv[c[i]]=i;
    dp[i]%=MOD;
    v[c[i]]%=MOD;
  }
  }
  cout<<dp[0]<<endl;
}


Measured memory_bytes: 6528
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int count = 0;
    while(sc.hasNext()){
      count += sc.nextInt();
    }
    sc.close();
    
    if(count <= n){
      System.out.println(n - count);
    }else{
      System.out.println(-1);
    }
  }
}

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

int n,m;
vp a;

int main(){
	cin>>n>>m;
	a=vp(n);
	for(int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
	sort(a.begin(),a.end());
	ll res=0,I=0;
	for(int i=0;i<m;i++){
		while(!a[I].second) I++;
		a[I].second--;
		res+=a[I].first;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 1024
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  string ans;
  for (int i = 0; i < S.size(); ++i) ans += 'x';
  cout << ans << endl;
  return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/10/02  Problem: Nagoya_univ_contest16_e  / Link:   ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

貪欲にぶたんはあやしいね

----解説ここまで---- */

LL N;
LL a[200005];
LL ans = 0LL;
int fg = 0;

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

	cin >> N;
	LL sum = 0;
	FOR(i, 0, N) {
		cin >> a[i];
		a[i + N] = a[i];
		sum += a[i];
	}
	if (sum % ((N + 1)*N/2) != 0) {
		cout << "NO" << endl;
		return 0;
	}

	fg = 1;
	LL k = sum / ((N + 1)*N/2);
	FOR(i, 0, N) {
		LL d = a[i + 1] - a[i];
		if ((k - d < 0) || (k - d) % N)fg = 0;
	}


	if(fg)
	cout << "YES" << "\n";
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<set>

using namespace std;

int N;
int A[100007];
set<int> s;

int main(){
  cin >> N;
  for( int i = 0; i < N; i++ ){
	cin >> A[i];
	if( s.count(A[i]) ){
	  s.erase(A[i]);
	}else{
	  s.insert(A[i]);
	}
  }
  cout << s.size() << endl;
  return 0;
}

Measured memory_bytes: 5248
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n,m;
vector<pair<pair<int,int>,int> >a,ans;
int cnt[1<<17];
main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int p,y;cin>>p>>y;
		a.push_back(make_pair(make_pair(y,p),i));
	}
	sort(a.begin(),a.end());
	for(int i=0;i<m;i++)
	{
		ans.push_back(make_pair(make_pair(a[i].second,a[i].first.second),++cnt[a[i].first.second]));
	}
	sort(ans.begin(),ans.end());
	for(int i=0;i<m;i++)
	{
		printf("%06d%06d\n",ans[i].first.second,ans[i].second);
	}
}


Measured memory_bytes: 4340
char*p;L[11],i,j,a,b,c;E(int*A){int l[16]={0},r[16]={0};if(*p-40)A[L[*p++-48]]=1;else for(p++,E(l),E(r),i=16;i--;)for(j=16;j--;A[i^j]+=a)A[i&j]+=a=l[i]*r[j],A[i|j]+=a;p++;}main(d,T){for(;scanf("%[^\n]",p=T),c=*p-69;){int A[16]={0};for(i=scanf("%d",&j);i<=j;L[i++]=a+b*2+c*4+d*8)scanf("%d%d%d%d\n",&a,&b,&c,&d);E(A);printf("%d\n",A[15]);}}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int n,k,t;
vector<int> x(1000000);
vector<int> sa(1000000);

int main(){
	cin>>t;
	for(int i=0; i<t; i++){
		cin>>n>>k;
		for(int j=0; j<n; j++){
			cin>>x[j];
			if(j>0)sa[j-1]=x[j]-x[j-1];
		}
		sort(&sa[0],&sa[n-1]);
		reverse(&sa[0],&sa[n-1]);
		int ans=x[n-1]-x[0];
		for(int j=0; j<k-1; j++){
			ans-=sa[j];
		}
		if(ans<0)ans=0;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 8792
hash = Hash.new(0)
while true do
  num = gets
  break if num == nil
  hash[num.to_sym] += 1
end
hash = hash.sort
hash = hash.sort{|a,b| b[1]<=>a[1] }
max = 0
hash.each do |key, val|
  break if max > val
  puts key
  max = val
end

Measured memory_bytes: 6096
#include <stdio.h>

#define NMAX 101
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,time;
int color[NMAX],d[NMAX],f[NMAX];
int M[NMAX][NMAX];

void rec(int i){
  int j;
  color[i] = GRAY;
  d[i] = ++time;
  for(j = 0;j < n;j++){
    if(M[i][j] == 0){
      continue;
    }
    if(color[j] == WHITE){
      rec(j);
    }
  }
  color[i] = BLACK;
  f[i] = ++time;

}
  

int main(void){

  int u,k,v,i,j;

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      M[i][j] = 0;
    }
  }

  for(i = 0;i < n;i++){
    scanf("%d%d",&u,&k);
    for(j = 0;j < k;j++){
      scanf("%d",&v);
      M[u - 1][v - 1] = 1;
    }
  }

  for(i = 0;i < n;i++){
    color[i] = WHITE;
  }
  time = 0;

  for(i = 0;i < n;i++){
    if(color[i] == WHITE){
      rec(i);
    }
  }

  for(i = 0;i < n;i++){
      printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
	  
}



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

class Program
{
    static void Main(string[] args)
    {
        var R = sc.ReadInt();
        var G = sc.ReadInt();
        var B = sc.ReadInt();
        var N = sc.ReadInt();
        var ans = 0;
        for (int r = 0; r <= N / R; r++)
        {
            for (int g = 0; g <= N / G; g++)
            {
                var x = N - r * R - g * G;
                if (x % B == 0 && x >= 0)
                {
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11092
S = list(map(int, input()))
rs = []
for b in range(2**(len(S)-1)):
  r = 0
  c = 0
  for i in range(len(S)-1):
    c = 10*c+S[i]
    if b&(1<<i) != 0:
      r += c
      c = 0
  c = 10*c+S[-1]
  r += c
  rs.append(r)
r = sum(rs)
print(r)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int A, B, C;
    cin >> A >> B >> C;
    
    if(A%2 && B%2 && C%2){
        cout << min(min(A*B, B*C), C*A) << "\n";
    }else{
        cout << 0 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

int N;
vector<long long> A;

int main() {
while (cin >> N) {
A.resize(N);
for (int i = 0; i < N; ++i) cin >> A[i];
long long sum = 0;
map<long long, long long> ma;
ma[sum]++;
for (int i = 0; i < N; ++i) {
sum += A[i];
ma[sum]++;
}
map<long long, long long>::iterator it;
long long res = 0;
for (it=ma.begin();it!=ma.end();it++)
{
res += (it->second - 1) * it->second / 2;
}
cout << res << endl;
}
}

Measured memory_bytes: 14336
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
       
    int[][] val = new int[N][3];
    for(int i = 0; i < N; i++){
      String[] S = sc.nextLine().split(" ");
      val[i][0] = Integer.parseInt(S[0]);
      val[i][1] = Integer.parseInt(S[1]);
      val[i][2] = Integer.parseInt(S[2]);
    }
    
    int ax = 0;
    int ay = 0;
    int ah = 0;
    for(int i = 0; i < N; i++){
      ax = val[i][0];
      ay = val[i][1];
      ah = val[i][2];
      if(ah > 0){
        break;
      }
    }
    for(int i = 0; i <= 100; i++){
      con : for(int j = 0; j <= 100; j++){
        int H = Math.abs(i-ax) + Math.abs(j-ay) + ah;
        for(int k = 0; k < N; k++){
	      int x = val[k][0];
    	  int y = val[k][1];
       	  int h = val[k][2];
          if(Math.max(H - Math.abs(i-x) - Math.abs(j-y), 0) == h){
            continue;
          }
          if(Math.abs(i-x) + Math.abs(j-y) + h != H){
            continue con;
          }
        }
        System.out.println(i+" "+j+" "+H);
        return;
      }
    }
  }
}

Measured memory_bytes: 23892
n = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

if sum(A) < sum(B):
    print(-1)
    exit()

C = []
minus = 0
ans = 0

for a, b in zip(A, B):
    C.append(a - b)
    if a - b < 0:
        minus += a - b
        ans += 1

C.sort(reverse = True)
for c in C:
    if minus >= 0:
        break
    minus += c
    ans += 1

print(ans)

Measured memory_bytes: 19052
import math

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

x=[]
y=[]

res=0

for i in range(n):
    X,Y=map(int,input().split())
    x.append(X)
    y.append(Y)


for i in range(len(x)):
    a=math.ceil(math.sqrt((x[i]**2)+(y[i]**2)))

    if a<=d:
        res+=1

print(res)


Measured memory_bytes: 24780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
long long k;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	vector<long long> a(n),f(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>f[i];
	}
	sort(a.begin(),a.end());
	sort(f.begin(),f.end(),greater<long long>());
	long long ma=0LL;
	for(int i=0;i<n;i++){
		ma=max(a[i]*f[i],ma);
	}
	long long le=0,ri=ma;
	while(le<ri){
		long long kt=k;
		long long v=(le+ri)/2;
		for(int i=0;i<n;i++){
			if(a[i]*f[i]>v){
				kt-=a[i]-v/f[i];
			}
		}
		if(kt<0)
			le=v+1;
		else
			ri=v;
	}
	cout<<le<<endl;
	return 0;
}


Measured memory_bytes: 3456
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define range(v)                v.begin(),v.end()
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

void ssolve(std::istream& in, std::ostream& out){
    int n;
    s(n);
    vector<vector<int>> prizes(n, vector<int>(3, 0));
    f(i, 0, n){
        f(j, 0, 3){
            s(prizes[i][j]);
        }
    }
    vector<vector<int>> dp(n + 1, vector<int>(3, 0));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            int idx1 = (j + 1) % 3;
            int idx2 = (j + 2) % 3;
            dp[i + 1][j] = max(dp[i][idx1] + prizes[i][idx1], dp[i][idx2] + prizes[i][idx2]);
        }
    }
    int maxx = *max_element(dp[n].begin(), dp[n].end());
    p(maxx);
    return;
}

class CVacation {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(0);out.tie(0);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    CVacation solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

Measured memory_bytes: 14268
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll A,B,C,cnt5=0,cnt7=0;
  cin>>A>>B>>C;
  if(A==5 && B==5 && C==7){
    cout<<"YES"<<endl;
  }else if(A==5 && B==7 && C==5){
    cout<<"YES"<<endl;
  }else if(A==7 && B==5 && C==5){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll b , c;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)q) ->c - ((fr*)p)->c;}

/*----------------------priorityqueue-----------------------------------------------------------*/
ll heap[MAX_N];
void pushHeap(ll val, ll len){
    ll i=len; heap[i]=val;
    while(i!=0){
        if( heap[i]<heap[(i-1)/2] ) swap(&heap[i],&heap[(i-1)/2]);
        i--;i/=2;
    }
}
void popHeap(ll *val, ll len){
    ll i=0; *val=heap[0]; heap[0]=INF;
    swap(&heap[0],&heap[len-1]);
    while(len>i*2+1){
        if(i*2+2<len && heap[i] > heap[i*2+2] && heap[i*2+1] > heap[i*2+2] ){
            swap(&heap[i],&heap[i*2+2]);
            i*=2;i+=2;
        }else{
            if(heap[i] > heap[i*2+1]){
                swap(&heap[i],&heap[i*2+1]);
                i*=2;i++;
            }else break;
        }
    }
}
/*---------------------------------------------------------------------------------*/

int main(void){
    // char ;
    ll n,m,ans=0;
    scanf("%lld%lld",&n,&m);
    ll a;
    rep(i,0,n){
        scanf("%lld",&a);
        pushHeap(a,i);
    }

    fr bc[m];
    rep(i,0,m){
        scanf("%lld%lld",&bc[i].b,&bc[i].c);
    }
    qsort(bc,m,sizeof(fr),cmp1);
    
    // rep(i,0,m) printf("%lld ",bc[i].b);
    // PN;
    rep(i,0,m){
        if(heap[0]>=bc[i].c) break;
        else{
            rep(j,0,bc[i].b){
                if(heap[0]>=bc[i].c) break;
                ll a;
                popHeap(&a,n);
                pushHeap(bc[i].c,n-1);
                // rep(k,0,n)printf("%lld ",heap[k]);
                // PN;
            }
        }
        // rep(k,0,n)printf("%lld ",heap[k]);
        // PN;
    }
    rep(i,0,n){
        // printf("%lld ",heap[i]);
        ans+=heap[i];
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4092
import heapq

res=0
n,k=map(int,input().split())
v=list(map(int,input().split()))
r=min(n,k)
for a in range(r+1):#操作Aの回数
    for b in range(r-a+1):#Bの回数
        d=v[:a]
        d.extend(v[n-b:])
        s=sum(d)
        heapq.heapify(d)

        l=k-(a+b) #捨てる回数print(d)
        for _ in range(l):
            if not d:
              break
            t=heapq.heappop(d)
            if t<0:
               s-=t
            else:
                break
        if s>res:
            res=s
print(res) 


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

int main() {
  int a,b;
  cin>>a>>b;
  cout<<(b-a)*(b-a-1)/2-a<<endl;
}

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

#define REP(i,n) for(ll i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  REP(i, N){
    cin >> H[i];
  }
  sort(H.rbegin(), H.rend());
  if(K >= N){
    cout << 0 << endl;
    return 0;
  }
  ll cnt = 0;
  FOR(i, K, N){
    cnt += H[i];
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;
int main(){
    int x;
    cin >> x;
    if(x<1200) out("ABC");
    else out("ARC");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int a, b, c, d; cin >> a >> b >> c >> d;
   if (abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))
      cout << "Yes" << endl;
   else
      cout << "No" << endl;

}

Measured memory_bytes: 3580
<?php 
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s);

$list = range('A','Z');
$arr = str_split($s);
$string = "";
foreach ($arr as $value) {
  $key = array_search($value, $list);
  if($key+$n <= 25){
    $string .= $list[$key+$n];
  }else {
    $string .= $list[$key+$n-26];
  }
}
echo $string;
?>

Measured memory_bytes: 5364
N=int(input())
aList=list(map(int, input().split()))

bList=[0] * N

for i in reversed(range(N)):
    x = N // (i + 1)
    tmp = 0
    for j in range(1, x+1):
        tmp += bList[j * (i + 1) - 1]
    if aList[i] != tmp%2:
        bList[i] = 1
M = bList.count(1)

print(M)
if M != 0:
    for i in range(N):
        if bList[i] == 1:
            print(str(i+1), end = " ")

Measured memory_bytes: 63964
mod = 10**9+7
n,a,b = map(int, input().split())
r = pow(2, n, mod) - 1

def cmb(n,k):
    x,y = 1,1
    for i in range(k):
        x = x * (n-i) % mod
        y = y * (k-i) % mod
    return x * pow(y, mod-2, mod) % mod

ans = r - cmb(n,a) - cmb(n,b)
ans = ans % mod
print(ans)

Measured memory_bytes: 3064
import sys
roman={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}

for s in sys.stdin:
    x=[roman[s[0]]]
    for c in s[1:-1]:
        tmp = roman[c]
        if x[-1]<tmp: x[-1] *= -1
        x.append(tmp)
    print sum(x)

Measured memory_bytes: 4212
using System;
using System.Linq;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            for (int t, f = 0; (t = int.Parse(Console.ReadLine())) != 0; f = 1) {
                if(f != 0) {
                    Console.WriteLine();
                }
                var items = Enumerable.Range(0, t).Select(q => { 
                        var i = Console.ReadLine().Split();
                        return new {n = i[0], i = q, p = int.Parse(i[1]) * 3 + int.Parse(i[3])};
                }).OrderByDescending(q => q.p).ThenBy(q => q.i);
                foreach(var item in items){
                    Console.WriteLine("{0},{1}", item.n, item.p);
                }
            }
        }
    }
}

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

typedef long long int lli;
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????


void swap(int &a,int &b){ // c??????*
	int w=a;
	a=b;
	b=w;
}

int getdigit(int num){ // ??´??°????????°?????????
	int i,j;
	if(num<0) num*=-1; // ?????°???????????¢
	if(num==0)return 1;
	for(i=10,j=1;;i*=10,j++){
		if(INRANGE(i/10,num,i-1))return j;
	}
	return 0; // ????????¨??????
}

int getN(int num,int digit){ // num???digit?????????????????????
	int i=1,j;
	for(j=1;j<digit;i*=10,j++);
	return (num/i)%10;
}

int zeller(int y,int m,int d){ // 0????????\????????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

int gcd(int a,int b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

int lcm(int a,int b){	// ????°???¬?????°
	return a*b/gcd(a,b);
}

int stoi(const string str){ // ?????????????????´??°
	int i=0,j;
	int len=str.length();
	int w=0;
	for(i=1,j=1;i<=len && INRANGE('0',str[len-i],'9');i++,j*=10){
		w+=(str[len-i]-'0')*j;
	}
	if(str[0]=='-')w*=-1;
	return w;
}

string itos(int a){ // ??´??°???????????????
	int i;
	string str="";
	int keta;
	if(a<0){str+='-';a*=-1;} // ?????°??????????????????
	for(keta=10;a/keta!=0;keta*=10);
	for(i=keta/10;i!=0;i/=10){
		str+=((a/i)%10)+'0';
	}
	return str;
}

int main(void){
	int n,i;
	int count;
	char c;
	string str;
	string tmp;

	while(1){
		cin>>n;
		if(n==0)break;
		cin>>str;
	while(n--){
	tmp="";
	count=0;
	i=0;
	c=str[0];
	while(i<str.length()){
		if(c==str[i]){
			count++;
		}
		else{
			tmp+=itos(count);
			tmp+=c;
			count=1;
			c=str[i];
		}
		i++;
	}
	if(count!=0){
		tmp+=itos(count);
		tmp+=c;
	}
	
		str=tmp;
	}
	cout<<tmp<<endl;
	}
	return 0;
}

Measured memory_bytes: 1344
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 10000
#define NIL -1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<double, double> doup;


int main(void) {
    ll n, m;
    cin >> n >> m;
    ll t, a, s[100001]={0};
    ll i, ans=0;
    map<ll, ll> map;
    set<ll> set;
    map[0]=1;
    for(i=1; i<=n; i++) {
        cin >> a;
        s[i]=s[i-1]+a;
        map[s[i]%m]++;
        set.insert(s[i]%m);
    }
    
    for(auto itr=set.begin(); itr!=set.end(); itr++) {
        t=map[*itr];
        ans+=t*(t-1)/2;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 7936
N, K = list(map(int, input().split()))

MOD = 10**9+7


gcd_dict = {}
for i in range(K, 0, -1):

    number = pow((K//i), N, MOD)
    number %= MOD
    counter = 2
    while True:
        if counter*i in gcd_dict:
            number -= gcd_dict[counter*i]
            counter += 1
        else:
            gcd_dict[i] = number % MOD
            break

print(sum([i*j for i, j in gcd_dict.items()]) % MOD)

Measured memory_bytes: 22760
#include <algorithm>
#include <bitset>
#include <climits>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;
using ll = long long int;

int main() {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  ll t = (C + B - 1) / B;
  ll s = (A + D - 1) / D;

  if (t > s) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int a,b,c,d;
  cin >> a >>b >> c >> d;
  cout << max(a*b,c*d) << endl;




  

  return 0;
}


Measured memory_bytes: 256