akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
int d[200010],dp[1010][1010];
double w[1000],v[1000];
double box[200010];
char field[200][200];

int main(){
  while(1){
    getline(cin,s);
    if(s == ".")break;
    t = "";
    vc vec;
    rep(i,0,s.sz){
      if(s[i] == '(' || s[i] == ')' || s[i] == '[' || s[i] == ']')vec.pb(s[i]);
    }
    string ans = "yes";
    if(vec.sz % 2)ans = "no";
    else{
      while(1){
        bool f = true;
        if(vec.empty())break;
        rep(i,0,vec.sz-1){
          if((vec[i] == '(' && vec[i+1] == ')') || (vec[i] == '[' && vec[i+1] == ']')){
            f = false;
            vec.erase(vec.begin() + (i));
            vec.erase(vec.begin() + (i));
            break;
          }
        }
        if(f){
          ans = "no";
          break;
        }
      }
    }
    print(ans);
  }
  return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	int a = n/100, b=n%100;
	if(1<=a && a<=12){
		if(1<=b && b<=12){
			printf("AMBIGUOUS\n");
		}else{
			printf("MMYY\n");
		}
	}else{
		if(1<=b && b<=12){
			printf("YYMM\n");
		}else{
			printf("NA\n");
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1<<30;
const double eps = 1e-13;

int can[10009];

int main(){
	DRI(n);
	can[0]=1;
	REP(i,n){
		DRI(x);
		for(int i=10000;i>=x;i--){
			can[i]|=can[i-x];
		}
	}
	for(int i=10000;i;i--){
		if(can[i]&&(i%10)){
			printf("%d\n",i);return 0;
		}
	}
	printf("0");
}


Measured memory_bytes: 256
H,W = map(int, input().split())
A = [input() for _ in range(H)]
A = [a for a in A if a != '.'*W]
A_t = [list(a) for a in zip(*A)]
A_t = [list(a) for a in A_t if '#' in a]
A = [a for a in zip(*A_t)]

for i in range(len(A)):
	print("".join(A[i]))

Measured memory_bytes: 3188
object Main {
    def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        val n = sc.nextInt
        val hs = List.fill(n)(sc.nextInt)
        val hs_max = hs.max
        var ans = 0
        var tmp = -1
        for (h <- 1 to hs_max) {
            for(i <- 0 until n) {
                if (hs(i) - h >= 0) {
                    if (tmp == -1) {
                        ans += 1
                        tmp = 1
                    }
                } else
                    tmp = -1
            }
            tmp = -1
        }
        println(ans)
    }
}

Measured memory_bytes: 25540
#include<bits/stdc++.h>
using namespace std;
int x,y;
 
int main()
{
	cin>>x>>y;
	if(x==1&&y==1)
	{
		cout<<1000000;
		return 0;
	}
	long long ans=0;
	if(x==1) ans+=300000;
	if(x==2) ans+=200000;
	if(x==3) ans+=100000;
	if(y==1) ans+=300000;
	if(y==2) ans+=200000;
	if(y==3) ans+=100000;
	cout<<ans;
}


Measured memory_bytes: 256
N,K=(int(x) for x in input().split())
ans=0
for n in range(N):
    me=n+1
    if me>=K:
        ans=ans+(1/N)
    else:
        for j in range(20):
            me=me*2
            if me>=K:
                ji=2**(j+1)
                ans=ans+(1/N)*(1/ji)
                break
print(ans)


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
// #define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	string s; cin>>s;
	map<string,string> T{
		{"erase","esare"},
		{"eraser","resare"},
		{"dream","maerd"},
		{"dreamer","remaerd"},
	};
	// ote(s);
	reverse(s.begin(),s.end());
	// ote(s);//
	bool ok = true;
	int i = 0;
	while(i<s.size()){
		if(s[i]=='r'){
			string s6 = s.substr(i,6);
			string s7 = s.substr(i,7);
			if(T["eraser"]==s6){
				i += 6;
			}
			else if(T["dreamer"]==s7){
				i += 7;
			}
			else{
				ok = false;
				break;
			}
		}
		else if(s[i]=='m'){
			string s5 = s.substr(i,5);
			if(T["dream"]==s5){
				i += 5;
			}
			else{
				ok = false;
				break;
			}
		}
		else if(s[i]=='e'){
			string s5 = s.substr(i,5);
			if(T["erase"]==s5){
				i += 5;
			}
			else{
				ok = false;
				break;
			}
		}
		else{
			ote(s.substr(i));
			ok = false;
			break;
		}
	}
	ote(ok?"YES":"NO");
}


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

#define int long long
#define rep(i, x) for (int i = 0; i < (int) (x); i++)
#define reps(i, x) for (int i = 1; i <= (int) (x); i++)
#define per(i, x) for (int i = ((int) (x) - 1); i >= 0; i--)
#define sper(i, x) for (int i = ((int) (x)); i > 0; i--)
#define sqr(x) ((x) * (x))
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define bit(n) (1LL << (n))
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { a * b / gcd(a, b); }
template<class T, class U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T, class U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
  Init() {
      cout << fixed << setprecision(20);
  };
} init;

