akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	string s; cin >> s;
    int n = (int)s.size();
    int cnt0 = 0, cnt1 = 0;
    rep(i, n) {
    	if(s[i] == '0') ++ cnt0; else ++ cnt1;
    }
    cout << min(cnt0, cnt1) * 2 << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    int n; std::string S; std::cin >> n >> S;
    int red = 0; for(int i = 0; i < n; ++i) if(S[i] == 'R') ++red;
    int ok = 0; for(int i = 0; i < red; ++i) if(S[i] == 'R') ++ok;
    std::cout << (red - ok) << '\n';

    return 0;
}

Measured memory_bytes: 3756
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n%M) * (f(n - 1) % M);
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll X; cin >> X;

	ll cnt = 0;
	ll m = 100;
	while (1) {
		if (m >= X) {
			cout << cnt << endl;
			return 0;
		}
		cnt += 1;
		m = m + m * 0.01;
	}
}


Measured memory_bytes: 11032
#include <stdio.h>

int main(){
    int n,a[110];
    long long int dp[110][110];
    int i, j;

    scanf("%d",&n);

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

    for(i = 0; i  < n ; i++){
        for(j = 0; j <= 20 ; j++){
            dp[i][j] = 0;
        }
    }
    dp[0][a[0]] = 1;

    for(i = 1 ; i <= n -2; i++){
        for(j = 0 ; j <= 20; j++){
            if(dp[i-1][j] > 0){
              if(j + a[i] <= 20 && j + a[i] >= 0){
                  dp[i][j+a[i]] += dp[i-1][j];
              }
              if(j - a[i] <= 20 && j - a[i] >= 0){
                dp[i][j - a[i]] += dp[i-1][j]; 
              }
            }
            
        }
    }
    printf("%lld\n",dp[n-2][a[n-1]]);




    return 0;
}


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

int main(void){
  int N;
  cin >> N;
  
  vector<int> d(N);
  
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  
  int count = 1;
  int iV = d.at(0);
  
  for (int i = 1; i < N; i++) {
    if (iV > d.at(i)) {
      iV = d.at(i);
      count++;
    }
  }
  
  cout << count << endl;
  
  
  
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int, int, int);


int main()
{
  int num = 0;
  long long mygcd = 0;
  
  while(num<1 || num>200)
    scanf("%d",&num);
  
 for(int i=1; i<=num; ++i)
 {
   for(int j=1; j<=num; ++j)
   {
     for(int k=1; k<=num; ++k)
     {
       mygcd+=gcd(i,j,k);
     }
   }
 }
  
  printf("%lld\n", mygcd);
  
  return 0;
}

int gcd(int a, int b, int c)
{
  int mygcd;
  
  for(int i=1; i<=a && i<=b && i<=c; i++)
  {
    if(a%i==0 && b%i==0 && c%i==0)
      mygcd=i;
  }
  
  return mygcd;
}

Measured memory_bytes: 1724
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False



a,c = m()

if a <= 9 and c <= 9:
    print(a*c)
else:
    print(-1)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    map<string, int> mm;
    int n;
    cin >> n;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        string x;
        cin >> x;
        mm[x]++;
        mx = max(mx, mm[x]);
    }
    for (auto &x : mm) {
        if (x.second == mx)
            cout << x.first << '\n';
    }
    return 0;
}

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

int main(){
    int n, k;
    int num = 1;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i){
        if ((num + k) < (2 * num)){
            num += k;
        } else {
            num *= 2;
        }

    }
    printf("%d\n", num);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int A[200010];
int B[200010];

