akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, X; cin >> N >> X;
  cinv(L,N);
  
  //main
  int d = 0;
  int count = 1;
  for(int i=0; i<N; i++){
    d += L[i];
    if(d > X){ break;}
    count ++;
  }
  
  // output
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main (){
        char a[3],b[3];
        cin>>a;
        cin>>b;
        int cnt=0;
        for(int i=0;i<3;i++){
                if(a[i]==b[i]) cnt++;
        }
        cout<<cnt<<endl;
        return 0;
}

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

int main()
{
    long long int x,d,moves ;
    cin>>x>>moves>>d ;
    x=abs(x) ;
    if(x>0 && (x/d)>=moves)
    {
        long long int ans=x-moves*d ;
        cout<<abs(ans)<<endl;
        return 0 ;
    }
    long long int y=(x/d) ;
    x=x-(y*d) ;
    moves-=y ;
    if(moves%2==0)
        cout<<abs(x)<<endl ;
    else
        cout<<min(abs(x-d),abs(x+d))<<endl ;
    return 0;
}


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

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
ll N;

void solve() {
	
	cin >> N;

	ll ans = 0;

	vl div;

	for (ll i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			div.eb(i);
			div.eb(N / i);
		}
	}

	for (int i = 0; i < div.size(); i++) {
		if (div[i] == 1) continue;
		if (N / (div[i] - 1) == N % (div[i] - 1)) ans += div[i] - 1;
	}

	cout << ans << endl;
	

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 384
#include<cstdio>
using namespace std;
static const int MAX_N = 2999;

int N;
double p[MAX_N];
double memo[MAX_N + 1][MAX_N + 1];

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++) scanf("%lf", &p[i]);
	
	for(int i = 0; i <= N; i++){
		for(int j = 0; j <= i; j++){
			if(i == 0 && j == 0) memo[i][j] = 1.0;
			else if(j == 0) memo[i][j] = memo[i - 1][j] * (1.0 - p[i - 1]);
			else memo[i][j] = memo[i - 1][j] * (1.0 - p[i - 1]) + memo[i - 1][j - 1] * p[i - 1];
		}
	}
	double res = 0.0;
	for(int i = N / 2 + 1; i <= N; i++) res += memo[N][i];
	printf("%.10lf\n", res);
	return 0;
}