int W, H, x, y;
signed main() {
    cin >> W >> H >> x >> y;
    cout << W * H / 2.0 << " " << (W == x * 2 && H == y * 2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,max1=0,max2=0;
  cin>>n;
  vector<int> d(n);
  for(int i=0;i<n;++i){
    cin>>d[i];
    d[i]/=10;
  }
  for(int i=0;i<n-1;++i){
    if(max1<i) break;
    max1=max(max1,i+d[i]);
  }
  for(int i=n-1;i>0;--i){
    if(max2<n-i-1) break;
    max2=max(max2,n-i-1+d[i]);
  }
  cout<<((max1>=n-1&&max2>=n-1)?"yes":"no")<<endl;
  return 0;
}



Measured memory_bytes: 3876
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N;
    cin >> N;
    ll ans = 0;
    rep(i,0,4){
        if(N[i] == '2') ans++;
    }
    print(ans);
}


Measured memory_bytes: 256
/*
author:Manson
date:7.7.2018
theme:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1e5+5;

struct node{
	int id;
	int tt;
}a[N],b[N];
int cmp(node x,node y){
	return x.tt>y.tt;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	int x;
	cin>>n;
	for(int i = 0;i < n;i++){
		cin>>x;
		if(i%2 == 0){
			a[x].id=x;
			a[x].tt++;
		}
		else{
			b[x].id = x;
			b[x].tt++;
		}
	}
	int t = (n+1)/2;
	sort(a,a+N-1,cmp);
	sort(b,b+N-1,cmp);
	int t1 = a[0].tt,t2 = b[0].tt;
	if(a[0].id == b[0].id){
		int temp1 = a[1].tt,temp2=b[1].tt;
		if(temp1 >= temp2){
			t1 = a[1].tt;	
		}
		else{
			t2 = b[1].tt;
		}
	}
	cout<<(n-t1-t2)<<endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int a, b;
  cin >> a >> b;
  if (a >= 10 || b >= 10) {
    cout << -1 << endl;
  } else {
    cout << a * b << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		String S = sc.next();

		char[] c = S.toCharArray();
      
		if (c[0] == c[1]) {
			System.out.println("Bad");
		} else if (c[1] == c[2]) {
			System.out.println("Bad");
		} else if (c[2] == c[3]) {
			System.out.println("Bad");
		} else {
			System.out.println("Good");
		}
	}
}

Measured memory_bytes: 21844
import std.stdio, std.string, std.conv;

void main() {
	string a = readln().chomp();
	string res;
	foreach(int i; 0..(1<<3)) {
		int t = a[0]-'0';
		res = to!(string)(a[0]);
		foreach(int j; 0..3) {
			if(i&(1<<j)) {
				t += a[j+1]-'0';
				res ~= "+";
			}
			else {
				t -= a[j+1]-'0';
				res ~= "-";
			}
			res ~= a[j+1];
		}
		if(t == 7) {
			res ~= "=7";
			break;
		}
	}
	writeln(res);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string s,t; cin >> s >> t;
    int samecntmax = 0;
    for(int i = 0; i < n; i++){
        int tmp = 0;
        if(s[i] == t[0]){
            for(int j = i; j < n; j++){
                if(s[j] != t[j-i]) break;
                else tmp++;
            }
        }
        if(samecntmax < tmp) samecntmax = tmp;
    }
    cout << 2*n - samecntmax << endl;
}

Measured memory_bytes: 256
/**
 *    author:  Mohamad Milhem
 *    created: 2020-03-07-14.07.07
**/

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


int main(){

    FAST;

    long long n;
    cin >> n;

    long long a,b;
    cin >> a >> b;

    long long sum =  a + b ;

    long long whole = n/sum;

    long long rest = n % sum;
    long long ans = (a * whole ) + (min(rest , a));

    cout << ans <<endl;


    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#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=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    ll k, n;
    ll a[200001];
    ll res = INF;
    cin >> k >> n;
    REP(i, n) {
        cin >> a[i];
    }

    // どの辺を選ばないか、という問題になる
    // 1軒目からn軒目の間の辺も考えつつ、それらの合計から1辺削ったときの最小値を探す
    res = min(res, k - (a[0] + (k - a[n-1])));
    FOR(i, 1, n-1) {
        res = min(res, k - (a[i] - a[i-1]));
    }

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

Measured memory_bytes: 1792
#include <stdio.h>
int main(void)
{
  int i,n,k,val=1;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++)
  {
    if(val*2 < val+k)
    {
      val*=2;
    }
    else
    {
      val+=k;
    }
  }
  printf("%d\n",val);
  return 0;
}


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

