akhauriyash/Code-Regression huggingface dataset:
n=gets.to_i
march=[0,0,0,0,0]
n.times do
  si=gets.chomp
  if si[0]=="M"
    march[0]+=1
  elsif si[0]=="A"
    march[1]+=1
  elsif si[0]=="R"
    march[2]+=1
  elsif si[0]=="C"
    march[3]+=1
  elsif si[0]=="H"
    march[4]+=1
  end
end
newmarch=march.select{|v| 0<v}
nmsize=newmarch.size
sum=0
if 2<nmsize
  newmarch.combination(3) do |i,j,k|
    sum+=i*j*k
  end
end
puts sum


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

typedef long long ll;
const ll INF = 1e18;
template<typename T>
inline T Read(){
    T s = 0, f = 1; char ch = getchar();
    while(!isdigit(ch)) {if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) {s = (s << 3) + (s << 1) + ch - '0'; ch = getchar();}
    return s * f;
}

#define read() Read<int>()
#define readl() Read<long long>()

void solve() {
	int a = read(), b = read(), c = read(), d = read();
	ll res = -INF;
	if(b < 0) { 
		if(d < 0) res = max(res, 1ll * a * c);
		if(c > 0) res = max(res, 1ll * b * c);
		if(c <= 0 && d >= 0) res = max(res, 1ll * a * c);
	} 
	else if(a <= 0 && b >= 0) {
		if(d < 0) res = max(res, 1ll * c * a);
		if(c > 0) res = max(res, 1ll * b * d);
		if(c <= 0 && d >= 0) res = max(res, max(1ll * c * a, 1ll * b * d));
	}
	
	else if(a > 0) {
		if(d < 0) res = max(res, 1ll * d * a);
		if(c > 0) res = max(res, 1ll * b * d);
		if(c <= 0 && d >= 0) res = max(res, 1ll * b * d);
	}
	
	printf("%lld\n", res); 
}

int main()
{
	int T = 1;
	//T = read();
	for(int i = 1; i <= T; ++i) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 3768
#include<stdio.h>
int main(){
  int d[10],v1,v2,i,s;
  double ds;
  while(scanf("%d",&d[0])!=EOF){
    s=d[0];
    for(i=1;i<10;i++){
      scanf(",%d",&d[i]);
      s+=d[i];
    }//printf("%d\n",s);
    scanf(",%d,%d",&v1,&v2);
    ds=(double)s*v1/(v1+v2);//printf("%f\n",ds);
    for(i=0;i<10;i++){
      //if(ds<=d[i])break;
      ds-=d[i];
      if(ds<=0)break;
    }
    printf("%d\n",i+1);
  }
  return 0;
}

Measured memory_bytes: 596
// ref:
// https://kamojirobrothers.hatenablog.com/entry/2018/10/30/215345
// https://drken1215.hatenablog.com/entry/2018/09/08/011500
// https://ta7uw.hatenablog.com/entry/2019/09/29/162635
//
// https://www.slideshare.net/iwiwi/ss-3578491
// https://www.slideshare.net/hcpc_hokudai/binary-indexed-tree

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}


template <typename T>
class BIT{
private:
    vector<int> vBit;
    
public:
    BIT(int size): vBit(size+1,(T)0) {}
    ~BIT(){}
    
    void add(int idx, T val);
    T sum(int end);            // sum [1, end) // 1-indexed
    T sum(int begin, int end); // sum [begin, end)
    T lower_bound(T w);        // get min-x with v1 + v2 + ... + vx >= w.
};
template<typename T>
void BIT<T>::add(int i, T val){
    for(; i<(int)vBit.size(); i+=i&-i){ vBit[i] += val; }
}
template<typename T>
T BIT<T>::sum(int i){
    T s = (T)0;
    for(; i>0; i-=i&-i){ s += vBit[i]; }
    return s;
}
template<typename T>
T BIT<T>::sum(int begin, int end){ return sum(end-1) - sum(begin-1); } // begin and end are 1-indexed.
/*
template<typename T>
T BIT<T>::lower_bound(T w){
    if(w<=vBit[0]){ return 0; }
    int sum_i=0;
    int i=1;
    while(i*2<vBit.size()){ i*=2; }
    for(; i>0; i/=2){
        int idx = sum_i+i;
        if(idx<vBit.size() && w>vBit[idx]){
            w -= vBit[idx];
            sum_i += i;
        }
    }
    return sum_i+1;
}
//*/

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    int64 N; cin >> N;
    vector<int> vA(N); for(int i=0; i<N; ++i){ cin >> vA[i]; }
    
    const int bias=N+1;
    int low=0, high=INT_MAX;
    while(high-low>1){
        int64 mid = (high+low)/2;
        
        int64 num=0, sum=0;
        BIT<int64> bit(N*2+1); bit.add(sum+bias, 1);
        for(uint i=0; i<N; ++i){
            sum += vA[i]<=mid ? 1:-1;
            num += bit.sum(sum+bias-1); // same as below
//            num += bit.sum(1, sum+bias);
            bit.add(sum+bias, 1);
        }
        
        if(num > (N+1)*N/2/2){ high = mid;
        }        else        { low  = mid; }
    }
    cout << high << endl;
    
    return 0;
}


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