int main() {
  int N; cin >> N;
  for ( int i = 0; i < N; i++ ) {
    cin >> A[i];
    B[i] = A[i] - (i+1);
  }

  sort(B,B+N);

  int b = B[N/2];
  ll ans = 0;
  for ( int i = 0; i < N; i++ ) {
    ans += abs(B[i]-b);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn];
pair<int, int> arr[maxn];

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

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i].ff;
		arr[i].ss = i;
	}
	sort(arr, arr + n);
	for (int i = 0; i < n; i++)
		a[arr[i].ss] = i;
	int ans = 0;
	for (int i = 1; i < n; i += 2)
		ans += (a[i] % 2 == 0);
	cout << ans << endl;
}



Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
struct poi{
	int X;int Y;int Z;
	bool operator<(const poi&R)const{
		return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
	}
};
//
ll GCD(ll a,ll b){
	return (b==0)?(a):(GCD(b,a%b));
}
ll LCM(ll a,ll b){
	return a/GCD(a,b)*b;
}
//
int main(){
	int R;
	cin>>R;
	if(R<1200){
		cout<<"ABC"<<endl;
	}else if(R<2800){
		cout<<"ARC"<<endl;
	}else{
		cout<<"AGC"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#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(){
    ll x;
    cin >> x ;

    ll money = 100;
    ll count = 0;
    while(money<x){
        money *= 1.01;
        count++;
    }

    cout << count << endl;
}

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

int N;
int A[210];

int main() {
    int A, B, C, X;


//    cin >> A;
//    cin >> B;
//    cin >> C;
//
//    cin >> required_amount;

//  一行でまとめてinputできる
    cin >> A >> B >> C >> X;

    int counter = 0;
    int subtotal = 0;
    
    for (int a = 0; a <= A; ++a) {
        for (int b = 0; b <= B; ++b){
            for (int c = 0; c <= C; ++ c){
                subtotal = 500 * a + 100 * b + 50 * c;
                if (subtotal == X ) ++counter;
                subtotal = 0;
            }
        }
    }
    
    cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n;
  cin>>n;
  string ans="NO";
  if(n==7||n==5||n==3)ans="YES";
  cout(ans);
  return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int A, B;
	cin >> A >> B;
	int now = 1;
	int ans = 0;
	while (now < B) {
		now--;
		now += A;
		ans++;
	}
	cout << ans << endl;


	return 0;
}


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

using namespace std;
int main() {
	int n; cin >> n;
	vector<int>h(n); for (int i = 0; i < n; i++)cin >> h[i];
	vector<int>cost(n); for (int i = 1; i < n; i++)cost[i] = 1145141919;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= min(2, i); j++) {
			cost[i] = min(cost[i], cost[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << cost[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
using namespace std;
int main(){
long a,b,c,n,x,i;
while(cin>>a){
cin>>b>>c>>n;
if(a==0)break;
if(a>=b&&a>=c)x=b*b+c*c;
else if(b>=a&&b>=c)x=a*a+c*c;
else x=a*a+b*b;
for(i=0;i<n;i++){
cin>>a;
if(a*a*4>x)cout<<"OK"<<endl;
else cout<<"NA"<<endl;
}
}
return 0;
}

Measured memory_bytes: 1156
S = input()

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        c_index = S[2:-1].find('C') + 2
        if S[1:c_index].islower() and S[c_index + 1:].islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')


Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main() {
 int N;
 cin >> N;
 int a[N][N];
 for (int i=0; i<N; i++) {
  for (int j=0; j<N; j++) {
   a[i][j] = 0;
  }
 }
 for (int i=0; i<N; i++) {
  int u,k;
  cin >> u >> k;
  for (int j=0; j<k; j++) {
   int v;
   cin >> v;
   a[u-1][v-1] = 1;
  }
 }
 for (int i=0; i<N; i++) {
  for (int j=0; j<N; j++) {
   cout << a[i][j] << ((j == N-1) ? "" : " ");
  }
  cout << endl;
 }
}


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

int main() {
	int a, b;

	cin >> a >> b;

	if (a < 10 && b < 10) {
		cout << a * b;
	} else {
		cout << -1;
	}

	return 0;
}

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

int main() {
    int n;cin >> n;
    double x[n];
    string u[n];
    rep(i,n)cin >> x[i] >> u[i];
    double money = 0;
    rep(i,n){
        if(u[i] == "BTC")money += x[i]*380000.0;
        else money += x[i];
    }
    cout << money << endl;
}

Measured memory_bytes: 256
#include <algorithm>
    #include <iostream>
    using namespace std;
     
    int main()
    {
      int N; cin >> N;
      long cnt[100005] = {};
      int D[100005] = {};
      int mx_D = 0;
      for (int i = 0; i < N; i++)
      {
        cin >> D[i];
        mx_D = max(mx_D, D[i]);
        cnt[D[i]]++;
      }
      
      if (cnt[0] != 1 || D[0] != 0)
      {
        cout << 0 << endl;
        return 0;
      }
      
      long ans = 1;
      long mod = 998244353;
      
      for (int j = 1; j <= mx_D; j++)
      {
        for (int k = 0; k < cnt[j]; k++)
        {
          ans *= cnt[j - 1];
          ans %= mod;
        }
      }
      
      cout << ans << endl;
      return 0;
    }

Measured memory_bytes: 1408
"use strict";

var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

function next() {
    return +cin[cid++];
} // number一個取得
function nextstr() {
    return cin[cid++];
} // 文字列一個取得
function nextbig() {
    return BigInt(cin[cid++]);
} // BigInteger一個取得
// 長さnの配列として取得。aは文字列フラグ
function nexts(n, a) {
    return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a);
}
// 長さnのBigInt配列として取得。
function nextsbig(n) {
    return cin.slice(cid, cid += n).map(a => BigInt(a));
}
// w個ずつを組にして長さhの配列。aは文字列フラグ。
function nextm(h, w, a) {
    var r = [],
        i = 0;
    if (a)
        for (; i < h; i++) r.push(cin.slice(cid, cid += w));
    else
        for (; i < h; i++) r.push(cin.slice(cid, cid += w).map(a => +a));
    return r;
}
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
function xArray(v) {
    var a = arguments,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
}


console.log(main().toString());

function main() {
    let a = next();
    let b = next();
    let c = next();
    let x = next();
    let ans = 0;
    for (let i500 = 0; i500 <= a; i500 ++)
        for (let i100 = 0; i100 <= b; i100 ++)
            for (let i50 = 0; i50 <= c; i50 ++)
                if (i500 * 500 + i100 * 100 + i50 * 50 === x) ans++;
    return ans;
}

Measured memory_bytes: 9420
import java.util.Scanner;

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

        long X = sc.nextLong();
        long Y = sc.nextLong();

        System.out.println(solve(X, Y));

        sc.close();
    }

    static String solve(long X, long Y) {
        return Math.abs(X - Y) <= 1 ? "Brown" : "Alice";
    }
}

Measured memory_bytes: 22612
H,W,K = map(int, input().split())

if W == 1:
    print(1 if K == 1 else 0)
    exit()

MOD = 10 ** 9 + 7

states = [0]
for state in range(1, 1 << (W - 1)):
    flag = True
    for j in range(1, W - 1):
        if ((state >> j - 1) & 1) and ((state >> j) & 1):
            flag = False
    if flag: states.append(state)

dp = [[0] * W for _ in range(H + 1)]

dp[0][0] = 1

# 貰うDP
for i in range(H):
    for state in states:
        for j in range(W - 1):
            if (state >> j) & 1:
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j + 1]) % MOD
                dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD
            else:
                if j == 0:
                    dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD
                elif not ((state >> j - 1) & 1):
                    dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD
                if j == W - 2:
                    dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j + 1]) % MOD