long long n,x,a[100005],r;

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

    cin>>n>>x;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>x)
        {
            r+=a[i]-x;
            a[i]=x;
        }
    }

    for(int i=0;i<n-1;i++)
    {
        if(a[i]+a[i+1]>x)
        {
            r+=a[i]+a[i+1]-x;
            a[i+1]-=a[i]+a[i+1]-x;
        }
    }

    cout<<r<<endl;

    return 0;
}


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

int main() {

  int N, Ai = 0;
  int i;
  int count;
  int countsmall = 0;
  cin >> N;
  for (i=0; i < N; i++) {
    cin >> Ai;
    count = 0;
      while(Ai % 2 == 0 ){
        count += 1;
        Ai = Ai/2;
      }
    if (i == 0){
    countsmall = count;
    }
    else {
      if(countsmall >count){
      countsmall = count;
      }
    
    }
  }
  cout << countsmall << endl;
  
}


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

using namespace std;

double sideToCos(vector<int> &side)
{
	double a2, b2, c2, cos;
	a2 = side[0] * side[0];
	b2 = side[1] * side[1];
	c2 = side[2] * side[2];
	cos = (c2 - a2 - b2) / -(2 * side[0] * side[1]);
	return cos;
}

int main() {
	vector<int> side(3);
	int count = 0, right = 0, acute = 0, obtuse = 0;
	double cos;

	while (1)
	{
		cin >> side[0] >> side[1] >> side[2];
		sort(side.begin(), side.end());
		if (side[0] + side[1] <= side[2])
		{
			break;
		}
		else
		{
			count++;
			cos = sideToCos(side);
			if (cos > 0) acute++;
			else if (cos < 0) obtuse++;
			else right++;
		}
	}
	cout << count << ' ' << right << ' ' << acute << ' ' << obtuse << endl;
	return 0;
}


Measured memory_bytes: 3144
import java.util.Scanner;

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int[] V = new int[N];
      int[] C = new int[N];

      for (int i = 0; i < V.length; ++i) {
        V[i] = in.nextInt();
      }

      for (int i = 0; i < C.length; ++i) {
        C[i] = in.nextInt();
      }

      int maxDiff = 0;
      for (int i = 0; i < V.length; ++i) {
        int diff = V[i] - C[i];

        if (diff > 0) {
          maxDiff += diff;
        }
      }

      System.out.println(maxDiff);
    }
  }
}

Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long int ll;

int main(){
    string a,b,c;   cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << endl;
}


Measured memory_bytes: 256
sent=raw_input()
words=sent.split()
max_f,freq_w=0,""
max_len,len_w=0,""
for word in words:
    if max_f<words.count(word):
        freq_w=word
        max_f=words.count(word)
    if max_len<len(word):
        len_w=word
        max_len=len(word)
print "%s %s"%(freq_w,len_w)

Measured memory_bytes: 4220
#include <iostream>

using namespace std;

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    int s, w;
    cin >> s >> w;
    if(w >= s)
        cout << "unsafe" << endl; 
    else
        cout << "safe" << endl;
    return 0;
}


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

