akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  if(N == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int n, ok = 0;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            ok = 1;
        }
    }
    if (ok) {
        puts("0");
        return 0;
    }
    sort(a.begin(), a.end());
    ll m = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] <= INF / m) {
            m *= a[i];
        } else {
            puts("-1");
            return 0;
        }
    }
    cout << m << '\n';
    return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using ll=long long;
int main()
{
  int N;std::cin>>N;
  std::map<std::string,int> mp;
  for(int i=0;i<N;i++){
    std::string s;std::cin>>s;
    std::sort(s.begin(),s.end());
    mp[s]++;
  }
  ll ans =0;
  for(const auto&p:mp){
    const ll n =p.second;
    ans += n*(n-1)/2;
  }
  std::cout<<ans <<std::endl;
}

Measured memory_bytes: 11136
s = input()
len_s = len(s)
pre = 0
mod = [0]*2019
mod[0]=1
x = 1
for i in range(len_s):
    pre = (x*int(s[len_s-i-1])+pre)%2019
    mod[pre] += 1
    x *= 10
    x %= 2019
print(sum([m*(m-1)//2 for m in mod]))

Measured memory_bytes: 9280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#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 FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;

    ll ans = -1000000000000000000;
    
/*    if (a <= 0 && 0 <=b) {

    }
    if (c <= 0 && 0 <=d) {
        
    }
*/
    ans = max(ans,a*c);
    ans = max(ans,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <map>

using namespace std;
int a[100005];
int main()
{
	int n,c,k;
	scanf("%d%d%d",&n,&c,&k);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	int ans=1;
	long long t=a[0]+k,cc=1;
	for(int i=1;i<n;i++)
	{
		if(a[i]<=t)
		{
			cc++;
		}
		if(a[i]>t||cc>c)
		{
		//	cout<<t<<"t";
			ans++;
			t=a[i]+k;
			cc=1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
N = int(input())
S = []
for i in range(N):
    S.append(input())
    
from collections import Counter

c = Counter(S)
keys, values = zip(*c.most_common())

name = []
k = values[0]

for i in range(len(keys)):
    if values[i] == k:
        name.append(keys[i])

name.sort()

for i in range(len(name)):
    print(name[i])
    

Measured memory_bytes: 59536
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=1;
	for(int i=1; i<n; i++){
		if(s[i]!=s[i-1]) ans++;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
def main():
    N = int(input())
    A = list(map(int, input().split()))

    E = []
    for a in A:
        if a % 2 == 0:
            E.append(a)

    for e in E:
        if e % 3 == 0 or e % 5 == 0:
            continue
        else:
            print("DENIED")
            return

    print("APPROVED")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <stdio.h>
#include <map>
#include <algorithm>
using namespace std;

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    mp[x]++;
  }
  for (int i = 0; i < m; i++) {
    int x, c;
    scanf("%d %d", &x, &c);
    mp[c] += x;
  }
  long long ans = 0;
  for (auto it = mp.rbegin(); it != mp.rend(); it++) {
    int pick = min(n, it->second);
    ans += 1LL * pick * it->first;
    n -= pick;
  }
  printf("%lld\n", ans);
  return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

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

	int ans = 0;
	fx(s.size()) {
		if (s[x]=='1') {
			ans++;
		}
	}
	ce(ans)

    return 0;
}



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

#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define ld long double
#define EPS (1e-6)
#define OO (1ll << 50)
#define mod 1000000007
#define pii pair<int , int>

using namespace std;
const int N = 100005;
ll n, arr[N], cnt[N];

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	io;
	cin >> n;
	for(int i = 0; i < n; ++i) {
        cin >> arr[i];
        ++cnt[arr[i]];
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
        ans = max(ans, cnt[arr[i]] + cnt[arr[i] - 1] + cnt[arr[i] + 1]);
	}
	cout << ans << endl;
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N,K;
    cin>>N>>K;
    ll ans = 0;
    REP(i,N+1) {
        int b = i;
        if (b > K) {
            int n = N/b;
            ans += n * (b - K);
            ans += max(0,N%b - K + 1);
        }
    }
    if (K==0) ans-=N;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int max(int a , int  b){
  if(a > b) return a;
  else return b;

}
int min(int a , int b){
  if(a < b) return a;
  else return b;
}
bool cmp(pair < int , string >   a , pair < int , string >   b){
  if(a.first < b.first ) return true;
  else return false;
}
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int dp[123456][3];
int32_t main(){  
  fast;
  int n,k;
  cin >> n;
  vector < int > a(n) , b(n) , c(n);
  for(int i = 0 ; i < n ; i++) cin >> a[i] >> b[i] >> c[i];
  dp[0][1] = b[0];
  dp[0][0] = a[0];
  dp[0][2] = c[0];
  for(int i = 1 ; i < n ; i++){
    dp[i][0] = max(dp[i-1][1] + a[i] , dp[i-1][2] + a[i]);
    dp[i][1] = max(dp[i-1][0] + b[i] , dp[i-1][2] + b[i]);
    dp[i][2] = max(dp[i-1][0] + c[i] , dp[i-1][1] + c[i]);
  }
  //for(int i = 0 ; i < n ; i++) cout << dp[i] << "**\n";
  cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << "\n";
  return 0;
} 

Measured memory_bytes: 4992
N = int(input())
A = list(map(int,input().split()))
s = 0
for i in range(0,N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            s = s + 1
if s > 0:
    print("DENIED")
else:
    print("APPROVED")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> c, s, f;
    for (ll i = 0; i < n - 1; i++)
    {
        ll _c, _s, _f;
        cin >> _c >> _s >> _f;
        c.push_back(_c);
        s.push_back(_s);
        f.push_back(_f);
    }

    vector<ll> ans(n, 0);

    for (ll i = 0; i < n - 1; i++)
    {
        ll t = s[i] + c[i];
        for (ll k = i + 1; k < n - 1; k++)
        {
            if (t <= s[k])
            {
                t = s[k] + c[k];
            }
            else if (t % f[k] == 0)
            {
                t += c[k];
            }
            else
            {
                t += (f[k] - (t % f[k])) + c[k];
            }
        }
        ans[i] = t;
    }

    for (auto a : ans)
    {
        cout << a << endl;
    }
}

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

int main(){
  int N;
  int count=-1;
  int check=0;
  cin >> N;
  
  vector<int> A(N);
  while(check==0){
    for(int i=0;i<N;i++){
      cin >> A.at(i);
      check+=A.at(i)%2;
      A.at(i)/=2;
    }
    count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int N, M;
vector<vector<int>> edge(9);
int goal = 0, ans = 0;
bitset<9> used;

void rec(int corrent = 1){
    if(corrent == goal){
        if(used.count() == N) ++ans;
        return;
    }
    for(auto next : edge[corrent]){
        if(used[next]) continue;
        used[next] = true;
        rec(next);
        used[next] = false;
    }
    return;
}

int main(void){
    
    scanf("%d %d", &N, &M);
    for(int i = 0; i < M; ++i){
        int a, b; scanf("%d %d", &a, &b);
        edge[a].push_back(b), edge[b].push_back(a);
    }
    
    for(int i = 2; i <= N; ++i){
        used.reset();
        used[1] = true;
        goal = i;
        rec();
    }
    printf("%d\n", ans);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

ll combination(ll a, ll b)
{
    ll ret = 1;

    for (int i = a; i > a - b; i--)
    {
        ret *= i;
    }

    for (int i = 1; i <= b; i++)
    {
        ret /= i;
    }

    return ret;
}

void solve(long long N, string str)
{
    ll ans = 0;
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            for (int k = 0; k < 10; k++)
            {
                ll cnt = 0;
                for (int index = 0; index < N; index++)
                {
                    if (cnt == 0 && str[index] - '0' == i)
                    {
                        cnt++;
                        continue;
                    }
                    if (cnt == 1 && str[index] - '0' == j)
                    {
                        cnt++;
                        continue;
                    }
                    if (cnt == 2 && str[index] - '0' == k)
                    {
                        ans++;
                        break;
                    }
                }
            }
        }
    }

    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    string str;
    cin >> str;
    solve(N, str);
    return 0;
}


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

int main()
{
 	string s;
  cin >> s;
  //Sunny, Cloudy, Rainy 
  if (s == "Sunny")
    cout << "Cloudy" << endl;
  else if (s == "Cloudy")
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;
}

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

int main(void){
    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: 3076
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9+7;
const int inf= 1e9;
const int maxn = 3005;
int a[maxn][maxn],d[maxn][maxn];
int n,m;

bool dentro(int i, int j){
	if(i >=1 && i <=n && j >=1 && j <=m)
		return true;
	return false;
}

int main(){__
	cin >> n >> m;
	int ix,iy,fx,fy;
	cin >> ix >> iy >> fx >> fy;
	for(int i=1; i <=n; i++){
		for(int j=1; j <=m; j++){
			d[i][j] = inf;
			char c;
			cin >> c;
			a[i][j] = (c == '.');
		}
	}

	deque<pii> dq;
	dq.push_front(pii(ix,iy));
	d[ix][iy] = 0;

	while(!dq.empty()){
		pii e = dq.front();
		dq.pop_front();
		int x = e.fi, y = e.se;
		for(int i=-2; i <= 2; i++){
			for(int j=-2; j <=2; j++){
				if(i == j && i == 0) continue;
				if(!dentro(x+i,y+j)) continue;
				if(!a[x+i][y+j]) continue;

				int f = (abs(i)+abs(j));
				if(d[x+i][y+j] > d[x][y] + (f > 1)){
					d[x+i][y+j] = d[x][y] + (f > 1);
					if(f > 1) dq.push_back(pii(x+i,y+j));
					else dq.push_front(pii(x+i,y+j));
				}
			}
		}
	}

	if(d[fx][fy] == inf) d[fx][fy] = -1;
	cout << d[fx][fy] << endl;
	return 0;
}


Measured memory_bytes: 19532
inputs = [int(x) for x in input().split()]
sumAns = 0

if inputs[0] > inputs[3]:
	sumAns = sumAns + inputs[3]
	inputs[3] = 0
else:
	sumAns = sumAns + inputs[0]
	inputs[3] = inputs[3] - inputs[0]

if inputs[1] > inputs[3]:
	inputs[3] = 0
else:
	inputs[3] = inputs[3] - inputs[1]

if inputs[2] > inputs[3]:
	sumAns = sumAns - inputs[3]
	inputs[3] = 0
else:
	sumAns = sumAns - inputs[3]
	inputs[3] = inputs[3] - inputs[2]

print(sumAns)

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

a=n//3
b=n//5
c=n//15

suma=(0+a*3)*(a+1)//2
sumb=(0+b*5)*(b+1)//2
sumc=(0+c*15)*(c+1)//2

print((n+1)*n//2-suma-sumb+sumc)

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

using ll = long long;
const long long MOD = 1e9+7;

using ld = long double;
using P = std::complex<ld>;

double eps = 0.0000001;

ld cross(const P &a, const P &b) { return a.real() * b.imag() - a.imag() * b.real(); }

template <class iter>
std::pair<P, ld> min_ball(iter left, iter right, int seed = 1333) {
    const int n = right - left;

    assert(n >= 1);
    if (n == 1) {
        return {*left, ld(0)};
    }

    std::mt19937 mt(seed);
    std::shuffle(left, right, mt);
    // std::random_shuffle(left, right); // simple but deprecated

    iter ps = left;
    using circle = std::pair<P, ld>;

    auto make_circle_3 = [](const P &a, const P &b, const P &c) -> circle {
        ld A = std::norm(b - c), B = std::norm(c - a), C = std::norm(a - b),
           S = cross(b - a, c - a);
        P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
        ld r2 = std::norm(p - a);
        return {p, r2};
    };

    auto make_circle_2 = [](const P &a, const P &b) -> circle {
        P c = (a + b) / (ld)2;
        ld r2 = std::norm(a - c);
        return {c, r2};
    };

    auto in_circle = [](const P &a, const circle &c) -> bool {
        return std::norm(a - c.first) <= c.second + eps;
    };

    circle c = make_circle_2(ps[0], ps[1]);

    // MiniDisc
    for (int i = 2; i < n; ++i) {
        if (!in_circle(ps[i], c)) {
            // MiniDiscWithPoint
            c = make_circle_2(ps[0], ps[i]);
            for (int j = 1; j < i; ++j) {
                if (!in_circle(ps[j], c)) {
                    // MiniDiscWith2Points
                    c = make_circle_2(ps[i], ps[j]);
                    for (int k = 0; k < j; ++k) {
                        if (!in_circle(ps[k], c)) {
                            c = make_circle_3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}

int main() {
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x.at(i) >> y.at(i);
    }

    vector<P> ps(n);
    for (int i = 0; i < n; i++) {
        ps.at(i) = complex<ld>(x.at(i), y.at(i));
    }
    double ans = sqrt(min_ball(ps.begin(), ps.end()).second);
    printf("%.10lf\n", ans);
}   

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

int selectionSort (int A[],int N){
  int sw = 0;
  for (int i = 0; i < N - 1; i++){
    int minj = i;
    for (int j = i; j < N; j++){
      if (A[j] < A[minj]){
        minj = j;
      }  
    }
      swap(A[minj], A[i]);
      if(i != minj) sw++;
  }
  return sw;
}

int main(){
  int N,A[110],sw;
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }

  sw = selectionSort(A,N);
  for (int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;
}



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

#define int long long int
#define double long double
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define endl "\n"

bool vis[10];

int32_t main()
{
	IOS;
	int n, k, dig	;
	cin >> n >> k;
	for (int i = 1; i <= k; i++)
	{
		cin >> dig;
		vis[dig] = 1;
	}

	int ans;
	for (ans = n;; ans++)
	{
		int cur = ans;
		while (cur > 0)
		{
			if (vis[cur % 10])
				break;
			cur /= 10;
		}
		if (cur == 0)
			break;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll a,b,k;
    cin >> a>>b>>k;
    if(k>=a+b){
        a=0;
        b=0;
    }
    else if(k>=a){
        ll am=k-a;
        a=0;
        b-=am;
    }
    else{
        a-=k;
    }
    cout << a << " " << b << endl;
    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  stack<char> st;
  for (ll i = 0; i < x.size(); ++i) {
    if (!st.empty() && st.top() == 'S' && x[i] == 'T') {
      st.pop();
      continue;
    }
    st.push(x[i]);
  }

  cout << st.size() << endl;

  return 0;
}


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    ll a,b;
    Scll2(a,b);
    a--;
    ll d[123] = {};
    ll i = 0;
    ll t = 1;
    for( i = 0; t <= b; i++ ){
        d[i] += (b+1)/t/2*t;
        d[i] += max( 0LL, (b+1-(b+1)/t/2*t*2)-t);
        t <<= 1;
    }
    for( i = 0, t = 1; t <= a; i++ ){
        d[i] -= (a+1)/t/2*t;
        d[i] -= max( 0LL, (a+1-(a+1)/t/2*t*2)-t);
        t <<= 1;
    }
    ll ans = 0;
    for( i = 0; i < 100; i++ ){
        ans += (d[i]%2) * (1LL<<i);
    }
    printf ("%llu\n", ans);

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <limits>

using namespace std;
inline void amin(long long  &x,long long  y)
{
    if ( y < x ) {
        x   =   y;
    }
}

int main()
{
    int N;//,a;
    long long sum[200001];
    sum[0] = 0;
    long long min_num = 2 * 10000000000;//pow(10, 9.0);

    cin >> N;

    for (int i = 1; i <= N; i++) {
        //cin >> a;
        cin >> sum[i];
        sum[i] += sum[i - 1];// + a;
    }
    
    for ( int i = 1; i < N; i++) {
        //min_num = min(min_num, abs(sum[N] - (2 * sum[i])));
        amin(min_num, abs(sum[N] - (2 * sum[i])));
    }
    cout << min_num << '\n';

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }

void _main() {
  int N;
  cin >> N;
  set<int> ok;
  map<int, int> a;

  int ans = 0;
  rep(i, 0, N) {
    int t;
    cin >> t;
    if(ok.count(t)) ans++;
    else if (a[t] == t-1) {
      ok.insert(t);
      a.erase(t);
    }
    else a[t]++;
  }

  fore(x, a) ans += x.second;

  cout << ans << endl;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 101001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
//int A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．

// Main program
void solve(){
  ll N;
  string S;
  cin >> N ;
  cin >> S ;
  ll sum =0;
  
  for(int i=0;i<N-2;i++){
    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C'){
      sum++;    
    }
  }
  cout << sum;
  
  return;

}

int main() {
    solve();
    return 0;
}






Measured memory_bytes: 256
a = [s for s in input().split()]

b = []
for i in range(len(a)):
    b.append(list(a[i]))
    
for i in range(len(b)):
    for j in range(len(b[i])):
        if b[i][j].isupper() == True:
            b[i][j] = b[i][j].lower()
        elif b[i][j].islower() == True:
            b[i][j] = b[i][j].upper()
    b[i] = "".join(b[i])
b = " ".join(b)
print(b)


Measured memory_bytes: 5568
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
#define MOD (int)(1E9 + 7)
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    for (int i = 0; i < n; i++)
        if (i + 2 < n && s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            res++;
    cout << res << endl;
    GAME_OVER;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

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

int main() {
	

	int m, n;
	map<string, int>a;
	int g = 0;
	vector<string>q;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string p;
		cin >> p;
		q.push_back(p);
		a[p]++;
		
	}
	cin >> n;

	for (int i = 0; i < n; i++) {
		string p;
		cin >> p;
		q.push_back(p);
		a[p]--;

	}
	for (int i = 0; i < q.size(); i++) {
		g = max(a[q[i]], g);
	}
	cout << g << endl;

	return 0;
}

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

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

    cout << ((n % 10 == 9 || n / 10 == 9) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	H, W, K := sc.nextInt(), sc.nextInt(), sc.nextInt()
	S := make([]string, H)
	for i := 0; i < H; i++ {
		S[i] = sc.nextStr()
	}
	ans := INF
	for bit := 0; bit < 1<<uint(H-1); bit++ {
		borders := make([]bool, H-1)
		count := 0
		for i := 0; i < H-1; i++ {
			if 1<<uint(i)&bit > 0 {
				borders[i] = true
				count++
			}
		}
		// 横線で区切られたブロックごとの累積和
		Sum := make([][]int, count+1)
		for i := 0; i < count+1; i++ {
			Sum[i] = make([]int, W+1)
		}
		for i := 0; i < W; i++ {
			block := 0
			for j := 0; j < H; j++ {
				if S[j][i] == '1' {
					Sum[block][i+1]++
				}
				if j < H-1 && borders[j] {
					block++
				}
			}
		}
		for i := 0; i < count+1; i++ {
			for j := 0; j < W; j++ {
				Sum[i][j+1] += Sum[i][j]
			}
		}
		// 1列でKを超えるブロックが存在しないか
		ok := true
		left := 0
		right := 0
		total := count
		for ; right < W; right++ {
			for j := 0; j < count+1; j++ {
				if Sum[j][right+1]-Sum[j][right] > K {
					ok = false
					break
				}
				if Sum[j][right+1]-Sum[j][left] > K {
					left = right
					total++
				}
			}
			if !ok {
				break
			}
		}
		if ok {
			ans = min(ans, total)
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 6656
from sys import stdin


def modpow(a, n, mod):
    """ 二分累乗法
    """
    n_bin = bin(n)
    res = 1
    for i in range(len(n_bin)):
        res = res**2 % mod
        if n_bin[i] == '1':
            res = (res * a) % mod
    return res


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    MOD = 10**9 + 7
    ans =  modpow(10, N, MOD)      # 全事象
    ans -=  modpow(9, N, MOD) * 2  # 0の出ない確率+9の出ない確率
    ans +=  modpow(8, N, MOD)      # 0かつ9の出ない確率
    ans %= MOD
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){

  vector<long long int> a(3, 0);
  int k;
  cin >> a[0] >> a[1] >> a[2];
  cin >> k;

  sort(a.begin(), a.end());
  for(int i=0; i<k; i++){
    a[2] *= 2;
  }

  long long int sum = a[0] + a[1] + a[2];
  cout << sum << endl;


  return 0;
}





//


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

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

	int A,B;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	vector<int> given;
	string S,T,U;

	cin >> S >> T;
	cin >> A >> B;
	cin >> U;

	if(U==S) A--;
	if(U==T) B--;

	cout << A << " " << B << endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;
typedef long long ll;

int myFactorial(int n){
	int result = 1;
	for(int i = 0; i < n; i++){
		result *= i + 1;
	}
	
	return result;
}

int main()
{
	int N;
	char s[50][256];
	int t[50];
	char X[256];
	
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%s %d", s[i], &t[i]);
	}
	scanf("%s", X);
	
	int time = 0;
	for(int i = 0; i < N; i++){
		time += t[i];
	}
	for(int i = 0; i < N; i++){
		time -= t[i];
		if(strcmp(s[i], X) == 0){
			break;
		}
	}
	
	printf("%d\n", time);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
template<class T>inline int cmp(vector<T>&v,T &a){
	return lower_bound(all(v),a)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,A[200005];
int mx1,mx2;
signed main(){
	cin>>N;
	rep(i,N){
		cin>>A[i];
		if(!chmax(mx1,A[i]))chmax(mx2,A[i]);
	}
	rep(i,N){
		cout<<(A[i]==mx1?mx2:mx1)<<"\n";
	}
}


Measured memory_bytes: 5072
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

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

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

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll X;
    cin>>X;
    cout<<ceil((sqrt(1+8*X)-1)/2)<<endl;
    
    return 0;
}


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

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int ar[][] = new int[n][3];
        for(int i = 0; i<n;i++){
            ar[i][0] = sc.nextInt();
            ar[i][1] = sc.nextInt();
            ar[i][2] = sc.nextInt();
        }
        for(int i =1; i<n;i++){
            ar[i][0]+= Math.max(ar[i-1][1],ar[i-1][2]);
            ar[i][1] += Math.max(ar[i - 1][0], ar[i - 1][2]);
            ar[i][2] += Math.max(ar[i - 1][1], ar[i - 1][0]);
        }
        int c = Math.max(ar[n-1][1],ar[n-1][2]);
        System.out.println(Math.max(ar[n-1][0],c));
    }

    static final Random random = new Random();

    static void sort(int[] a) {
        int n = a.length;
        for (int i = 0; i < n; i++) {
            int val = random.nextInt(n);
            int cur = a[i];
            a[i] = a[val];
            a[val] = cur;
        }
        Arrays.sort(a);
    }

    static void sortl(long[] a) {
        int n = a.length;
        for (int i = 0; i < n; i++) {
            int val = random.nextInt(n);
            long cur = a[i];
            a[i] = a[val];
            a[val] = cur;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}


Measured memory_bytes: 57616
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

class C{
  public:
    int len;
    map<int, int> v;
    C(){}
    C(int _len){ len = _len; }
};

string str;
map<char, C> m;

void def(int l, int r){
  char c = str[l];
  int n = atoi(str.substr(l + 2, r - 2).c_str());
  m[c] = C(n);
}

int getter(int l, int r, char c, int d){
  if(str[r - 1] != ']'){
    int n = atoi(str.substr(l, r - l).c_str());
    if(c == '!') return n;
    if(m.find(c) == m.end() || n >= m[c].len || m[c].v.find(n) == m[c].v.end()) return -1;
    return m[c].v[n];
  }
  int res = getter(l + 2, r - 1, str[l], d + 1);
  if(d == 0) return res;
  if(res == -1 || m.find(c) == m.end() || res >= m[c].len) return -1;
  return m[c].v[res];
}

int setter(int l, int r, int num, int d){
  if(str[r - 1] != ']') return atoi(str.substr(l, r - l).c_str());
  int res = setter(l + 2, r - 1, num, d + 1);
  char c = str[l];
  if(res == -1 || m.find(c) == m.end() || res >= m[c].len) return -1;
  if(d == 0) m[c].v[res] = num;
  return m[c].v[res];
}

bool solve(){
  int res = 1;
  bool f = false;
  REP(i, str.length()){
    if(str[i] == '='){
      int g = getter(i + 1, (int)str.length(), (isdigit(str[i + 1]) ? '!' : str[i + 1]), 0);
      if(g == -1) return false;
      int s = setter(0, i, g, 0);
      if(s == -1) return false;
      return true;
    }
  }
  def(0, (int)str.length());
  return true;
}

int main() {
  int ans = 0, f = 0;
  while(cin >> str){
    if(ans == 0 && str == ".") break;
    ++ans;
    if(str == ".") { cout <<f <<endl; ans = 0; f = 0; m.clear(); continue; }
    if(f == 0 && !solve()) f = ans;
  }
  return 0;
}

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

int gcd(int a,int b){
   if(b==0)return a;
   else return gcd(b,a%b);
}

int main(){
   int N;
   cin >> N;
   int A[N];
   for(int i=0;i<N;i++)cin>>A[i];
   int ans = A[0];
   for(int i=1;i<N;i++){
      ans = gcd(ans,A[i]);
   }
   cout << ans << endl;
   
   return 0;
}

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

int main()
{
	int cnt(0),min(10),tmp;
	for(int i(0);i<5;++i){
		cin >> tmp;
		while(tmp >= 10){
			cnt++;
			tmp -= 10;
		}
		if(tmp > 0){
			cnt++;
			if(tmp < min && tmp > 0) min = tmp;
		}
	}
	cnt--;
	cout << cnt * 10 + min << endl;
	return 0;
}


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

using namespace std;

#define ll long long

signed main() {
	int t1, t2, r1, r2;
	cin >> t1 >> t2 >> r1 >> r2;

	if (r1 != -1 && r2 != -1) {
		if (r1 > r2) {
			cout << "Alice" << endl;
		}
		else if (r2 > r1) {
			cout << "Bob" << endl;
		}
		else {
			cout << "Draw" << endl;
		}
	}
	else {
		if (t1 < t2) {
			cout << "Alice" << endl;
		}
		else if (t2 < t1) {
			cout << "Bob" << endl;
		}
		else {
			cout << "Draw" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3120
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
int main()
{
    ll n;
    scanf("%lld",&n);
    n--;
    printf("%lld",(1+n)*n/2);
}


Measured memory_bytes: 128
#!/usr/bin/perl
use Data::Dumper;
my ($n,$m) = map { $_ - 0 } split(/\s+/,<STDIN>);

my %f = ();

my $mm = $m;
while($mm>1){
  my $r = &fact($mm);
  $f{$r->[0]}++;
  $mm = $r->[1];
}

my @kf = map { $_ - 0 } sort { $a <=> $b } keys %f;

#print Dumper(%f,@kf);

my $lv = 0;
my $seed = 1;
my $mx = 1;
&foo($lv,$seed);

print "$mx\n";

exit(0);

sub foo {
  my $lv = shift;
  my $seed = shift;
  if( $lv > $#kf ){
    $mx = $seed if $seed > $mx and $m / $seed >= $n;
    return;
  }
  for(my $i=0;$i<=$f{$kf[$lv]};$i++){
    &foo($lv+1,$seed * ($kf[$lv] ** $i));
  }
}

sub fact {
  my $f = shift;
  return +[$f,1] if $f <= 3 or $f == 5 or $f == 7;
  return +[2,2] if $f == 4;
  return +[3,2] if $f == 6;
  return +[2,4] if $f == 8;
  return +[3,3] if $f == 9;
  my $m = int(sqrt($f)+0.01);
  my @chk = (); $#chk = ($m+1);
  for(my $i=2;$i<=$m;$i++){
    next if $chk[$i];
    return +[$i,$f/$i] if $f % $i == 0;
    my $j = 2;
    while($j*$i<=$#chk){
      $chk[$j*$i] = 1;
      $j++;
    }
  }
  return +[$f,1];
}



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

int main() {
    int h, w;
    cin >> h >> w;
    char a[100][100];
    rep(i, h) rep(ii, w) cin >> a[i][ii];
    rep(i, w+2) cout << "#";
    cout << endl;
    rep(i, h) {
        cout << "#";
        rep(ii, w) {
            cout << a[i][ii];
        }
        cout << "#" << endl;
    }
    rep(i, w+2) cout << "#";
    cout << endl;
    return 0;
}

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

int main() {
    ll t;
    std::cin >> t;
    
    for (int ttt = 0;ttt < t; ttt++) {
        ll n,a,b,c,d;
        std::cin >> n>>a>>b>>c>>d;
        map<ll,ll> memo = {};
        function<ll(ll)> rec = [&] (ll x) {
            if(x==0) return 0ll;
            if(x==1) return d;
            if(x==2) return min({d*2,a+d});

            if(memo[x]!=0) return memo[x];
            if(x<=9e9){
                return memo[x] = min({
                    x*d,
                    (x%2)*d+rec(x/2)+a,
                    (2-(x%2))*d+rec(x/2+1)+a,
                    (x%3)*d+rec(x/3)+b,
                    (3-(x%3))*d+rec(x/3+1)+b,
                    (x%5)*d+rec(x/5)+c,
                    (5-(x%5))*d+rec(x/5+1)+c
                });
            }else{
                return memo[x] = min({
                    (x%2)*d+rec(x/2)+a,
                    (2-(x%2))*d+rec(x/2+1)+a,
                    (x%3)*d+rec(x/3)+b,
                    (3-(x%3))*d+rec(x/3+1)+b,
                    (x%5)*d+rec(x/5)+c,
                    (5-(x%5))*d+rec(x/5+1)+c
                });
            }
        };
        std::cout << rec(n) << std::endl;
    }
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,cnt=1,sum=0;
  cin >> n;
  long long a[n],ans=n;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  for(int i=0;i<n-1;i++){
    sum+=a[i];
    if(a[i+1]/sum<2 or (a[i+1]/sum==2 and a[i+1]%sum==0)){
      cnt++;
    }else{
      ans-=cnt;
      cnt=1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
    int i,N;
    string city;
    int point;
    cin >> N;
    pair<pair<string,int>,int> p[N];
    for(i=0;i<N;i++){
        cin >> city >> point;
        p[i] = make_pair(make_pair(city,-1*point),i);
    }
    sort(p,p+N);
    
    for(i=0;i<N;i++){
        cout << p[i].second + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3576