print(dp[H][K - 1])

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
using namespace std;

int main(void) {
	vector<double> r;
	int n;
	while (true)
	{
		cin >> n;
		if (n==-1){break;}
		double x=1,y=0,s=0,c=0;
		for (int i=1; i<n; i++)
		{
			if(x!=0)
			{
				s = y/(sqrt(x*x+y*y));
				c = x/(sqrt(x*x+y*y));
				x -= s;
				y += c;
			} else {
				if (y>=0)
				{
					x -= 1;
				} else {
					x += 1;
				}
			}
		}
		r.push_back(x);
		r.push_back(y);
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typedef long long ll;

const ll inf = 1e15;
const int maxn = 2005;

int n;
ll x, a[maxn], min[maxn], ans;

int main() {
    scanf("%d%lld", &n, &x);
    for (int i = 0; i < n; i++) scanf("%lld", a+i);
    ans = inf;
    std::fill(min, min+n, inf);
    for (int i = 0; i < n; i++) {
        ll c = i * x;
        for (int j = 0; j < n; j++) {
            domin(min[j], a[(j-i+n)%n]);
            c += min[j];
        }
        domin(ans, c);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>

#define Rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())

#define eb emplace_back
#define dbg(x) cout<<#x" = "<<((x))<<endl
#define fs first
#define sc second
     
using namespace std;
     
     
typedef long long ll;
typedef pair<ll, ll> P;
     
     
int main(){
  ll N, M;

  cin >> N >> M;

#ifdef DEBUG
  cout << "N=" << N << " M=" << M << endl;
#endif

  vector<ll> dList;
  ll max = (ll)ceil(sqrt(M));

  for(ll n = 1; n <= max; n++){
    if(M % n == 0){
      dList.eb(n);
      dList.eb(M/n);
    }
  }
  Sort(dList);
  

  ll ans = 1;
  for(size_t i = 0; i < dList.size(); ++i){
    if(dList[dList.size() - i - 1] * N <= M) {
      ans = dList[dList.size() - i - 1];
      break;
    }
  }

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


Measured memory_bytes: 384
import java.util.*;import static java.lang.Math.*;class Main{public static void main(String[]z){new Main();}Main(){Scanner s=new Scanner(System.in);for(int t=s.nextInt(),i,x,y;t-->0;){double[][]p=new double[3][6];for(i=3;i-->0;p[1][i]=s.nextDouble())p[0][i]=s.nextDouble();for(i=6;i-->0;y=(i+2)%3,p[2][i]=sqrt(pow(p[0][x]-p[0][y],2)+pow(p[1][x]-p[1][y],2)))x=(i+1)%3;System.out.printf("%.3f %.3f %.3f\n",l(p[0],p[2]),l(p[1],p[2]),p[2][0]/(2*sqrt(1-pow(c(p[2],0),2))));}}double l(double[]p,double[]l){double r=0,t=0,s;for(int i=0;i<3;r+=p[i++]*s,t+=s)s=a(l,i);return r/t;}double a(double[]l,int i){return 2*c(l,i)*sqrt(1-pow(c(l,i),2));}double c(double[]l,int i){return(pow(l[i+1],2)+pow(l[i+2],2)-pow(l[i],2))/(2*l[i+1]*l[i+2]);}}

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

using namespace std;
typedef long long ll;

int main() {
	int m1, m2;
	int d1, d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;

	if(m1 != m2){
		cout << "1" << endl;
	}else{
		cout << "0" << endl;
	}
}

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

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(t,a,b) for(int t=(a);t<(b);++t)
#define REP(t,n)  FOR(t,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;



const LL mod = 1000000007;

LL gcd(LL a, LL b) { if (a%b == 0) { return b; } else return gcd(b, a%b); }
LL lcm(LL a, LL b) { return a / gcd(a, b)*b; }

#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

#define POSSIBLE cout<<"POSSIBLE"<<endl; return 0;
#define IMPOSSIBLE cout<<"IMPOSSIBLE"<<endl; return 0;




int main() {

	int a, b, c;
	string s;
	cin >> a >> b>>c;
	//cin >> s;

	if (c-a<=b&&a<=c) {
		YES_;
	}
	else {
		NO_;
	}
}

Measured memory_bytes: 256
import numpy as np
MOD = 10**9+7

N = int(input())
A = np.array(list(map(int, input().split())))
A = A % MOD

AS = []
s = 0
for a in range(len(A)):
  s = (s + A[a]) % MOD
  AS.append(s)
AS = np.array(AS)

s = 0
for i in range(len(A)-1):
  s = (A[i] * ((AS[N-1]-AS[i])) % MOD + s) % MOD
  
print(s)

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

class Info {
public:
	int t, s, d;

	bool operator < (const Info& obj) const
	{
		return t < obj.t;
	}
};

int main()
{
	while (true) {
		int n, m;

		cin >> n >> m;

		if (n == 0 && m == 0) {
			break;
		}

		vector<Info> data(m);
		vector<bool> infected(n, false);

		infected[0] = true;

		rep(i, m) {
			cin >> data[i].t >> data[i].s >> data[i].d;
			data[i].s--;
			data[i].d--;
		}

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

		rep(i, m) {
			if (infected[data[i].s] == true) {
				infected[data[i].d] = true;
			}
		}
		
		int ans = 0;

		rep(i, n) {
			if (infected[i] == true) {
				ans++;
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3260
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

ll dp[3003][3003][4];

int main(int argc, char const *argv[]) {
    ll r,c,k; cin>>r>>c>>k;
    memset(dp, 0ll, sizeof(dp));
    map<P, ll> mp;
    rep(i,k) {
        ll a, b, v; cin>>a>>b>>v;
        mp[make_pair(a,b)] = v;
    }

    for (int i = 1; i <= r; ++i) {
        for (int j = 1; j <= c; ++j) {
            P p = make_pair(i,j);
            if (mp.count(p)) {
                rep(k,4) chmax(dp[i][j][0], dp[i-1][j][k]);
                rep(k,4) chmax(dp[i][j][1], dp[i-1][j][k]+mp[p]);
                rep(k,4) chmax(dp[i][j][k], dp[i][j-1][k]);
                for (int k = 1; k <= 3; ++k) {
                    chmax(dp[i][j][k], dp[i][j-1][k-1]+mp[p]);
                }
            }
            else {
                rep(k,4) {
                    chmax(dp[i][j][k], dp[i][j-1][k]);
                }
                rep(k,4) {
                    chmax(dp[i][j][0], dp[i-1][j][k]);
                }
            }
        }
    }

    ll ans = 0;
    rep(k,4) chmax(ans, dp[r][c][k]);
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 297916
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long INF = INT_MAX;
const long long LINF = LLONG_MAX;
const long long N = 2e6+1;
 
typedef long long ll;
typedef long double ld;  
 
void test_case()
{
    ll n, m ,i, j, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    f(i,0,n)
    {
        cin >> a[i];
        if(i)
            a[i]+= a[i-1];
    }
    f(i,0,m)
    {
        cin >> b[i];
        if(i)
            b[i]+=b[i-1];
    }
    ll st1 = 0, st2 = 0, ans = 0, tot = 0;
    ll x = upper_bound(all(b), k)-b.begin();
    ans = x;
    f(i,0,n)
    {
        ll req = k-a[i];
        ll x = 0;
        if(req > 0)
            x = upper_bound(all(b), req)-b.begin();
        if(req >= 0)
            ans = max(ans, i+1+x);
    }
    cout << ans << '\n';
 
}
 
int32_t main()
{
    IOS(); 
     
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 6336
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll N;
    input(N);

    vector<ll> a(N, 0);
    input(a);

    if (find(a.begin(), a.end(), 1) == a.end())
    {
        cout << -1 << endl;
        return 0;
    }

    ll now = 1;
    ll res = 0;
    rep(i, 0, N)
    {
        res++;
        if (a[i] == now)
        {
            res--;
            now++;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);
	      	  
	      	  int x;
	      	  cin >> x;
	      	  cout << 24+24-x << endl;

	          return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define LL long long
#define maxn 100005
int n,m,id[maxn],st[maxn],tp;
LL k,x[maxn],ans[maxn];
bool vis[maxn];
void swap(int &a,int &b) { int t=a; a=b; b=t; }
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&x[i]);
	for(int i=n;i;i--) x[i]-=x[i-1],id[i]=i;
	scanf("%d%lld",&m,&k);
	for(int i=1;i<=m;i++)
	{
		int a;
		scanf("%d",&a);
		swap(id[a],id[a+1]);
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			tp=0;
			for(int j=i;!vis[j];j=id[j]) st[++tp]=j,vis[j]=true;
			for(int j=1;j<=tp;j++) ans[st[j]]=x[st[(k+j-1)%tp+1]];
		}
	for(int i=1;i<=n;i++) ans[i]+=ans[i-1];
	for(int i=1;i<=n;i++) printf("%lld.0\n",ans[i]);
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef double ld;

int main()

{ 
ios_base::sync_with_stdio(false);

cin.tie(NULL);
ll n,m;
cin>>n>>m;
vector<string> a(n);
forn(i,n)
{
    cin>>a[i];
    
}
sort(all(a));
forn(i,n)
cout<<a[i];
return 0;

}


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

struct Query{
  int c, s, t, x, i;
  Query(int c, int s, int t, int x) : c(c), s(s), t(t), x(x){}
  Query(int c, int i) : c(c), i(i){}
};
vector<Query> query;


#define SEG_LEN (1 << 18)

int seg[SEG_LEN * 2];

int get(int i){
  i += SEG_LEN; 
  
  int ans = seg[i];
  while(true){
    i /= 2;
    if(i == 0)break;
    ans += seg[i];
  }
  return ans;
}

void add(int l, int r, int x){
  l += SEG_LEN;
  r += SEG_LEN;

  while(l < r){
    if(l % 2){
      seg[l] += x; 
      ++l; 
    }
    l /= 2;
    if(r % 2){
      seg[r - 1] += x;
      --r; 
    }
    r /= 2;
  }
}

int main(){
  int n, q, c, s, t, x, i;
  cin >> n >> q;
  for(int _ = 0; _ < q; ++_){
    cin >> c;
    if(c == 0){
      cin >> s >> t >> x;
      query.push_back(Query(c, s, t, x));
    }
    else{
      cin >> i;
      query.push_back(Query(c, i));
    }
  }

  for(auto qry : query){
    if(qry.c == 0)add(qry.s, qry.t + 1, qry.x);
    else cout << get(qry.i) << endl;
  }

  return 0;
}



Measured memory_bytes: 5764
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main()
{
 int n, d;
 int ans=0;
 cin >> n >> d;
 double x[n+1][d+1];
 for(int i=1; i<n+1; i++){
   for(int j=1; j<d+1; j++){
     cin >> x[i][j];
   }
 }
//  cout << x[2][1] <<x[2][2] <<x[2][3] <<x[2][4] << endl;
 for(int i=1; i<n+1; i++){
   	for(int j=1; j<n+1; j++){
     double dis2=0;
     double dis=0;
     if(i==j) break;
     for(int k=1; k<d+1; k++) dis2+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
     dis=sqrt(dis2);
//     cout << i <<' '<< j <<' '<< dis2 << endl;
     if(fmod(dis, 1)==0) ans+=1;
   }
 }
 cout<< ans;
  return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

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

    int n = stdIn.nextInt();

    if(n == 1) {
      System.out.println("Hello World");
    } else {
      int a = stdIn.nextInt();
      int b = stdIn.nextInt();
      System.out.println(a + b);
    }


  }
}

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

int main()
{
    int N;
    cin >> N;
    map<int, int> A;
    long B;
    vector<int> C(N);

    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
    }

    for (int i = 0; i < N; i++)
    {
        if (A.count(C[i]))
        {
            A[C[i]] += 1;
            B += A[C[i]];
        }
        else
        {
            A[C[i]] = 0;
        }
    }

    for (int i = 0; i < N; i++)
    {
        cout << B - A[C[i]] << endl;
    }
}

Measured memory_bytes: 8320
package main

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

var scan = bufio.NewScanner(os.Stdin)

func main() {
	scanWords()

	int1, _ := readInputAsInt()
	int2, _ := readInputAsInt()

	fmt.Printf("%d %d\n", int1*int2, 2*(int1+int2))
}

func scanWords() {
	scan.Split(bufio.ScanWords)
}

func readInputAsInt() (int, error) {
	scan.Scan()
	return strconv.Atoi(scan.Text())
}



Measured memory_bytes: 1092
import static java.math.BigDecimal.valueOf;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

class BigPoint {

final BigDecimal x;
final BigDecimal y;

BigPoint(BigDecimal x, BigDecimal y) {
  this.x = x;
  this.y = y;
}

BigPoint(Scanner in) {
  this.x = in.nextBigDecimal();
  this.y = in.nextBigDecimal();
}

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  BigPoint other = (BigPoint) obj;
  return (x.equals(other.x) && y.equals(other.y));
}

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + x.hashCode();
  result = prime * result + y.hashCode();
  return result;
}
}

public class Main {
static boolean isCross(long r, BigPoint p1, BigPoint p2) {
  return distanceSq(p1, p2).compareTo(valueOf(r * r)) <= 0;
}

static BigDecimal distanceSq(BigPoint p1, BigPoint p2) {
  return ((p1.x.subtract(p2.x).pow(2)).add(
	  p1.y.subtract(p2.y).pow(2)));
}

static BigDecimal getCenter(BigDecimal a, BigDecimal b) {
  return (a.equals(b)) ? a : a.add(b).divide(valueOf(2d));
}

public static void main(String[] args) {
  Scanner in =
	  new Scanner(System.in).useDelimiter("[^0-9.]+");
  List<BigPoint> points = new ArrayList<BigPoint>();
  Set<BigPoint> centers = new HashSet<BigPoint>();
  int n = in.nextInt();
  while (n > 0) {
	points.clear();
	for (int i = 0; i < n; i++) {
	  points.add(new BigPoint(in));
	}
	centers.clear();
	for (BigPoint s1 : points) {
	  for (BigPoint s2 : points) {
		if (!s1.equals(s2) && isCross(2, s1, s2)) {
		  BigDecimal x = getCenter(s1.x, s2.x);
		  BigDecimal y = getCenter(s1.y, s2.y);
		  BigPoint c = new BigPoint(x, y);
		  centers.add(c);
		}
	  }
	}
	int max = 1;
	for (BigPoint c : centers) {
	  int count = 0;
	  for (BigPoint p : points) {
		if (isCross(1, c, p)) {
		  count++;
		}
	  }
	  max = Math.max(count, max);
	}
	System.out.println(max);
	n = in.nextInt();
  }
}
}

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

vector<vector<int> > happiness;

map<pair<int,int> ,int> memory;

int dp(int day,int activity){
    if(day == 0){
        return happiness[day][activity];
    }
    if(memory.count({day,activity})){
        return memory[{day,activity}];
    }
    int max_happiness = 0;
    for(int i=0;i<3;i++){
        if(activity!=i){
            max_happiness = max(max_happiness , happiness[day][activity] +  dp(day-1,i));
        }
    }
    return memory[{day,activity}] = max_happiness;
}


int main(int argc, const char** argv) {
    ios::sync_with_stdio(false);cin.tie(NULL);
    int n;
    cin>>n;
    happiness.resize(n, vector<int>(3,0));
     for(int i=0;i<n;i++){
        for (size_t j = 0; j < 3; j++)cin>>happiness[i][j];
     }

    cout<< max(dp(n-1,0),max(dp(n-1,1) , dp(n-1,2)));
    
    // vector<int> old_dp(3);
    // vector<int> new_dp(3);
    // vector<int> happiness(3);

    // for(int i=0;i<n;i++){
    //     for (size_t j = 0; j < 3; j++)cin>>happiness[j];

    //     if(i > 0){
    //         new_dp[0] = happiness[0] + max(old_dp[1],old_dp[2]);  
    //         new_dp[1] = happiness[1] + max(old_dp[0],old_dp[2]);  
    //         new_dp[2] = happiness[2] + max(old_dp[1],old_dp[0]);  
    //     }
    //     for (size_t j = 0; j < 3; j++)old_dp[j]=new_dp[j];

    // }

    // cout<<*max_element(old_dp.begin(),old_dp.end());
    return 0;
}

Measured memory_bytes: 36992
#include <iostream>

using namespace std;

int main(void){
  while(1){
    int m, nmin, nmax;
    cin >> m;
    cin >> nmin;
    cin >> nmax;
    if(m == 0 && nmin == 0 && nmax == 0){ return 0; }

    int P[m];

    for(int i = 0 ; i < m ; i++){
      cin >> P[i];
    }

    int ans = nmin;
    int max = -1;
    for(int i = nmin ; i <= nmax ; i++){
      if(max >= P[i] - P[i - 1]){
        max = P[i] - P[i - 1];
        ans = i;
      }
    }

    cout << ans << endl;
  }



  return 0;
}

Measured memory_bytes: 3064
from operator import itemgetter as ite
N,M = map(int,input().split())
alllist = []
for i in range(N):
    A,B = map(int,input().split())
    alllist.append([A,B])
alllist.sort(key=ite(0))
cost = 0
for j in range(M):
    cost += alllist[0][0]
    alllist[0][1] -= 1
    if alllist[0][1] == 0:
        del alllist[0]

print(cost)

Measured memory_bytes: 21272
#include <stdio.h>
#include <algorithm>
using namespace std;
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	// Pは所属する県の番号、Yは誕生年,indexは入力時の順番
	// Count各県ごとの市をカウントするのに用いる。例えば、Count[0]は県1のためのスペースである。
	int P[m], Y[m], Count[n+1]={0}, Index[m];
	for (int i = 0; i < m; i++)
		scanf("%d %d", P + i, Y + i);
	for (int i = 0; i < m; i++)
		Index[i] = i;
	// index を誕生年順に並び変える。
	sort(Index, Index + m, [&](int a, int b){
		return Y[a] < Y[b];
	});//[]~[b]までは第3引数の順序 参照でキャプチャ

	//誕生年の若い順に、所属する県の中で何番目に生まれたか代入する。
	for (int i = 0; i < m; i++)
		Y[Index[i]] = ++Count[P[Index[i]]]; 
	for (int i = 0; i < m; i++)
		printf("%06d%06d\n", P[i], Y[i]);
}

Measured memory_bytes: 3072
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  int m = 0;
  for (int t = n; t; t /= 10) m += t % 10;
  cout << (n % m == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 200000
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	int n,t;
	cin>>n;
	int c[n-1],s[n-1],f[n-1];
	rep(i,n-1)cin>>c[i]>>s[i]>>f[i];
	rep(j,n){
		t=0;
		loop(i,j,n-1){
			if(t>=s[i]){
				t-=s[i];
				int res=t/f[i];
				if(t%f[i])t=s[i]+f[i]*(res+1)+c[i];
				else t=s[i]+f[i]*res+c[i];
			}else t=s[i]+c[i];
		}
		cout<<t<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

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

int main() {
	ll N, x; cin >> N >> x;
	ll a[100000];
	ll cnt = 0;
	rep(i, 0, N) {
		cin >> a[i];
		if (i == 0) {
			if (x < a[i]) {
				ll t = a[i] - x;
				a[i] -= t;
				cnt += t;
			}
		}
		else if (i > 0) {
			if (x < a[i - 1] + a[i]) {
				ll t = a[i - 1] + a[i] - x;
				a[i] -= t;
				cnt += t;
			}
		}
	}
	cout << cnt << endl;

	return 0;
}

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

int main() {
  vector<int> dish_time(5);
  int sum_time = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> dish_time.at(i);
    sum_time += (dish_time.at(i) + 9) / 10 * 10;
  }

  int min_time = 0;
  for (int i = 0; i < 5; ++i) {
    min_time = max(min_time, ((dish_time.at(i) + 9) / 10 * 10) - dish_time.at(i));
  }

  cout << sum_time - min_time << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,sum=0; cin >> N;
  vector<string> s(N+10);
  vector<int> t(N+10);
  
  for(int i=1; i<=N; i++) cin >> s[i] >> t[i];
  
  string X; cin >> X;
  for(int i=1; i<=N; i++) {
    if(s[i] == X) {
      for(int j=i+1; j<=N; j++) sum += t[j];
    }
  }
  cout << sum << endl;
}

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

const int maxn=305;
const int mod=998244353;
int n,ans;
char s[maxn];
bool f[maxn][maxn][maxn];
int g[maxn][maxn][maxn],suf[maxn];

void Add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}

int main(){
	scanf("%s",s);n=strlen(s);
	f[0][0][0]=true;
	for(int i=0;i<n;i++)for(int j=n;j>=0;j--)for(int k=n;k>=0;k--)if(f[i][j][k]){
		if(i+1<n){
			if(s[i]=='0'||s[i+1]=='0')f[i+2][j+1][k]=true;
			if(s[i]=='1'||s[i+1]=='1')f[i+2][j][k+1]=true;
		}
		if(j+k>=2){
			if(j)f[i][j-1][k]=true;
			if(k)f[i][j][k-1]=true;
		}
		if(j+k>=1){
			f[i+1][j][k]=true;
			if(s[i]=='0'&&k)f[i+1][j+1][k-1]=true;
			if(s[i]=='1'&&j)f[i+1][j-1][k+1]=true;
		}
	}
	g[0][0][n]=1;
	for(int j=0;j<=n;j++)for(int k=0;k<=n;k++)for(int i=n;i>=0;i--)if(g[j][k][i]){
		Add(g[j+1][k][i-(i>0&&s[i-1]=='0')],g[j][k][i]);
		Add(g[j][k+1][i-(i>0&&s[i-1]=='1')],g[j][k][i]);
	}
	suf[n]=0;
	for(int i=n-1;i>=0;i--)suf[i]=suf[i+1]+(s[i]=='1');
	for(int j=0;j<=n;j++)for(int k=0;k<=n;k++){
		int mx=-1;
		for(int i=0;i<=n;i++)
			if(j-(n-i-suf[i])>=0&&k-suf[i]>=0&&f[i][j-(n-i-suf[i])][k-suf[i]])mx=i;
		for(int i=0;i<=mx;i++)Add(ans,g[j][k][i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 121044