int main() {
  
  int N,A;
  cin >> N >> A;
  
  if (N <= A)
    cout << "Yes" << endl;
  
  else if (N%500 <=A)
    cout << "Yes" << endl;
  
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int X, Y;
	cin >> X >> Y;
	cout << X + Y / 2 << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(){
  int k,x;
  scanf("%d%d",&k,&x);
  for(int i=k-1; i>0; i--){ printf("%d ",x-i); }
  for(int i=0;   i<k; i++){ printf("%d ",x+i); }
  return 0;
}

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

int main() {
   int w,a,b;
   cin >> w >> a >> b;
   if(a+w < b){
       cout << b-(a+w) << endl;
   }else if(b+w < a){
       cout << a-(b+w) << endl;
   }else{
       cout << 0 << endl;
   }

    return 0;
}

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

int R, C;
int sy, sx, gy, gx;
int **ce;

int minmove()
{
	queue<pair<int, int> > q;

	if(ce[sy][sx] == -1){
		return -1;
	} else {
		ce[sy][sx] = 0;
	}

	q.push({sy, sx});

	while(!q.empty()){
		auto p = q.front();

		if(
			p.first != 0 && ce[p.first-1][p.second]
				> ce[p.first][p.second]+1
		){
			ce[p.first-1][p.second] = ce[p.first][p.second]+1;
			q.push({p.first-1, p.second});
		}
		if(
			p.first != R-1 && ce[p.first+1][p.second]
				> ce[p.first][p.second]+1
		){
			ce[p.first+1][p.second] = ce[p.first][p.second]+1;
			q.push({p.first+1, p.second});
		}
		if(
			p.second != 0 && ce[p.first][p.second-1]
				> ce[p.first][p.second]+1
		){
			ce[p.first][p.second-1] = ce[p.first][p.second]+1;
			q.push({p.first, p.second-1});
		}
		if(
			p.second != C-1 && ce[p.first][p.second+1]
				> ce[p.first][p.second]+1
		){
			ce[p.first][p.second+1] = ce[p.first][p.second]+1;
			q.push({p.first, p.second+1});
		}

		q.pop();
	}
	if(ce[gy][gx] == 10000){
		return -1;
	} else {
		return ce[gy][gx];
	};
}

int main()
{
	cin >> R >> C; 
	sy = 0;
	sx = 0;
	gy = R-1;
	gx = C-1;

	int rcount = 0;

	ce = new int*[R];
	for(int r=0; r<R; r++){
		ce[r] = new int[C];
		for(int c=0; c<C; c++){
			char ch;
			cin >> ch;
			if(ch == '#'){
				ce[r][c] = -1;
			} else {
				ce[r][c] = 10000;
				rcount += 1;
			}
		}
	}

	if(minmove() == -1){
		cout << -1 << endl;
	} else{
		cout << rcount - minmove() - 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ',') s[i] = ' ';
    }
    cout << s << endl;
}


Measured memory_bytes: 256
N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)
c = 0
while A[0] > 0
  f = true
  for i in 0...N
	if(A[i]%2 == 1)
      f = false
      break
    end
    A[i] /= 2
  end
  if(f)
    c += 1
  else
    break
  end
end
print(c)

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


int main() {
	int n, ans =0,ant=0,anu=0; 
  cin >> n;
  
  string s;
  
  cin >> s;
  
  for(int i=0;i<n;i++){
    if(s[i] == '('){
      ans++;
    }
else{
  if(ans == 0){
    ant++;
  }
  else{
    ans--;
  }
}
  }
    
    string t =" ";
    
    for(int i=0;i<ant;i++){
      t += '(';
    }
    t += s;
    
    for(int i=0;i<ans;i++){
      t += ')';
    }
    
    cout << t << endl;
  }
  
	

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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] a = new int[3];
		for (int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);

		int k = sc.nextInt();

		for (int i = 0; i < k; i++) {
			a[2] *= 2;
		}
		System.out.print(a[0] + a[1] + a[2]);

	}
}

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

#define MAX 1000000000000000000

int main(){
    long N;
    cin >> N;
    long A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    long ans = 1;
    for(int i = 0; i < N; i++){
        if(LONG_MAX / ans < A[i]){
            cout << -1 << endl;
            return 0;
        }
        ans *= A[i];
    }
    if(ans > MAX) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4400
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n][3];
  for(int i = 0 ; i < n ; i++){
    cin >> a[i][0];
    cin >> a[i][1];
    cin >> a[i][2];
  }
  if(n == 1)
    cout << max(a[0][0], max(a[0][1], a[0][2]));
  else{
    int dp[n][3];
    
    for(int i = 0 ; i < 3 ; i++)
      dp[0][i] = a[0][i];
    
    for(int i = 1 ; i < n ; i++){
      
    	for(int j = 0 ; j < 3 ; j++){
          int index, x = INT_MIN;
          
          for(int k = 0 ; k < 3 ; k++){
            if(k != j && x < dp[i-1][k]){
              x = dp[i-1][k];
              index = k;
            }
          }  
          dp[i][j] = dp[i-1][index] + a[i][j];
      	}
    }
    cout << max(dp[n-1][2], max(dp[n-1][1], dp[n-1][0]));
  }
}
  

Measured memory_bytes: 2560
//ITP1_2_A
#include<iostream>
using namespace std;