Measured memory_bytes: 68864
/**
*    author:  boutarou
*    created: 11.06.2020 22:58:02
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

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

const int INF = 1e8;
const double PI = 3.1415926535897932;

int n, m;
int a[1005], b[1005], c[1005];
int dist[105][105];

int ans = 0;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
	}
	
	rep(i, n) {
		rep(j, n) {
			if (i == j) dist[i][j] = 0;
			else dist[i][j] = INF;
		}
	}
	rep(i, m) {
		dist[a[i]][b[i]] = c[i];
		dist[b[i]][a[i]] = c[i];
	}
	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				chmin(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	rep(i, m) {
		if (dist[a[i]][b[i]] != c[i]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
    int n;
    
    while(1){
        cin>>n;
        if(n==0){
        return 0;
        }
        vector<int> a(n);
        for(int i=0;i<n;i++){
            cin>>a.at(i);
        }
        sort(a.begin(),a.end());
    
        vector<int> ans(n-1);
        for(int i=0;i<n-1;i++){
            ans.at(i)=a.at(i+1)-a.at(i);
        }
        sort(ans.begin(),ans.end());
        cout<<ans.at(0)<<endl;
    }
}
    


Measured memory_bytes: 3132
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, T &b) {a = max(a, b);}
template <class T> inline T chmin(T &a, T &b) {a = min(a, b);}

constexpr int MOD = 1e9 + 7;
constexpr ll INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, r; cin>>n>>r;
    vector<int> id2p(n);
    for(int i=0; i<n; i++){
        int p; cin>>p;
        id2p[i] = --p;
    }

    vector<bool> visited(n, false);
    vector<int> groupNum;
    for(int i=0; i<n; i++){
        int cur = i;
        int cnt = 0;
        while(!visited[cur]){
            visited[cur] = true;
            cur = id2p[cur];
            cnt++;
        }

        if(cnt) groupNum.emplace_back(cnt);
    }

    r = min(r, n - r);
    bitset<150001> dp;
    dp[0] = 1;
    for(auto i : groupNum){
        dp |= (dp << i);
    }

    cout << (dp[r] ? "Yes" : "No") << endl;
}


Measured memory_bytes: 6024
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    double r, s;
    double x, y;

    Scanner sc = new Scanner(System.in);
    void run(){
	x=0;
	y=0;
	String[] st = sc.next().split(",");
	r = Double.parseDouble(st[0]);
	s = 90;
	while(r!=0){
	    x += r*Math.cos(Math.toRadians(s));
	    y += r*Math.sin(Math.toRadians(s));
	    s -= Double.parseDouble(st[1]);
	    st = sc.next().split(",");
	    r = Double.parseDouble(st[0]);
	    //System.out.println(x+" "+y);
	}
	System.out.printf("%d\n%d\n", (int)x, (int)y);
    }
}

Measured memory_bytes: 17160
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

void solve()
{
	string str;
	cin >> str;
	int n = str.length();
	bool f1 = true, f2 = true, f3 = true;
	int l = 0, r = n - 1;
	while (l < r)
	{
		if (str[l] != str[r])
		{
			cout << "No" << ln;
			return;
		}
		l++;
		r--;
	}
	int lim = (n - 1) / 2;
	l = 0, r = lim - 1;
	while (l < r)
	{
		if (str[l] != str[r])
		{
			cout << "No" << ln;
			return;
		}
		l++;
		r--;
	}
	l = lim + 1, r = n - 1;
	while (l < r)
	{
		if (str[l] != str[r])
		{
			cout << "No" << ln;
			return;
		}
		l++;
		r--;
	}
	cout << "Yes" << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
int a,b,c,d,e,f,g,h,t,s1,s2;
int main(){
	cin>>a>>b>>c>>d>>e>>f;a*=100;b*=100;
	for(int i=0;i<=30&&i*a<=f;i++)for(int j=0;j<=30&&i*a+j*b<=f;j++)if(i+j){
		g=i*a+j*b;h=min(g*e/100,f-g);t=0;
		for(int k=0;k<=100&&c*k<=h;k++)for(int l=0;l<=100&&c*k+d*l<=h;l++)t=max(t,c*k+d*l);
		if(s1==0||t*(s1+s2)>s2*(g+t)){s1=g;s2=t;}
	}
	cout<<s1+s2<<" "<<s2<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var D, T, S int
	fmt.Scan(&D, &T, &S)

	if D / S > T {
		fmt.Println("No")
		return
	}

	if (D / S) == T && D % S != 0 {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
 
using namespace std;
const int N = 51;
vector<vector<int>> res(N, vector<int>(N, 0));
 
int dx[8] = {1,1,1,0,0,-1,-1,-1};
int dy[8] = {1,0,-1,1,-1,1,0,-1};
 
int main(){
    ios_base::sync_with_stdio (false);
    //freopen ("joke.in","r",stdin);
	//freopen ("joke.out","w",stdout);
	int H, W;
  	cin >> H >> W;
  	vector<string> g;
  	string s;
  	for(int i=0; i<H; ++i){
    	cin >> s;
      	g.push_back(s);
    }
  	
  	for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
        	for(int d = 0; d < 8; ++d){
            	int xx = x + dx[d];
              	int yy = y + dy[d];
              	if(xx<W && xx>=0 && yy<H && yy>=0){
                	if(g[yy][xx]=='#'){
                    	res[y][x]++;
                    }
                }
            }
        }
    }
  	
    for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
          if(g[y][x]=='#'){
          	cout << '#';
          }else{
          	cout << res[y][x];
          }
        }
      	cout << endl;
    }
  
    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int dp[2][101];

int main() {
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N));
    rep(i, 2) rep(j, N) cin >> A[i][j];

    rep(i, N) dp[0][i + 1] = dp[0][i] + A[0][i];
    rep(i, N) dp[1][i + 1] = max(dp[0][i + 1], dp[1][i]) + A[1][i];

    cout << dp[1][N] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  
  int N,Y;
  int m,g,s,y,count=0;
  scanf("%d%d",&N,&Y);
  y=Y/1000;
  for(m=0;m<=N;m++){
    for(g=0;g<=N;g++){
      if(y-9*m-4*g==N&&N-m-g>=0){
        s=N-m-g;
         printf("%d %d %d\n",m,g,s);
        //count++;
        return 0;
       }
    }
  }
  //if(count=0)
    printf("-1 -1 -1");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename T> struct grid : public vector<vector<T>> {
    int n, m;
    grid(int n, int m) : vector<vector<T>>(n, vector<T>(m)), n(n), m(m) {}
    grid(int n, int m, T zero) : vector<vector<T>>(n, vector<T>(m, zero)), n(n), m(m) {}
    grid(const grid& a) : vector<vector<T>>(a), n(a.n), m(a.m) {}
};
template <typename Iter, typename T> int gt(Iter L, Iter R, T v) { return upper_bound(L, R, v) - L; }
template <typename Iter, typename T> int ge(Iter L, Iter R, T v) { return lower_bound(L, R, v) - L; }
template <typename Iter, typename T> int lt(Iter L, Iter R, T v) { return lower_bound(L, R, v) - L - 1; }
template <typename Iter, typename T> int le(Iter L, Iter R, T v) { return upper_bound(L, R, v) - L - 1; }
template <typename Bst, typename T> typename Bst::const_iterator gt(const Bst& bst, T v) { return bst.upper_bound(v); }
template <typename Bst, typename T> typename Bst::const_iterator ge(const Bst& bst, T v) { return bst.lower_bound(v); }
template <typename Bst, typename T> typename Bst::const_iterator lt(const Bst& bst, T v) { return bst.lower_bound(v) == bst.begin() ? bst.end() : --bst.lower_bound(v); }
template <typename Bst, typename T> typename Bst::const_iterator le(const Bst& bst, T v) { return bst.upper_bound(v) == bst.begin() ? bst.end() : --bst.upper_bound(v); }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for(int i = 1; i < n; i++) {
        cin >> a[i];
    }
    partial_sum(a.begin(), a.end(), a.begin());
    grid<pair<int, int>> b(m, n);
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> b[j][i].first;
            b[j][i].second = i;
        }
    }
    grid<ll> happiness(n + 2, n + 2);
    for(int j = 0; j < m; j++) {
        sort(b[j].begin(), b[j].end(), greater<pair<int, int>>());
        set<int> updated = {-1, n};
        for(auto& p : b[j]) {
            int i = p.second, u = *lt(updated, i), r = *gt(updated, i);
            happiness[u + 1][i] += p.first;
            happiness[i + 1][r] += p.first;
            happiness[i + 1][i] -= p.first;
            happiness[u + 1][r] -= p.first;
            updated.insert(i);
        }
    }
    for(int L = 0; L < n; L++) {
        for(int R = 0; R < n; R++) {
            happiness[L][R] +=
                (L ? happiness[L - 1][R] : 0) +
                (R ? happiness[L][R - 1] : 0) -
                (L and R ? happiness[L - 1][R - 1] : 0);
        }
    }
    ll ans = 0;
    for(int L = 0; L < n; L++) {
        for(int R = L; R < n; R++) {
            ans = max(ans, happiness[L][R] - (a[R] - a[L]));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 206192
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vint x(n);
	rep(i, n) {
		cin >> x[i];
	}
	int xa, xb, xc;
	int tmp;
	int cnt;
	int min = 2147483647;
	rep(i, pow(4, n)) {
		xa = 0;xb = 0;xc = 0;
		tmp = i;
		cnt = 0;
		rep(j, n) {
			if (tmp % 4 == 0) {
				if (xa != 0) {
					cnt += 10;
				}
				xa += x[j];
			}
			if (tmp % 4 == 1) {
				if (xb != 0) {
					cnt += 10;
				}
				xb += x[j];
			}
			if (tmp % 4 == 2) {
				if (xc != 0) {
					cnt += 10;
				}
				xc += x[j];
			}
			tmp /= 4;
		}
		if (xa == 0 || xb == 0 || xc == 0) {
			continue;
		}
		cnt += abs(a - xa) + abs(b - xb) + abs(c - xc);
		if (min > cnt) {
			min = cnt;
		}
	}
	cout << min << endl;
	return 0;
}

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

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

    int len = s.size();
    int ans = 1;
    for(int i=0; i<len-1; i++) {
        if(s.at(i)!=s.at(i+1)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        var dist = new bool[N];

        var btn = 0;
        var ans = -1;
        var cnt = 0;
        for (int i = 0; i < N; i++) {
            if (dist[btn]) break;
            dist[btn] = true;

            if (a[btn] == 2) {
                ans = cnt + 1;
                break;
            }
            btn = a[btn] - 1;
            cnt++;
        }
        WriteLine(ans);

    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

int main(){
  int n,a;
  bool f=0;
  cin>>n;
  fr(i,n){cin>>a;f|=a%2;}
  cout<<(f?"first":"second")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

void solve() {
  string s; cin >> s;
  int p = 0;
  rep(i,s.size()) {
    if (s[i] == 'p') ++p;
  }
  cout << s.size() / 2 - p << endl;
  return;
}

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


Measured memory_bytes: 512
#include <stdio.h>
int main () {
  int n;
  int k;
  int i;
  int ans = 0;

  scanf ("%d %d", &n, &k);

  int h[n];

  for (i = 0; i < n; i++) {
    scanf ("%d", &h[i]);
  }

  for (i = 0; i < n; i++) {
    if (k <= h[i] )  ans++;
  }

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

  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll V, E;
    cin >> V >> E;
    Graph graph(V, vector<ll>(V, INF));
    rep(i, E) {
        ll s, t, d;
        cin >> s >> t >> d;
        graph[s][t] = d;
    }
    rep(k, V) {
        rep(i, V) {
            rep(j, V) {
                graph[i][j] = min(graph[i][k] + graph[k][j], graph[i][j]);
            }
        }
    }
    bool ok = false;
    rep(k, V) {
        if (graph[k][k] < 0) ok = true;
    }
    if (ok) {
        cout << "NEGATIVE CYCLE" << '\n';
        return;
    }
    rep(i, V) {
        rep(j, V) {
            ll ans = graph[i][j];
            if (i == j) ans = 0;
            if (j > 0)cout << ' ';
            if (ans <= INF && ans >= INF / 2) {
                cout << "INF";
            } else {
                cout << ans;
            }
        }
        cout << '\n';
    }
}

//0 1 3 4
//INF 0 2 3
//INF INF 0 1
//INF INF 7 0
//0 1 3 4
//INF 0 2 3
//INF INF 0 1
//INF INF 7 0
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 3268
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <map>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define CHECK(x)  cout << #x << " = " << (x) << endl
#define FINA(y) cout << (y) << endl

int main(){

  char s[19];
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';

  FINA(s);

 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#include<cmath>
# include <set>
# include <iomanip>
# include <functional>
# include <queue>
#include<map>
#define INF 1000000009;
using namespace std;
int gcd(int a, int b) {
	while (a % b != 0) {
		int c = 0;
		c = a % b;
		a = b;
		b = c;
	}
	return  b;
}


int main() {
	string manji;
	int naga, mizi;
	cin >> manji;
	for (int i = 0; i < manji.size(); i++) {
		if (manji[i] == 'A') {
			mizi = i + 1;
			break;
		}
	}
	for (int i = manji.size()-1; i >= 0; i--) {
		//cout << manji[i] << endl;
		if (manji[i] == 'Z') {
			naga = i + 1;
			break;
		}
	}
	//cout << naga << endl << mizi << endl;
	cout << naga - mizi+1 << endl;
	return 0;
}


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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int N;
    cin >> N;
    cout << N*N*N << endl;
}

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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    string s ;
    cin>> s ;
    if(s[0]==s[2]) cout<< "Yes" ;
    else cout<< "No" ;
  }


Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    if i - 2 >= 0:
        dp[i] = min(dp[i-1] + abs(arr[i] - arr[i-1]), dp[i-2] + abs(arr[i] - arr[i-2]))
    else:
        dp[i] = dp[i-1] + abs(arr[i] - arr[i-1])
print(dp[n-1])

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

int main(){
    int n,x;
    cin>>n>>x;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l.at(i);
        }
    int ans=1,d=0;
    for(int i=0;i<n;i++){
        d+=l.at(i);
        if(d<=x){
            ans+=1;
        }else{
            cout<<ans<<endl;
            return 0;
            }
    }
    cout<<ans;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
m = 1000
k = 0
for i in range(N):
    if i == N -1:
        m += A[N - 1] * k
    
    else:
        if A[i] < A[i + 1]:
            k += m // A[i]
            m = m % A[i]
        elif A[i] > A[i + 1]:
            m += A[i] * k
            k = 0
print(m)

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<vi> vvi;

int main()
{
    int h;
    while(cin >>h,h)
    {
        vvi f(h,vi(5));
        for(int i=h-1; i>=0; --i)rep(j,5) cin >>f[i][j];

        int ans=0;
        int l[6]={0,0,1,0,1,2};
        int r[6]={4,3,4,2,3,4};

        while(1)
        {
            int del=0;

            //delete
            rep(i,h)
            {
                rep(j,6)
                {
                    int num=f[i][l[j]];
                    if(num==0) continue;

                    bool valid=true;
                    for(int k=l[j]+1; k<=r[j]; ++k)
                    {
                        if(f[i][k]!=num) valid=false;
                    }

                    if(valid)
                    {
                        ans+=num*(r[j]-l[j]+1);
                        for(int k=l[j]; k<=r[j]; ++k)
                            f[i][k]=0;
                        ++del;
                    }
                }
            }

            if(!del) break;

            //fall
            rep(i,5)
            {
                //i-th column
                rep(j,h)
                {
                    bool all0=true;
                    for(int k=j; k<h; ++k)
                    {
                        if(f[k][i]!=0) all0=false;
                    }
                    if(all0) continue;

                    //printf("i,j %d,%d\n", i,j);
                    if(f[j][i]==0)
                    {
                        for(int k=j+1; k<h; ++k)
                            f[k-1][i]=f[k][i];
                        f[h-1][i]=0;
                        --j;
                    }
                }
            }

        }

        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3136
var lines = [];
var result = 0;
var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    N = Number(lines[0]);
    A = lines[1].split(" ").map(value => Number(value));

    A.sort((a, b) => Math.abs(b) - Math.abs(a));

    for (var i = 0; i < N - 1; i++) {
        if (A[i] < 0) { A[i] *= (-1); A[i + 1] *= (-1) }
        result += A[i];
    }

    console.log(result + A[N - 1]);
});

Measured memory_bytes: 33084
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		char[] c = sc.next().toCharArray();
		int n = c.length;
		int k = sc.nextInt();

		for (int i = 0; i < n; i++) {
			if (c[i] == 'a') {
				continue;
			}
			int t = 'z' + 1 - c[i];
			if (t <= k) {
				k -= t;
				c[i] = 'a';
			}
		}
		k %= ('z' - 'a' + 1);
		c[c.length - 1] += k;
		while ('z' < c[c.length - 1]) {
			c[c.length - 1] -= ('z' - 'a' + 1);
		}
		System.out.println(c);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 13740
import java.util.*;

class Main {
	Scanner sc;
	int A, B;
	
	private void calc() {
		sc = new Scanner(System.in);
		A = sc.nextInt();
		B = sc.nextInt();
		
		System.out.println(sub());
	}
	
	private int sub() {
		double amin = A/0.08;
		double amaxe = (A+1)/0.08;
		
		double bmin = B/0.1;
		double bmaxe = (B+1)/0.1;
		
		if (amin >= bmaxe) return -1;
		if (bmin >= amaxe) return -1;
		
		double min = Math.max(amin, bmin);
		double max = Math.min(amaxe, bmaxe);
		if (min == (int)min) min--;
		if (max == (int)max) max--;
		
		if ( (int)(min+1) > (int)max ) return -1;
		
		return (int)(min+1);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}


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

int main(){
	string s;
	cin >> s;
	map<char,int> mp;
	int len = s.size();
	rep(i,len){
		mp[s[i]]++;
		if(mp[s[i]] == 2){
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
}

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

int main(){
  string S, T, U;
  int A, B;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if (S == U){
    cout << A - 1 << " " << B << endl;
  }
  else {
    cout << A << " " << B - 1 << endl;
  }
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

printList [a] = print a
printList (a:as) = putStr ( show a ) >> putChar ' ' >> printList as

main = do
	getLine
	as <- readIntegers
	let
		psum = scanl (+%) 0 as
	print $ foldl1 (+%) $ zipWith (*%) psum as

a +% b = ( a + b ) `mod` 1000000007
a *% b = a * b `mod` 1000000007

Measured memory_bytes: 10232
import java.io.*;
import java.util.*;

public class Main {
  public static void main (String[] args) {
    FastScanner in = new FastScanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    while (in.hasNext()) {
      int N = in.nextInt();
      int M = in.nextInt();
      int Q = in.nextInt();
      int[][] table = new int[N + 1][N + 1];

      while (M-- > 0) {
        ++table[in.nextInt()][in.nextInt()];
      }
      
      for (int i = 1; i < table.length; ++i) {
        for (int j = 1; j < table[i].length; ++j) {
          table[i][j] += table[i][j - 1] + table[i - 1][j] - table[i - 1][j - 1];
        }
      }
      
      while (Q-- > 0){
        int p = in.nextInt();
        int q = in.nextInt();
        out.println(table[q][q] - table[p - 1][q] - table[q][p - 1] + table[p - 1][p - 1]);
      }
    }
    
    out.close();
  }
    private static class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
	
	public FastScanner(InputStream is) {
		br = new BufferedReader(new InputStreamReader(is));
	}

	public FastScanner(File f) {
		try {
			br = new BufferedReader(new FileReader(f));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	// source: http://codeforces.ru/blog/entry/7805#comment-134954
	public boolean hasNext() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				String line = br.readLine();
				if (line == null) {
					return false;
				}
				st = new StringTokenizer(line);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}	
		return true;
	}

	public String nextLine() {
		String ret = null;
		try {
			ret = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}

		return ret;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}
    }
}

Measured memory_bytes: 62552
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<string> data(H);
  for(int i=0;i<H;i++){
    cin>>data.at(i);
  }
   // cout<<"AA"<<endl;
  vector<vector<int>> dist(H,vector<int>(W,-1));
  using pir=pair<int,int>;
  queue<pir> que;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(data[i][j]=='#'){
        dist[i][j]=0;
        que.push(pir(i,j));
      }
    }
  }
  //cout<<"AA"<<endl;
  int dx[4]={0,0,1,-1};
  int dy[4]={1,-1,0,0};
  while(!que.empty()){
    auto cp=que.front();
    que.pop();
    for(int i=0;i<4;i++){
      int nx=cp.second+dx[i];
      int ny=cp.first+dy[i];
      if(nx<0||nx>=W||ny<0||ny>=H)  continue;
      if(dist[ny][nx]==-1){
        dist[ny][nx]=dist[cp.first][cp.second]+1;
        que.push(pir(ny,nx));
      }
    }
  }

  int tmp=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      tmp=max(tmp,dist[i][j]);
    }
  }
  cout<<tmp<<endl;
  return 0;
}

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

int main(){

  int n;
  while(true) {

    cin>>n;
    if(!n) break;

    vector< vector<int> > v;


    for(int i=0; i<n; i++) {
      vector<int> t;
      int k;
      for(int j=0; j<n; j++) {
	cin>>k;
	t.push_back(k);
      }
      v.push_back(t);
    }

    for(int i=0; i<n; i++) {
      int sum=0;
      for(int j=0; j<n; j++) {
	sum += v[i][j];
      }
      v[i].push_back(sum);
    }

    vector<int> o;
    for(int i=0; i<n+1; i++) {
      int sum=0;
      for(int j=0; j<v.size(); j++) {
	sum += v[j][i];
      }
      o.push_back(sum);
    }

    v.push_back(o);

    for(int i=0; i<v.size(); i++) {
      for(int j=0; j<v[i].size(); j++) {
	cout.width(5);
	cout<<v[i][j];
      }
      cout<<endl;
    }

  }

}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;

const int mod = 1e9+7;
int N;

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

  cin >> N;

  vector<int> c(N);
  vector<int> s(N);
  vector<int> f(N);
  rep(i, N) {
    cin >> c.at(i) >> s.at(i) >> f.at(i);
  }

  rep(i, N) {
    int ans = 0;
    for(int j=i; j<N-1; j++) {
      if (ans%f.at(j) != 0) {
        ans += f.at(j) - ans%f.at(j);
      }
      ans = max(ans, s.at(j));
      ans += c.at(j);
    }
    cout << ans << endl;
  }
}

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

memo = {}
for i in range(n):
    man_idx = i
    count = int(input())
    comment = [ list(map(int,input().split())) for _ in range(count) ]
    memo[man_idx] = comment

ans = 0
for i in range(2**n):
    sub_ans = 0
    is_true = True
    for j in range(n):
        if i >> j & 1:
            sub_ans += 1
            for x, y in memo[j]:
                if (i >> (x-1) & 1)  !=  int(y):
                    is_true = False
                    break
    if is_true:
        ans = max(sub_ans, ans)
print(ans)

Measured memory_bytes: 9156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll INF = 1LL<<60;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)

int s; 
vector<int> vis;
vector<vector<int>> ed;


void dfs(int r){
    vis[r]=1;
    for(int e:ed[r]){
        if(!vis[e])dfs(e);
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
    vis = vector<int>(n+m,0);
	ed = vector<vector<int>>(n+m,vector<int>());
    rep(i,n){
        int k; cin>>k;
        rep(j,k){
            int l; cin>>l;l--;
            ed[i].push_back(n+l);
            ed[n+l].push_back(i);
        }
    }
    dfs(0);
    bool flag = true;
    rep(i,n){
        flag&=(vis[i]==1);
    }
    cout<<(flag?"YES":"NO")<<endl;
    return 0;
}

Measured memory_bytes: 9208
#define _GLIBCXX_DEBUG
#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;
const double pi=acos(-1);





int main() 
{
  ll N,K; cin>>N>>K;
  vector<ll> A(N);
  rep(i,N)
  {
    cin>>A.at(i);
  }
  rep(i,min(K,(ll)100))
  {
    vector<ll> hoge(N,0);
    vector<ll> sirusi(N,0);
    rep(i,N)
    {
      sirusi.at(max((ll)0,i-A.at(i)))++;
      if(i+A.at(i)<N-1)
      {
        sirusi.at(i+A.at(i)+1)--;
      }
    }
    rep(i,N)
    {
      if(i==0) {hoge.at(0)=sirusi.at(0); continue;}
      hoge.at(i)=hoge.at(i-1)+sirusi.at(i);
    }
    A=hoge;
  }
  rep(i,N)
  {
    if(i!=0) {cout<<" ";}
    cout<<A.at(i);
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 8004
n, m = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(m):
    tmp = list(map(int,input().split()))
    link[tmp[0]-1].append(tmp[1]-1)
    link[tmp[1]-1].append(tmp[0]-1)

from collections import deque
Q = deque()
Q.append([0,[0]]) # now, history

import copy
ans=0
while Q:
    now,org_hist = Q.popleft()

    for nxt in link[now]:
        if nxt in org_hist:
            continue
        hist = copy.copy(org_hist)

        hist.append(nxt)
        if len(hist) >= n:
            ans+=1
        else:
            Q.append([nxt,hist])
print(ans)

Measured memory_bytes: 42480
x, n = map(int, input().split())

if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

dif = 100
ans = 0

for i in range(min(p) - 1, max(p) + 2):
    if not (i in p):
        if dif > abs(x - i):
            dif = abs(x - i)
            ans = i

print(ans)


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

int main(){
  string s;
  cin >> s;
  if (s[2]==s[3] && s[4]==s[5]) cout << "Yes";
  else cout << "No";

  return 0;
}


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

int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c;
	cin>>a>>b>>c;
	if ((a!=b && b!=c && a!=c) || (a==b && b==c)) {
		cout<<"No\n";
	}else{
		cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  def main(args:Array[String]) = {
    var cnt = 0
    var n = 0
    while( { n = 1000-readInt; n} != 1000) {
      cnt = 0
      while(n>=500) { n -=500; cnt += 1 }
      while(n>=100) { n -=100; cnt += 1 }
      while(n>=50) { n -=50; cnt += 1 }
      while(n>=10) { n -=10; cnt += 1 }
      while(n>=5) { n -=5; cnt += 1 }
      while(n>=1) { n -=1; cnt += 1 }
      println(cnt)
    }
  }
}

Measured memory_bytes: 43560
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;
vector<double> ans;
int main(){
	while(1){
		int d,e;
		cin >> d >> e;
		if(d + e == 0)break;
		double mn = 10000.;
		for(int i = 0;;i++){
			if(i * 2 > d) break;
			int x,y;
			x = i;
			y = d - x;
			double m;
			m = sqrt(x*x + y*y);
			mn = min(mn,abs(m - e));
		}
		ans.push_back(mn);
	}
	for(int i = 0;i < ans.size();i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 3200
using System;

namespace ConsoleApplication15
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b,c,d;
           
                string[] s = Console.ReadLine().Split(' ');
                a = int.Parse(s[0]);
                b = int.Parse(s[1]);
                c = int.Parse(s[2]);
                d = 0;


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

            Console.WriteLine(d);

                }


        }
    }

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

int main(){
    long long A,B,K;
    cin >> A >> B >> K;
    for(int i=0;i<K;i++){
        if(A+i<B+1)
        cout << A+i << endl;
    }
    for(int i=0;i<K;i++){
        if(B-K+1+i>A+K-1&&B-K+1+i<B+1)
        cout << B-K+1+i << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll n;
    cin>>n;
    ll i;
    ll ans = 0;
    FOR(i, 1, n+1) if(i%3 != 0 && i%5 != 0) ans += i;
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 3772
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                count+=1
print(count)



Measured memory_bytes: 3316
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 

 
void solve()
{
   int a , b , c ,d ,e ;
   cin>>a>>b>>c>>d>>e ;
   if(a==0){
   	cout<<1;
   	return ;
   }
   if(b==0){
   	cout<<2;
   	return ;
   }
   if(c==0){
   	cout<<3;
   	return;
   }
   if(d==0){
   	cout<<4;
   	return ;
   }
   cout<<5;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3728
#include <stdio.h>
int main(void){
  int N, a;
  scanf("%d", &N);
  int A[N], B[N];
  B[0] = 0;
  for(int i = 1; i < N; i++){
    scanf("%d", &A[i]);
    B[i] = 0;
  }
  for(int j = 1; j < N; j++){
    a = A[j] - 1;
    B[a] += 1;
  }
  for(int k = 0; k < N; k++){
    printf("%d\n", B[k]);
  }
  return 0;
} 

Measured memory_bytes: 3288
// ------------------------------------
// Date:2018/ 3/10
// Problem:ABC 072 OddString b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

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

  string s, tmp = "";
  cin >> s;
  REP(si, s.size()) {
    if (si % 2 == 0) tmp += s[si];
  }
  cout << tmp << endl;
  return 0;
}



Measured memory_bytes: 592
#B
s = input()
L = 'L'
R = 'R'
odds = ''
evens = ''
for i in range(len(s)):
    if i % 2 == 0:
        odds += s[i]
    else:
        evens += s[i]
if (L in odds) or (R in evens):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 2940
n=int(input())
s=input()
total=0
for i in range(1,n):
    a=s[:i]
    b=s[i:]
    a=set(list(a))
    b=set(list(b))
    numa=len(a)
    numb=len(b)
    numc=len(a|b)
    shurui=numa+numb-numc
    total=max(total,shurui)
    
print(total)   

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  vector<ll> c(n);
  rep(i, n){
    cin >> p[i];
    p[i]--;
  }
  rep(i, n) cin >> c[i];

  ll ma = -INF;
  rep(i, n){
    ll sum = c[i];
    int m = 1;
    int pos = p[i];
    while(pos != i){
      sum += c[pos];
      pos = p[pos];
      m++;
    }
    if(k < m){
      ll s = 0;
      int pp = p[i];
      rep(i, k){
        s += c[pp];
        pp = p[pp];
        chmax(ma, s);
      }
    }
    else if(sum <= 0){
      ll s = 0;
      int pp = p[i];
      rep(i, m){
        s += c[pp];
        pp = p[pp];
        chmax(ma, s);
      }
    }
    else{
      ll d = k/m;
      ll r = k%m;
      ll s = sum * (d-1);
      int pp = p[i];
      rep(i, m+r){
        s += c[pp];
        pp = p[pp];
        chmax(ma, s);
      }
    }
  }

  cout << ma << endl;

  return 0;
}


Measured memory_bytes: 3624