int main() {
    string data;
    cin>>data;
    set<char> r;
    for(int i=0;i<data.length();i++)
    r.insert(data[i]);
    bool check= false;
    for(char i='a';i<='z';i++)
    if(!r.count(i))
    {
        cout<<i<<endl;
        check=true;
        break;
    }
    if(!check)
        cout<<"None"<<endl;
}

Measured memory_bytes: 3080
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        char[] num = n.toCharArray();
        int sum = 0;
        for (char c : num) {
            sum += Character.getNumericValue(c);
        }
        if (Integer.parseInt(n) % sum == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int main() {
  size_t N;
  string S;
  cin >> N;
  cin >> S;
  int ans{};
  for (size_t pos{}; (pos = S.find("ABC", pos)) != string::npos; ++ans, pos += 3)
    ;

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


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

string N;

int memo[10][2][8][2];

int rec(int k = 0, bool tight = true, int f753 = 0, bool lzero = false)
{
    if (k == N.size()) {
        return f753 == 7 ? 1 : 0;
    }

    int digit = N[k] - '0';

    int& memo_r = memo[k][tight][f753][lzero];
    if (~memo_r) return memo_r;

    int res = 0;
 
    if (k == 0 || lzero) {
        res += rec(k+1, tight && digit == 0, f753, true);
    }
    if (!tight|| digit >= 3) {
        res += rec(k+1, tight && digit == 3, f753 | 1);
    }
    if (!tight || digit >= 5) {
        res += rec(k+1, tight && digit == 5, f753 | 2);
    }
    if (!tight || digit >= 7) {
        res += rec(k+1, tight && digit == 7, f753 | 4);
    }

    return memo_r = res;
}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
 
    cin >> N;
    memset(memo, -1, sizeof(memo));

    cout << rec() <<endl;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

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

    sort(a.begin(), a.end());

    int q;
    cin >> q;
    rep(i, q) {
        ll k;
        cin >> k;

        cout << ((*lower_bound(a.begin(), a.end(), k)) == k) << endl;
    }

}



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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

//Write From this Line

int main()
{
	ll h, n;
	cin >>  h>> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	rep(i,n){
		h -= a[i];
	}
	if(h <= 0) cout << "Yes"<<endl;
	else cout <<"No" << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    for (auto &e : a) cin >> e; sort(all(a));
    for (auto &e : b) cin >> e; sort(all(b));
    for (auto &e : c) cin >> e; sort(all(c));
    vector<ll> b_it(n);
    rep (i, n) {
        int ok = -1, ng = n;
        while (ng - ok > 1) {
            int med = (ng + ok) / 2;
            if (a[med] < b[i]) ok = med;
            else ng = med;
        }
        b_it[i] = ok + 1;
    }
    rep (i, n - 1) b_it[i + 1] += b_it[i];
    rep (i, n) eprintf("%lld ", b_it[i]); eprintf("\n");
    ll ans = 0;
    rep (i, n) {
        int ok = -1, ng = n;
        while (ng - ok > 1) {
            int med = (ng + ok) / 2;
            if (b[med] < c[i]) ok = med;
            else ng = med;
        }
        if (ok >= 0) ans += b_it[ok];
        eprintf("%d %d %lld\n", i, ok, b_it[ok]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
LL a[maxn];
int main()
{
    int k,n;LL sum=0;
    cin>>n>>k;
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    sort(a,a+n);
    for(int i=0;i<n-k;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	long long d, n, m;
	while (cin >> d&&d != 0) {
		cin >> n >> m;
		int a[100000] = { 0 }, sum = 0;
		for (int i = 1; i < n; i++) 
			cin >> a[i];
		a[n] = d;
		sort(a, a + n+1);
		for (int i = 0; i < m; i++) {
			int b, s=0, e=n, t;
			cin >> b;
			while (e - s > 1) {
				t = (e + s) / 2;
				if (a[t] < b) 
					s = t;
				else if (a[t] > b) 
					e = t;
				if (a[t] == b) {
					s = t;
					e = t;
				}
			}
			sum += min(b - a[s], a[e] - b);
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3360
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

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

    int h, w;
    cin >> h >> w;

    vector<string> c(h);
    vector<int> l(h, w), r(h, -1);
    rep(i, h){
        cin >> c[i];
        rep(j, w){
            if(c[i][j] == 'B'){
                chmin(l[i], j);
                chmax(r[i], j);
            }
        }
    }

    int ans = 0;
    rep(i, h){
        rep(j, h){
            if(0 <= r[j] && l[i] < w){
                chmax(ans, abs(i - j) + r[j] - l[i]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    vector<vector<vector<int>>> a (4,vector<vector<int>>(3,vector<int>(10,0)));
    rep(i,n){
        int b,f,r,v;
        cin >> b >> f >> r >> v;
        a[b-1][f-1][r-1] += v;

        
    }
    rep(i,4){
        rep(j,3){
            rep(k,10){
                cout << " " << a[i][j][k];
            }
            cout << endl;
        }
        if(i != 3){

        rep(l,20)cout << "#";
        cout << endl;
        }
    }
    
return 0;
}



Measured memory_bytes: 3156
import math

'''def ncr(n,r):
    if r> n: return 0;
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
'''

def solve(s):
    n = len(s)
    for i in range(n):
        if S[i] != S[n-1-i]:
            print("No")
            return
    k = (n-1)//2
    for i in range(k):
        if S[i] != S[k-i-1]:
            print("No")
            return
    for i in range((n+3)//2,n):
        if S[i] != S[n-1-i]:
            print("No")
            return
    print("Yes")
    
S = input();
solve(S)


Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <iostream>
#include <queue>
using namespace std;

int main() {
    int n, i;
    priority_queue<int> que;
    cin >> n;
    for (i = 2; i <= 10; i++){
        for (int j = 1; pow(j, i)<= n; j++) {
           que.push(pow(j, i)); 
        }
    }
    cout << que.top()<< endl;
    return 0;
}


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

int n,k;
set<int> d;

inline bool check(int pay){

    vector<int> digits;

    while(pay != 0){
        digits.push_back(pay%10);
        pay /= 10;
    }

    for(auto i : digits){
        if(d.find(i) != d.end()){
            return false;
        }
    }

    return true;

}


int main() {

    cin >> n >> k;

    for(int i=0; i<k; i++){
        int input;
        cin >> input;
        d.insert(input);
    }


    while(!check(n)){
        n++;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    ll n,k;
    cin>>n>>k;
    vll a(n);
    rep(i,n)cin>>a[i];

    ll cnt = 0;
    map<ll,vll> idx;
    rep(i,n){
        idx[a[i]].push_back(i);
    }
    ll s = 0;
    vll was;
    was.push_back(0);
    vector<bool> visited(n, false);
    map<ll, ll> basyo;
    basyo[0] = 0;
    visited[0] = true;
    ll roop_b,roop_e;
    while (1)
    {
        ll nexidx = upper_bound(all(idx[a[s]]), s)-idx[a[s]].begin();
        if (nexidx == idx[a[s]].size()){
            nexidx = 0;
            cnt++;
        }
        if (idx[a[s]][nexidx]+1==n)
            cnt++;
        s = (idx[a[s]][nexidx]+1)%n;
        was.push_back(s+cnt*n);
        if (visited[s]){
            roop_b = basyo[s];
            roop_e = s + n * cnt;
            break;
        }
        basyo[s] = s + cnt * n;
        visited[s] = true;
    }
    /*
    for (auto x:was){
        cout << x << " ";
    }
    cout << endl; */

    

    ll nk = roop_b + (n * k - roop_b) % (roop_e - roop_b);

    if (n * k < roop_b)
    {
        nk = n * k;
    }

    //cout << nk << endl;

    ll kidx = lower_bound(all(was),nk+1) - was.begin();
    ll l = was[kidx - 1], r = was[kidx];

    //cout << l << " " << r << endl;

    vll b;
    repf(i, l%n, n) b.push_back(a[i % n]);
    
/*for(auto x:b)
        cout << x << " ";
    cout << endl; */

map<ll, vll> bef;
rep(i, b.size())
{
    bef[b[i]].push_back(i);
    }
    vll ans;
    ll now = 0;
    while (now<b.size()){
        ll befidx = lower_bound(all(bef[b[now]]), now + 1) - bef[b[now]].begin();
        if (befidx==bef[b[now]].size()){
            ans.push_back(b[now]);
            now++;
        }
        else{
            now = bef[b[now]][befidx] + 1;
        }
    }
    for (auto x:ans){
        cout << x << " ";
    }
    cout << endl;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

long long dp[101][2];
// ??? 0
// ??? 1

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int l, k;
	cin >> l >> k;

	dp[0][0]  = 1;
	dp[0][1]  = 0;

	ll ans = 0;
	for(int i=1; i<=l; i++){
		if(i - k >= 0){
			dp[i][0] = dp[i-1][1];
			dp[i][1] = dp[i-1][0] + dp[i-k][0];
		}else{
			dp[i][0] = dp[i-1][1];
			dp[i][1] = dp[i-1][0];
		}
		ans += dp[i][1];
		//printf("w%d: %lld\n", i, dp[i][0]);
		//printf("b%d: %lld\n", i, dp[i][1]);
	}

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

Measured memory_bytes: 3120
import math

a,b,h,m = (int(x) for x in input().split())
rada = 6*m
radb = (60*h+m)/2

rad = rada-radb
c2 = a*a+b*b-2*a*b*math.cos(math.radians(rad))

print("%.12f" % math.sqrt(c2))

Measured memory_bytes: 9448
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [n, a, b] <- map (read::String -> Int) . words <$> getLine
  let digitSums = zip [1..n] $ map sumDigit [1..n]
  print . sum . map fst $ filter (\(x, s) -> s >= a && s <= b) digitSums


sumDigit::Int -> Int
sumDigit n
  | n == 0 = 0
  | otherwise = n `mod` 10 + sumDigit (n `div` 10)



Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define DBG(a) if(DBGDO) cout<<#a<<':'<<a<<endl;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define btoe(v) (v).begin(),(v).end()
#define etob(v) (v).rbegin(),(v).rend()
#define F first
#define S second
#define SZ size()
#define pow(a,b) (pow(a,b)+0.5)

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--) 
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<string> vs;typedef vector<vector<string>> vvs;

#define unmp unordered_map

#define PRIME ((lli)(1e9+7ll))
#define PRIME2 (998244353ll)
const lli TEN_18 = 1e18;
const lli TEN_9 = 1e9;
const lli TEN_5 = 1e5;

inline void debugORfast(int a=1,int b=1){
    if(a){
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
        #endif
    }
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}}

template<typename T>
void print(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin<=end){
		if(begin==-1) fl(i,0,v.SZ) cout<<setw(w)<<v[i]<<' ';
		else if(end==-1) fl(i,begin,v.SZ) cout<<setw(w)<<v[i]<<' ';
		else fl(i,begin,end) cout<<setw(w)<<v[i]<<' ';
		cout<<endl;}
	else{
		if(begin==-1) flr(i,v.SZ-1,-1) cout<<setw(w)<<v[i]<<' ';
		else if(end==-1) flr(i,begin,-1) cout<<setw(w)<<v[i]<<' ';
		else flr(i,begin,end) cout<<setw(w)<<v[i]<<' ';
		cout<<endl;
	}
}

int DBGDO=0;

lli brute(){
	return 0;
}

lli solve(){
    return 0;
}

#define AC  0
#define WA  1
#define TLE 2
#define RE  3 

int main()
{
	debugORfast(0,1);
	vi freq(4,0);
	w(tt){
		string s; cin>>s;
		if(s=="AC") freq[AC]++;
		else if(s=="WA") freq[WA]++;
		else if(s=="TLE") freq[TLE]++;
		else freq[RE]++;
	}
	cout<<"AC x "<<freq[AC]<<endl;
	cout<<"WA x "<<freq[WA]<<endl;
	cout<<"TLE x "<<freq[TLE]<<endl;
	cout<<"RE x "<<freq[RE]<<endl;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

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

map<pi,ll>m;
ll N;

int main()
{
  cin >> N;
  rep(i,N){
    ll x,y,z; cin >> x >> y >> z;
    m[pi(x,y)] = z;
  }
  ll res = 0;
  for(auto z:m){
    ll x=z.first.first,y=z.first.second;
    ll a = 0;
    if(m.count(pi(x,y))) a += m[pi(x,y)];
    if(m.count(pi(x+1,y))) a += m[pi(x+1,y)];
    if(m.count(pi(x,y+1))) a += m[pi(x,y+1)];
    if(m.count(pi(x+1,y+1))) a += m[pi(x+1,y+1)];
    res = max(res, a);
    a = 0;
    if(m.count(pi(x,y))) a += m[pi(x,y)];        
    if(m.count(pi(x-1,y))) a += m[pi(x-1,y)];
    if(m.count(pi(x,y-1))) a += m[pi(x,y-1)];
    if(m.count(pi(x-1,y-1))) a += m[pi(x-1,y-1)];
    res = max(res, a);
    a = 0;
    if(m.count(pi(x,y))) a += m[pi(x,y)];
    if(m.count(pi(x-1,y))) a += m[pi(x-1,y)];
    if(m.count(pi(x,y+1))) a += m[pi(x,y+1)];
    if(m.count(pi(x-1,y+1))) a += m[pi(x-1,y+1)];
    res = max(res, a);
    a = 0;
    if(m.count(pi(x,y))) a += m[pi(x,y)];
    if(m.count(pi(x,y-1))) a += m[pi(x,y-1)];
    if(m.count(pi(x+1,y-1))) a += m[pi(x+1,y-1)];
    if(m.count(pi(x+1,y))) a += m[pi(x+1,y)];        
  }
  cout << res << " / 1\n";
  return 0;
}

Measured memory_bytes: 9336
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
	int n,m,d[200005],t[200005];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&d[i]);
	scanf("%d",&m);
	for(int i=0;i<m;i++)
		scanf("%d",&t[i]);
	sort(d,d+n);
	sort(t,t+m);
	int s=0;
	for(int i=0,j=0;i<n&&j<m;)
	{
		if(d[i]==t[j])
		{
			i++;j++;s++;
		}
		else if(d[i]>t[j])j++;
		else i++;
	}
	if(s==m)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a; i < b; i++)

int main() {

	ll n;
	cin >> n;
	string ans;
	
	while (n) {
		--n;
		ans += (char)('a' + (n % 26));
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    vector<pair<ll, ll>> p(n);
    for(int i=0; i<n; i++){
        ll a,b; cin >> a >> b;
        p[i]=make_pair(b,a);
    }
    sort(p.begin(), p.end());
    ll asum=0;
    ll limit=0;
    for(int i=0; i<n; i++){
        asum += p[i].second; limit = p[i].first;
        if(limit<asum){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 6428
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    vector<vector<int>> edge(n), redge(n);
    rep(i, m)
    {
        int s, t;
        cin >> s >> t;
        s--;
        t--;

        edge[s].push_back(t);
        redge[t].push_back(s);
    }

    vector<double> dp(n);
    double result = n;
    rep(i, n)
    {
        rrep(j, n)
        {
            dp[j] = 0.0;
            for (const int e : edge[j]) {
                dp[j] += (dp[e] + 1.0) / edge[j].size();
            }

            if (j == i && edge[j].size() > 1) {
                double m = 0.0;
                for (const int e : edge[j]) {
                    m = max(m, dp[e] + 1.0);
                }
                dp[j] -= m / edge[j].size();
                dp[j] *= edge[j].size();
                dp[j] /= edge[j].size() - 1;
            }
        }
        result = min(result, dp[0]);
    }
    cout << fixed << setprecision(10) << result << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

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;

vi bin;
string s;
void binary(int num){
  rep(i, (int)s.size()-1){
    bin[i] = num%2;
    num /= 2;
  }
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  cin >> s;
  bin = vi((int)s.size()-1);
  ll ans = 0;
  ll tmp = 0;
  ll lim = pow(2,(int)s.size()-1);
  rep(i, lim){
    rep(j,(int)s.size()){
      if(j == (int)s.size()-1){
        if(tmp > 0){
          ans += tmp*10 + s[j] - '0';
          tmp = 0;
        }else{
          ans += s[j]-'0';
        }
        break;
      }
      if(bin[j]==1){
        if(tmp > 0){
          ans += tmp*10 + s[j] - '0';
          tmp = 0;
        }else{
          ans += s[j] - '0';
        }
      }else{
        tmp *= 10;
        tmp += s[j] - '0';
      }
    }
    binary(i+1);
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <cctype>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

vector<int> G[100005];
int d[500005],us[500005],n,f=0,du[500005],p;
void dfs(int u)
{
    us[u]=1;
    int i,ff=0;
    for(i=0;i<G[u].size();i++)
    {
        int v=G[u][i];
        if(us[v]==0)
        {
            dfs(v);
            if(d[v]>=3)
            {
                f=1;
            }
            if(d[v]==2)
            {
                ff=1;
            }
            d[u]+=d[v]%2;
        }
    }
    if(ff==1&&d[u]==0&&u==p)
    {
        f=1;
    }
    d[u]++;
}
int main()
{
    int i;
    scanf("%d",&n);
    for(i=1;i<n;i++)
    {
        int v,u;
        scanf("%d %d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
        du[u]++;
        du[v]++;
    }
    for(i=1;i<=n;i++)
    {
        if(du[i]>=2)
        {
            p=i;
            break;
        }
    }
    G[0].push_back(p);
    G[p].push_back(0);
    dfs(0);
    /*for(i=0;i<=n;i++)
    {
        printf("%d ",d[i]);
    }
    printf("\n");*/
    if(f==1)
    {
        printf("First\n");
    }
    else
    {
        printf("Second\n");
    }
    return 0;
}


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

int main(){
  char s[3];
  cin >> s;
  int day = 0;
  int cnt=0;
  rep(i,3){
    int j = i;
    while(s[i]=='R'){
      cnt++;
      i++;
    }
    day = max(cnt,day);
    cnt = 0;
    i =j;
  }
  cout << day << endl;
}


Measured memory_bytes: 3592
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1e9 + 7;

int ctoi(char c)
{
    return (int)(c - 48);
}

int main(void)
{
    int K;
    string N;
    ll ans;
    int i, j, k;
    int d;
    static int dp[110][4][2];

    cin >> N >> K;

    int l = N.size();

    dp[0][0][0] = 1;

    rep(i, 0, l - 1)
    {
        int nd = ctoi(N[i]);
        rep(j, 0, 3)
        {
            rep(k, 0, 1)
            {

                rep(d, 0, 9)
                {
                    int ni = i + 1, nj = j, nk = k;
                    if (d != 0)
                    {
                        nj++;
                        if (nj > K)
                        {
                            continue;
                        }
                    }

                    if (k == 0)
                    {
                        if (nd < d)
                        {
                            continue;
                        }
                        else if (nd > d)
                        {
                            nk = 1;
                        }
                    }

                    dp[ni][nj][nk] += dp[i][j][k];
                }
            }
        }
    }

    cout << dp[l][K][0] + dp[l][K][1] << endl;
}

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

typedef long long ll;
int N,K;
vector<pair<ll, ll>>v;

int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++){
		ll x,y;
		cin>>x>>y;
		v.push_back(make_pair(x,y));
	}
	sort(v.begin(),v.end());
	ll ans=4*1000000000000000000;
	for(int i=0;i<v.size()-1;i++){
		for(int j=i+1;j<v.size();j++){
			int num=j-i+1;
			if(num<K)continue;
			vector<ll>y;
			for(int k=i;k<=j;k++){
				y.push_back(v[k].second);
			}
			sort(y.begin(),y.end());
			ll ydis=10000000000;
			for(int k=0;k<=y.size()-K;k++){
				ydis=min(ydis,y[k+K-1]-y[k]);
			}
			ll xdis=v[j].first-v[i].first;
			ans=min(ans,xdis*ydis);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n, x = 0;
	char str[101] = {0};

	scanf("%d%s", &n, str);
	n = 0;
	for(int i=0; str[i] != '\0'; i++) {
		if(str[i] == 'I')
			x++;
		else if(str[i] == 'D')
			x--;
		if(x > n)
			n = x;
	}
	printf("%d", n);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> xs(n), ys(n);
    for (int i = 0; i < n; ++i) {
        cin >> xs[i] >> ys[i];
    }
    auto zx = xs, zy = ys;
    sort(zx.begin(), zx.end());
    zx.erase(unique(zx.begin(), zx.end()), zx.end());
    sort(zy.begin(), zy.end());
    zy.erase(unique(zy.begin(), zy.end()), zy.end());
    int h = zy.size(), w = zx.size();
    vector<vector<int>> v(h+1, vector<int> (w+1));
    auto fy = [&zy](int y){ return lower_bound(zy.begin(),zy.end(), y) - zy.begin(); };
    auto fx = [&zx](int x){ return lower_bound(zx.begin(),zx.end(), x) - zx.begin(); };
    for (int i = 0; i < n; ++i) {
        v[fy(ys[i])+1][fx(xs[i])+1]++;
    }
    for (int i = 0; i <= h; ++i) {
        for (int j = 0; j <= w; ++j) {
            if(i) v[i][j] += v[i-1][j];
            if(j) v[i][j] += v[i][j-1];
            if(i && j) v[i][j] -= v[i-1][j-1];
        }
    }
    for (int i = 0; i < m; ++i) {
        int x1, y1, x2, y2;
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        x1 = fx(x1), x2 = fx(x2+1), y1 = fy(y1), y2 = fy(y2+1);
        printf("%d\n", v[y2][x2]-v[y2][x1]-v[y1][x2]+v[y1][x1]);
    }
    return 0;
}


Measured memory_bytes: 100812
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
 
const ll INF=1e9+7;

int main(){
    ll a,b;
    cin >> a >> b;
    cout << max(0LL,a-2*b) << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
heap = list(map(int, input().split()))

for i, a in enumerate(heap, start=1):  # 1オリジンにするためのstart=1
    print(f'node {i}: key = {a}, ', end='')
    # 親存在するときだけ出力する。
    if i//2 != 0:
        # heapは実際には0オリジンなので-1して調節する
        print(f'parent key = {heap[i//2 -1 ]}, ', end='')
    # 左子が存在するときだけ出力する
    if 2 * i <= N:
        print(f'left key = {heap[2*i - 1]}, ', end='')
    # 右子
    if 2 * i + 1 <= N:
        print(f'right key = {heap[2*i]}, ', end='')
    print()



Measured memory_bytes: 5692
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(void){
    map<string,map<string,int>> item;
    int N,F;
    cin>>N>>F;
    V<string> all;
    REP(i,N){
        int M;cin>>M;
        V<string> in(M);
        REP(j,M){
            cin>>in[j];
            all.push_back(in[j]);
        }
        REP(j,M){
            FOR(k,j+1,M){
                item[in[j]][in[k]]++;
                item[in[k]][in[j]]++;
            }
        }
    }
    sort(All(all));
    all.erase(unique(All(all)),all.end());
    int cnt=0;
    V<pair<int,int>> ans;
    REP(i,all.size()){
        FOR(j,i+1,all.size()){
            if(item[all[i]][all[j]]>=F){
                cnt++;
                ans.push_back(make_pair(i,j));
            }
        }
    }
    cout<<cnt<<endl;
    REP(i,cnt){
        cout<<all[ans[i].F]<<" "<<all[ans[i].S]<<endl;
    }
}


Measured memory_bytes: 34856
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void)
{
  int a, b;
  string symbol;
  cin >> a >> b;
  
  if (a < b)
  {
      symbol = '<';
  }
  else if (a > b)
  {
      symbol = ">";
  }
  else
  {
      symbol = "==";
  }
  cout << "a " << symbol << " b" << endl;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    deque<ll> d;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n){
        if(i%2 == 1) d.push_front(a[i]);
        else d.push_back(a[i]);
    }
    if(n%2 == 0) rep(i,n) cout << d[i] << " ";
    else{
        for(int i=n-1; i>=0; i--){
            cout << d[i] << " ";
        }
    }
    cout << endl;
    

}

Measured memory_bytes: 6356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

    int pos_end = s.size() - 1;

    string t[] = { "dream", "dreamer", "erase", "eraser" };

    while (pos_end >= 0) {
        bool match = false;

        for (auto a : t) {
            int b = a.size();
            int pos_start = pos_end - (b - 1);

            if (pos_start < 0) {
                continue;
            }

            if (s.substr(pos_start, b) == a) {
                match = true;
                pos_end = pos_start - 1;

                break;
            }
        }

        if (!match) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <set>

class TaskC {
public:
    void solve(std::istream &in, std::ostream &out) {
        int N;
        in >> N;
        std::set<int> numbers;
        for (int i = 0; i < N; ++i) {
            int number;
            in >> number;
            if (numbers.find(number) != numbers.end()) {
                numbers.erase(number);
            } else {
                numbers.insert(number);
            }
        }
        out << numbers.size() << '\n';
    }
};


int main() {
    TaskC solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4864
#include<stdio.h>

int main(void){
    int n, x, bound=1, i;
    scanf("%d %d", &n, &x);
    int d=0, l[n];
    for(i=0; i<n; i++){
        scanf("%d", &l[i]);
        d = d+ l[i];
        if(d<=x) bound++;
        else break;
    }
    printf("%d\n", bound);

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  
  for(int i = 0; 4*i < 100; i++){
    for(int j = 0; 7*j < 100; j++){
      if(n == 4*i + 7*j){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
  

Measured memory_bytes: 384
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG abc/abc051/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    rep(i, ty - sy){
        cout << 'U';
    }
    rep(i, tx - sx){
        cout << 'R';
    }
    rep(i, ty - sy){
        cout << 'D';
    }
    rep(i, tx - sx){
        cout << 'L';
    }
    cout << 'L';
    rep(i, ty - sy + 1){
        cout << 'U';
    }
    rep(i, tx - sx + 1){
        cout << 'R';
    }
    cout << 'D' << 'R';
    rep(i, ty - sy + 1){
        cout << 'D';
    }
    rep(i, tx - sx + 1){
        cout << 'L';
    }
    cout << 'U' << "\n";
    return 0;
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 3007;
const int MOD = 1e9 + 7;

int n, m;
int dp[MAXN][2];

void init ();
void input ();
void work ();

void add ( int &x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
}



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	cin >> n >> m;
}

void work ()
{
	// main work

	lpi ( i, 0, n ) dp[i][!i] = 1;
	lpi ( _m, 1, m ){
		lpi ( i, 0, n ){
			lp ( j, 0, 2 ){
				add ( dp[i][( !i )||j], dp[i+1][j] );
			}
		}
		lpd ( i, n, 0 ) lp ( j, 0, 2 ) dp[i][j] = dp[i-1][j];
		dp[0][0] = dp[0][1] = 0;
		lpi ( i, 0, n ){
			lp ( j, 0, 2 ){
				add ( dp[i][( !i )||j], dp[i+1][j] );
			}
		}
	}

	int ans = 0;
	lpi ( i, 0, n ) add ( ans, dp[i][1] );
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

#N, M, L  = (int(i) for i in input().split())
bingo = [[int(i) for i in input().split()] for i in range(3)]
N = int(input())
Nums = [int(input()) for i in range(N)]

#print(Nums)
for num in Nums:
    #print(num)
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == num:
                bingo[i][j] = "ok"

#print(bingo)

for i in range(3):
    if bingo[i][0] == "ok" and bingo[i][1] == "ok" and bingo[i][2] == "ok":
        print("Yes")
        exit()

for j in range(3):
    if bingo[0][j] == "ok" and bingo[1][j] == "ok" and bingo[2][j] == "ok":
        print("Yes")
        exit()

if bingo[0][0] == "ok" and bingo[1][1] == "ok" and bingo[2][2] == "ok":
    print("Yes")
    exit()

if bingo[0][2] == "ok" and bingo[1][1] == "ok" and bingo[2][0] == "ok":
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long int ll;

int main() {
    int M; cin >> M;
    int D; cin >> D;

    int counter = 0;
    for (int i=1; i<=M; i++) {
        for (int j=1; j<=D; j++) {
          	string d = to_string(j);
            if (d.size() < 2) continue;
            int d1 = d.at(0) - '0';
            int d2 = d.at(1) - '0';
          
            if (d1 < 2 || d2 < 2) continue;

            if (d1 * d2 == i) counter++;
        }
    }

    cout << counter << endl;
}

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

using namespace std;

int main(){
    long long int N,ans=0;
    cin >> N;
    vector<long long int> A(N);
    map<long long int,long long int> tas,hiku;
    for(int i=0;i<N;i++){
        cin >> A[i];
        tas[A[i]+i+1]++;
        hiku[i+1-A[i]]++;
    }

    for(int i=0;i<N;i++){
        hiku[i+1-A[i]]--;
        ans += hiku[A[i]+i+1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 39004
#include <math.h>

#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long 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 FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  cout << fixed << setprecision(5);
  int r;
  cin >> r;
  cout << M_PI * 2 * r << endl;
  return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

void solve() {

}

ll f(ll n) {
  ll cnt = 0;
  for(ll x=1;x*x<=n;++x) {
    for(ll y=1;x*x+y*y+x*y<=n;++y) {
      for(ll z=1;x*x+y*y+z*z+x*y+y*z+z*x<=n;++z) {
	if( x*x+y*y+z*z+x*y+y*z+z*x == n ) {
	  ++cnt;
	}
      }
    }
  }
  return cnt;
}

int main() {
  ll N;
  cin >> N;
  REP(i,1,N+1) {
    cout << f(i) << endl;
  } 
  return 0;
}


Measured memory_bytes: 3568
#!/usr/bin/env python3

def main():
    N = int(input())
    A = list(map(int, input().split()))
    tmp_max = 0
    ans = 0
    for i in range(N):
        if A[i] < tmp_max:
            ans += tmp_max - A[i]
        else:
            tmp_max = A[i]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32252
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<unordered_map>
#include<string.h>
#include<math.h>
using namespace std;
using ll = long long;
int main(){
    int N;
    string S;
    cin >> N >> S;
    if(N == 1 || N % 2 == 1){cout << "No";return 0;}
    string ls = S.substr(0, N/2);
    string rs = S.substr(N/2, N/2);
    if(ls.compare(rs)==0)cout << "Yes";
    else cout << "No";
}



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



int main() {
    int x;
    cin >> x;
    int x2 = std::pow(x, 2);
    int x3 = std::pow(x, 3);

    cout << x + x2 + x3 << endl;
    
}

Measured memory_bytes: 4060