int main()
{
	int a,b;
	
	cin>>a>>b;
	
	if(a < b)
	cout<<"a < b"<<endl;
	
	else if(a > b)
	cout<<"a > b"<<endl;
	
	else{
	cout<<"a == b"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,ii ) for( typeof(gg.begin()) ii=gg.begin();ii!=gg.end();ii++)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define sz(a) int((a).size())
#define N 1000010
#define MAX 30
#define mod 1000000007
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define all(a) a.begin(),a.end()
const ll INF = 1e18+1;

ll a[N],b[N];

int main()
{
	ll t,x=0,y;
	scanf("%lld",&t);
	REP(i,t) scanf("%lld%lld",&a[i],&b[i]);
	REPP(i,1,t+1){
		y=(a[t-i]+x)%b[t-i];
		if (y) x+=b[t-i]-y; 
	}
	printf("%lld\n",x);
return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define N 100000
#define Q 50000

int binarySearch(int*, int);
int n;

int main(){

  int q,i,j,c=0,temp=Q;
  int S[N],T[Q];

  scanf("%d", &n);

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

   scanf("%d", &q);

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

  for(i=0 ; i<q ; i++){
    c+=binarySearch(S,T[i]);
  }

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

  return 0;
}

int binarySearch(int *A, int key){

  int c=0,left=0,right,mid;

  right=n;

  while(left<right){
    mid=(left+right)/2;

    if(key==A[mid]) {
      c++;
      break;
    }
    if(key>A[mid]) left=mid+1;
    else if (key<A[mid]) right = mid;
  }

  return c;
}

Measured memory_bytes: 1184
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  
  long int ans=0;
  
  for (int i=1;i<=N;i++){
    if (i % 3 != 0 && i % 5 != 0)
        ans+=i;
  }
  
  printf("%ld",ans);
  return 0;
  }
  


Measured memory_bytes: 1712
//
//  main.cpp
//  FiveFiveEverywhere
//
//  Created by XsC on 2018/5/5.
//  Copyright © 2018年 夏思聪. All rights reserved.
//

#include <iostream>
#include "vector"

const int maxn=55565;

int n;
int num[maxn];
int seq[60];
std::vector<int> prime;

bool isPrime(int n){
    for(int i=2;i<n/2;i++){
        if(n%i==0)
            return false;
    }
    return true;
}

void init(){
    memset(num, 0, sizeof(num));
    num[2]=1;
    prime.emplace_back(2);
    for(int i=3;i<maxn;i++)
        if(isPrime(i)){
            num[i]=1;
            prime.emplace_back(i);
        }
}

int main(int argc, const char * argv[]) {
    scanf("%d",&n);
    if(n==5)
        printf("3 5 7 11 31");
    else if(n==6)
        printf("2 3 5 7 11 13");
    else if(n==8)
        printf("2 5 7 13 19 37 67 79");
    else{
        init();
        int i=0;
        while (n) {
            if(prime[i] % 10 == 7){
                if(n!=1){
                    printf("%d ",prime[i]);
                    n--;;
                }
                else{
                    printf("%d",prime[i]);
                    n--;
                }
            }
            i++;
        }
    }
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(){
  int flag,temp,sumn,summ,i,j,n,m,ren,rem,nc[101],mc[101];
  while(1){
    sumn=0;
    summ=0;
    ren=100;
    rem=100;
    flag=0;
    scanf("%d%d",&n,&m);
    if(n==0&&m==0) break;
 
    for(i=1;i<=n;i++){
      scanf("%d",&nc[i]);
      sumn+=nc[i];
    }
    for(i=1;i<=m;i++){
      scanf("%d",&mc[i]);
      summ+=mc[i];
    }
     
    for(i=1;i<=n;i++){
      for(j=1;j<=m;j++){
    if(sumn-nc[i]+mc[j]==summ-mc[j]+nc[i]&&nc[i]+mc[j]<ren+rem){    
          ren=nc[i];
          rem=mc[j];
      temp=nc[i];
      nc[i]=mc[j];
      mc[j]=temp;
      flag=1;
    }
      }
    }
 
    if(flag==1) printf("%d %d\n",ren,rem);
    else printf("-1\n");
 
  }
 
  return 0;
}

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

int main(){
    int A, B;
    cin >> A >> B;

    if(A == 1){
        A += 13;
    }
    if(B == 1){
        B += 13;
    }

    if(A > B){
        cout << "Alice" << endl;
    }else if(A < B){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }

    return 0;
}


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

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int n, k;
vector<int> a;

int cost(int x) {
	int res = 0;
	for (auto i : a) {
		res += ((i - 1) / x);
	}
	return res;
}

int main() {

	cin >> n >> k;
	a.resize(n); for (int i = 0; i <= n - 1; i++) cin >> a[i];

	int lo = 1, hi = 1e9, ans = -1;
	while (lo <= hi) {
		int mid = lo + (hi - lo) / 2;

		if (cost(mid) <= k) {
			ans = mid;
			hi = mid - 1;
		}
		else lo = mid + 1;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 3584
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  n=pI(readline())
  ac=0
  wa=0
  tle=0
  re=0
  for i=1:n
    s=chomp(readline())
    if s=="AC"      ;ac+=1
    elseif s=="WA"  ;wa+=1
    elseif s=="TLE" ;tle+=1
    else            ;re+=1
    end
  end
  println("AC x $ac
WA x $wa
TLE x $tle
RE x $re
")
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

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

int main() {
    long long Q,H,S,D;
    cin >> Q >> H >> S >> D;
    long long N;
    cin >> N;

    long long l = min({S, 2*H, H + 2*Q, 4*Q});

    if(2 * l < D) cout << l * N << endl;
    else cout << D * (N/2) + l * (N%2) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int w;
    cin>>s>>w;
    //char s1[1005];
    //int p=0;
    for(int i=0; i<s.length(); i+=w)
    {

        cout<<s[i];

    }
    cout<<endl;
    return 0;

}

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

int64_t gcd(int64_t a, int64_t b) {
	int64_t c;
	while(a) {
		c = a; a = b%a; b = c;
	}
	return b;
}

int64_t lcm(int64_t a, int64_t b) {
	return (a / gcd(a, b) * b);
}

int main() {
	int64_t N, T;
	cin >> N;
	int64_t x = 1;
	for(int i = 0; i < N; i++) {
		cin >> T;
		x = lcm(x, T);
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
ll a[200000];
int main(void)
{
	ll n,k,s,i,j;
	scanf("%lld%lld%lld",&n,&k,&s);
	if(s==1e9)
	{
		for(i=0;i<k;i++)
		{
			a[i]=1e9;
		}
		for(i=k;i<n;i++)
		{
			a[i]=1e9-1;
		}
	}
	else
	{
		for(i=0;i<k;i++)
		{
			a[i]=s;
		}
		for(i=k;i<n;i++)
		{
			a[i]=1e9;
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%lld ",a[i]);
	}
}

Measured memory_bytes: 2048
A,B = map(int,input().split())
if A == 1:
    if B == 1:
        print("Draw")
    else:
        print("Alice")
else:
    if B == 1:
        print("Bob")
    elif A > B:
        print("Alice")
    elif A < B:
        print("Bob")
    else:
        print("Draw")


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string ATGC = "ATGC";
vector<int> indexes;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a > k) cout << ":(" << endl;
  else cout << "Yay!" << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func main() {
	defer write.Flush()

	var s string
	fmt.Fscan(read, &s)

	cnt := 0
	n := len(s)
	for i := range s {
		if s[i] != s[n-1-i] {
			cnt++
		}
	}
	fmt.Fprintln(write, cnt/2)
}


Measured memory_bytes: 640
#include <cstdio>

int main(){
	int t;
	while(scanf("%d", &t),t){
		int n,s,f,sum=0;
		scanf("%d", &n);
		for(int i = 0; i < n; i++){
			scanf("%d%d", &s, &f);
			sum += f-s;
		}
		if(sum >= t) printf("OK\n");
		else printf("%d\n", t-sum);
	}
}

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

string s;
long long n,r,sd[15];

long long bts(long long a,long long b,string s)
{
    long long br=0,d=1;
    for(int i=b;i>=a;i--)
    {
        br+=(s[i]-'0')*d;
        d*=10;
    }
    return br;
}

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

    cin>>s;
    n=s.size();

    sd[0]=1;
    for(int i=1;i<15;i++)
        sd[i]=sd[i-1]*2;

    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            long long f1,f2;
            if(i==0)
                f1=1;
            else
                f1=sd[i-1];
            if(j==n-1)
                f2=1;
            else
                f2=sd[n-1-j-1];
            r+=bts(i,j,s)*f1*f2;
        }
    }

    cout<<r<<endl;

    return 0;
}


Measured memory_bytes: 3640
// H[i] := xの区間が[i, i + 1]での建物シルエットの最大の高さ
// [i, i+1]に建物が何もないなら、H[i] = 0
// t秒後に、円の中心は(0, -r + t)
// 
// xの区間が[i, i + 1]で、太陽が露出される時間は、
//  min( H[i] - sqrt(r*r - i*i), H[i] - sqrt(r*r - (i+1)*(i+1)) ) + r 
// これを、xの区間が[-r, -r + 1], .... , [r-1, r]で露出される時間を調べて、
// その最小値を調べるとそれが答え？

// [0, 1]と[1, 2]で、高さが違う場合(H[0] != H[1])

// H[i] は 0で初期化
// for(int i = xl; i < xr; ++i) H[i] = max(H[i], h)

#include <bits/stdc++.h>

using namespace std;

int main(){
    int r,n;
    while(cin >> r >> n, r|n){
        int h[45] = {};

        for(int i = 0; i < n; i++){
            int xl,xr,hi; cin >> xl >> xr >> hi;
            for(int j = xl+20; j < xr+20; j++){
                h[j] = max(h[j],hi);
            }
        }
        /*
        for(int j = -5+20; j < 5+20; j++){
            cout << h[j] << " ";
        }
        */

        double ans = 100.00;
        for(int i = -r+20; i < r+20; i++){
            double X = i - 20;
            ans =  min(ans, min(h[i]-sqrt(r*r-X*X)+r, h[i]-sqrt(r*r-(X+1)*(X+1))+r));
        }   

        cout << fixed << setprecision(10) <<  ans << "\n";
    }
    
}


Measured memory_bytes: 3212
# AOJ 0227: Thanksgiving
# Python3 2018.6.24 bal4u
 
while 1:
    n, m = map(int, input().split())
    if n == 0: break
    p = list(map(int, input().split()))
    p.sort(reverse=True)
    ans = 0
    for i in range(1, n+1):
        if i % m: ans += p[i-1]
    print(ans)


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

int main(){
    string s, t = "";
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != 'B') t += s[i];
        else t = t.substr(0, t.size() - 1);
    }
    cout << t << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define WHITE 0
#define GRAY  1
#define BLACK 2
int color[100];
int d[100],f[100];
int G[100][100];
int n, time = 0;
void dfs(int u)
{
    color[u] = 1;
    d[u] = ++time;
    for (int i = 0; i < n; i++)
    {
        if (G[u][i]==1 && color[i] == 0)
        {
            dfs(i);
        }
    } 
    color[u] = 2;
    f[u] = ++time;
    return;
}
int main()
{
    int k,u,v;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            G[i][j] = 0; 
        }  
    } 
    for (int i = 0; i < n; i++)
    {
        scanf("%d %d",&u,&k);
        for (int j = 0; j < k; j++)
        {
            scanf("%d",&v);
            G[u-1][v-1] = 1;
        } 
    } 
    for (int i = 0; i < n; i++)
    {
        color[i] = 0; 
        d[i] = 0;
        f[i] = 0;
    } 
    for (int i = 0; i < n; i++)
    {
        if(color[i]==0) dfs(i); 
    } 
    for (int i = 0; i < n; i++)
    {
        printf("%d %d %d\n", i+1, d[i], f[i]); 
    } 
    return 0;
}

Measured memory_bytes: 2772
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    string s;
    cin>>s;
    
    int y,m,d;
    y = (s[0]-'0')*1000 + (s[1]-'0')*100+(s[2]-'0')*10+s[3]-'0';
    m = (s[5]-'0')*10 + (s[6]-'0');
    d =(s[8]-'0')*10 + (s[9]-'0');
    
    if (y<2019) {cout<<"Heisei"<<endl;return 0;}
    if (y==2019 && m < 4){cout<<"Heisei"<<endl;return 0;}
    if (y==2019 && m == 4 && d<=30){cout<<"Heisei"<<endl;return 0;}
    cout<<"TBD"<<endl;
    
    
    
    return 0;
}








Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func()
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx++
		return cur
	}
	this.initWordIdx = func() {
		idx = 0
	}
	return &this
}

func (me *ReaderEx) ScanAndSplit() (isScanned bool) {
	isScanned = me.baseScanner.Scan()

	me.words = strings.Fields(me.baseScanner.Text())
	me.initWordIdx()
	return
}

func (me *ReaderEx) Scan() (ok bool) {
	ok = me.baseScanner.Scan()
	return
}
func (me *ReaderEx) getString() string {
	return me.baseScanner.Text()
}

func (me *ReaderEx) getInt() int {
	n, err := strconv.Atoi(me.baseScanner.Text())
	defer func() {
		if err != nil {
			panic(err)
		}
	}()

	return n
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan()
	n := r.getInt()

	cnt := n / 11
	n -= cnt * 11
	cnt *= 2
	switch {
	case n <= 0:
	case n <= 6:
		cnt++
	default:
		cnt += 2

	}
	fmt.Fprintln(stdout, cnt)

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string a;
  cin >> a;
  if(a.substr(0,1)=="S") cout << "Cloudy" << endl;
  else if(a.substr(0,1)=="C") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
        
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int s,w;
	cin>>s>>w;
	if(w>=s) cout<<"unsafe";
	else cout<<"safe";
	return 0;
}


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

int n;
vector<vector<int>> g;

int main(){
  cin >> n;
  g.assign(n,vector<int>());
  vector<pair<int,int>> edges;

  for (int i = 0; i < n-1; i++)
  {
    int a,b;
    cin >> a >> b;
    a--;
    b--;

    g[a].push_back(b);
    g[b].push_back(a);
    edges.emplace_back(a,b);
  }

  map<pair<int,int>,int> colors;
  queue<pair<int,int>> que;
  que.emplace(0,0);
  int maxcolor = 1;
  while(!que.empty()){
    int cur = que.front().first;
    int ngcolor = que.front().second;
    que.pop();

    int color = 1;
    for(int next:g[cur]){
      if(color==ngcolor) color++;

      if(colors[make_pair(cur,next)]==0){
        colors[make_pair(cur,next)]=color;
        colors[make_pair(next,cur)]=color;
        que.emplace(next,color);
        maxcolor = max(maxcolor,color);
        color++;
      }
    }
  }
  cout << maxcolor << endl;

  for(auto p:edges){
    cout << colors[make_pair(p.first,p.second)] << endl;
  }
}

Measured memory_bytes: 19316
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int main()
{
  int n;
  cin >> n;
  string res="No";
  REP(i,9){
    double x = n/(i+1);
    if(x >= 1 && x <=9 && n == x*(i+1)){
      res = "Yes";
    }
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = 0;
		while(true) {
			int x = sc.nextInt();
			if(x == 0) break;
			System.out.println("Case " + (++number) + ": " + x);
		}
	}
}


Measured memory_bytes: 41404
def func(n, k):
    if k % 2:
        return (n // k) ** 3
    k //= 2
    m = n // k
    return (m // 2) ** 3 + (m - m // 2) ** 3

n, k = [int(x) for x in input().split()]

print(func(n, k))


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

using namespace std;

#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; };
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; };
template<class T> T th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

template<int MOD>
class Modint{
public:
	long long val;
	Modint(long long val) : val(val) {}
	Modint &operator+=(const Modint &a){
		val += a.val;
		if(val >= MOD) val -= MOD;
		return *this;
	}
	Modint &operator-=(const Modint &a){
		val -= a.val;
		if(val < 0) val += MOD;
		return *this;
	}
	Modint &operator*=(const Modint &a){
		val = val * a.val % MOD;
		return *this;
	}
	void inverse(){
		long long x[2] = {MOD, val};
		long long a[2] = {0, 1};
		int i;
		for(i = 0; x[~i&1]; ++i){
			long long tmp = a[1];
			a[1] = a[0] + x[i&1] / x[~i&1] * a[1];
			a[0] = tmp;
			x[i&1] = x[i&1] % x[~i&1];
		}
		val = i & 1 ? a[0] : MOD - a[0];
	}
	Modint &operator/=(Modint a){
		a.inverse();
		return *this *= a;
	}
	friend Modint operator+(Modint a, const Modint &b){
		return a += b;
	}
	friend Modint operator-(Modint a, const Modint &b){
		return a -= b;
	}
	friend Modint operator*(Modint a, const Modint &b){
		return a *= b;
	}
	friend Modint operator/(Modint a, const Modint &b){
		return a /= b;
	}
};

template<class T, class U>
T mypow(T x, U n){
	T ret(1);
	while(n){
		if(n & 1){
			ret *= x;
		}
		x *= x;
		n >>= 1;
	}
	return ret;
}

using Mint = Modint<1000000007>;
using Int = long long;

int main(){
	Int n, a, b;
	cin >> n >> a >> b;
	Mint x = mypow(Mint(2), n);
	Mint y(1), z(1);
	for(Int i = 0; i < a; ++i) y *= Mint(n - i);
	for(Int i = a; i > 0; --i) y /= Mint(i);
	for(Int i = 0; i < b; ++i) z *= Mint(n - i);
	for(Int i = b; i > 0; --i) z /= Mint(i);
	cout << (x - y - z - 1).val << endl;
}


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

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

// aとbの最大公約数を求める関数
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// aとbの最小公倍数を求める関数
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main()
{
    ll a, b;
    cin >> a >> b;
    ll ans = lcm(a, b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
# Aの先頭の桁と末尾の桁の組み合わせは9*9=81通りだけ
table = [[0] * 10 for i in range(10)]
for x in range(1, N+1):
    x = str(x)
    i = int(x[0])
    j = int(x[-1])
    table[i][j] += 1

table = np.array(table)
answer = (table * table.T).sum()
print(answer)


Measured memory_bytes: 12500
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll N, D;
    cin >> N >> D;
    int res = 0;
    rep(i, N) {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= D * D) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3612