akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns     #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiWayIf       #-}
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State
import           Control.Monad.Trans.State
import           Data.Array.IArray
import           Data.Array.ST
import           Data.Array.Unboxed        (UArray)
import qualified Data.Array.Unboxed        as U
import           Data.Bits
import           Data.ByteString.Char8     (ByteString)
import qualified Data.ByteString.Char8     as BS
import           Data.Char
import           Data.Graph
import           Data.Int                  (Int64)
import           Data.List
import           Data.Maybe
import           Data.Proxy
import           Data.Sequence             (Seq, (<|), (><), (|>))
import qualified Data.Sequence             as Seq
import qualified Data.Set                  as S
import           Data.STRef
import qualified Data.Vector               as V
import qualified Data.Vector.Unboxed       as VU
import           Numeric

main :: IO ()
main = do
  n <- readLn
  avec <- readLnAsUVecNWith n unconsInt
  print $ fst $ foldl (solve (n-1) avec) (1000,0) [0..n-1]

solve :: Int -> VU.Vector Int -> (Int,Int) -> Int -> (Int,Int)
solve _ vec (m, s) 0 = if vec VU.! 0 < vec VU.! 1
                       then (m `mod` (vec VU.! 0), s + m `div` (vec VU.! 0))
                       else (m, s)
solve n vec (m, s) i
  | n == i = (m + s * (vec VU.! i), 0)
  | otherwise = if
      | vec VU.! (i-1) <= vec VU.! i && vec VU.! i > vec VU.! (i+1) -> (m + s * (vec VU.! i), 0)
      | vec VU.! (i-1) >= vec VU.! i && vec VU.! i < vec VU.! (i+1) -> (m `mod` (vec VU.! i), s + (m `div` (vec VU.! i)))
      | otherwise -> (m, s)


-- converter
unconsChar :: StateT BS.ByteString Maybe Char
unconsChar = StateT BS.uncons

unconsInt :: StateT BS.ByteString Maybe Int
unconsInt = StateT $ BS.readInt . BS.dropWhile isSpace

unconsInteger :: StateT BS.ByteString Maybe Integer
unconsInteger = StateT $ BS.readInteger . BS.dropWhile isSpace

-- for list
readLnAsListWith :: StateT BS.ByteString Maybe a -> IO [a]
readLnAsListWith st = unfoldr (runStateT st) <$> BS.getLine

-- for unboxed vector
readLnAsUVecNWith :: VU.Unbox a => Int -> StateT BS.ByteString Maybe a -> IO (VU.Vector a)
readLnAsUVecNWith !n !st = VU.unfoldrN n (runStateT st) <$> BS.getLine

-- for boxed vector
readLnAsVecNWith :: Int -> StateT BS.ByteString Maybe a -> IO (V.Vector a)
readLnAsVecNWith !n !st = V.unfoldrN n (runStateT st) <$> BS.getLine

getAsString :: IO [String]
getAsString = map BS.unpack . BS.words <$> BS.getLine

getAsCharArray1DWithLength :: IO (Int, UArray Int Char)
getAsCharArray1DWithLength = BS.getLine >>= \ !cs ->
  let !n = BS.length cs
      !ary = (U.listArray (1,n) $ unfoldr BS.uncons cs) :: UArray Int Char
  in return (n, ary)

-- n: number of lines
-- m: number of chars per a line
getAsCharArray2D :: Int -> Int -> IO (UArray (Int,Int) Char)
getAsCharArray2D !n !m = U.listArray ((1,1),(n,m)) . unfoldr BS.uncons . BS.concat <$> replicateM n BS.getLine


Measured memory_bytes: 4148
n, k = map(int,input().split())
d = list(map(str,input().split()))

ans=0
# ans を用意する
for i in range (n,100000):
  s= str(i)
  #文字列にする
  pay=True
  #フラグ
  for j in range (len(s)):
    
    if s[j] in d:
      pay = False
      break
    #各桁がd にあるか調べて、あったら break
    
  if pay:
      ans = i
      break
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    string s,t;
    for(int i=0;i<b;i++) s+='0'+a;
    for(int i=0;i<a;i++) t+='0'+b;
    cout << min(s,t) << endl;
}

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

int h, w;
int c[10][10];
int a[200][200];

int main() {
	int i, j, k;
	
	cin >> h >> w;
	for (i = 0; i < 10; i++) for (j = 0; j < 10; j++) cin >> c[i][j];
	for (i = 0; i < h; i++) for (j = 0; j < w; j++) cin >> a[i][j];
	
	for (k = 0; k < 10; k++)
		for (i = 0; i < 10; i++)
			for (j = 0; j < 10; j++)
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
	
	int ans = 0;
	for (i = 0; i < h; i++) for (j = 0; j < w; j++) if (a[i][j] >= 0) ans += c[a[i][j]][1];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main(){
    long long int x, a, b;
    cin >> x >> a >> b;
    if(b<=a){
        cout << "delicious" << endl;
    }
    else{
        if(b-a<=x){
            cout << "safe" << endl;
        }
        else{
            cout << "dangerous" << endl;
        }
    }
}

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

typedef pair<int, pair<int, int> > Ep;

const int MAX_N = 20001;
int N, M;
vector<Ep> E;
bool vis[MAX_N];

int main() {
  while(cin >> N >> M && (N || M)) {
    E.clear();
    for(int i = 0; i < M; ++i) {
      Ep e;
      cin >> e.first >> e.second.first >> e.second.second;
      --e.second.first; --e.second.second;
      E.push_back(e);
    }

    sort(E.begin(), E.end());
    fill(vis, vis+N, false);
    vis[0] = true;
    int ans = 1;
    for(int i = 0; i < E.size(); ++i) {
      pair<int, int> &p = E[i].second;
      if(vis[p.first] && !vis[p.second]) {
	vis[p.second] = true;
	++ans;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1296
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,m,k;

signed main(){
	
	int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cin>>k;
	cout<<a[k-1]<<endl;;
}


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

def prime_factorize( n ):
    a = {}
    while n % 2 == 0:
        try:
            a[ 2 ] += 1
        except KeyError:
            a[ 2 ] = 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            try:
                a[ f ] += 1
            except KeyError:
                a[ f ] = 1
            n //= f
        else:
            f += 2
    if n != 1:
        try:
            a[ n ] += 1
        except KeyError:
            a[ n ] = 1
    return a

a = prime_factorize( n )
ans = 0
for p in a.keys():
    ans += int( ( -1 + math.sqrt( 1 + 8 * a[ p ] ) ) / 2 )

print( ans )

Measured memory_bytes: 9232
N = int(input())
T, A = map(int, input().split())
T, A = T * 1000, A * 1000
rec = float("inf")
H = list(map(int, input().split()))
ans = -1
for i in range(N):
    t = T - H[i] * 6
    if rec > abs(A - t):
        ans = i + 1
        rec = abs(A - t)

print(ans)

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

vector<pair<long, int>> primeFactorize(long n) {
    vector<pair<long, int>> primes;
    for (long p = 2; p * p <= n; p++) {
        if (n % p != 0) continue;

        int e = 0;
        while (n % p == 0) {
            n /= p;
            e++;
        }
        primes.push_back(make_pair(p, e));
    }

    if (n != 1) primes.push_back(make_pair(n, 1));
    return primes;
}

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

    int count = 0;
    vector<pair<long, int>> primes(primeFactorize(n));
    for (const pair<long, int>& prime: primes) {
        long p = prime.first;
        int e = prime.second;
        for (int i = 1; i <= e; i++) {
            e -= i;
            count += 1;
        }
    }
    cout << count;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=1001001001;
 

 
int main() {
    int n,m;
    cin>>n>>m;
    vector<int> h(n),ma(n,0);
    rep(i,n) cin>>h[i];
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        ma[a]=max(ma[a],h[b]);
        ma[b]=max(ma[b],h[a]);
    }
    int ans=0;
    rep(i,n){
        if(h[i]>ma[i]) ans++;
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3980
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *A = map(int, read().split())

    A.sort(reverse=True)

    counter = [0] * (A[0] + 1)
    for a in A:
        counter[a] += 1

    for i in range(A[0] - 1, -1, -1):
        counter[i] += counter[i + 1]

    def is_ok(x):
        c = 0
        for a in A:
            if x - a <= A[0]:
                c += counter[max(x - a, 0)]
            pass

        return c <= M

    ok = 2 * A[0] + 1
    ng = 2 * A[-1] - 1
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid

    x = ok

    ans = 0
    csum = [0]
    csum.extend(accumulate(A))
    for a in A:
        if x - a <= A[0]:
            c = counter[max(x - a, 0)]
            ans += a * c + csum[c]
            M -= c

    ans += (x - 1) * M

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 95232
#include <iostream>

using namespace std;

int main() {
  int n,d;
  cin >> n>>d;
  if ((n/(d*2+1))*(d*2+1) == n){
    cout << n/(d*2+1) << endl;
  }else{
    cout << n/(d*2+1)+1 << endl;
  }
}


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

struct Data {
  int p, id;
  Data(int p, int id) : p(p), id(id){}
  bool operator< (const Data& d) const {
    return p > d.p;
  } 
};

int main() {
    int N;
    cin >> N;
    int l = N * (N - 1) / 2;
    int A[l], B[l], C[l], D[l];
    for (int i = 0; i < l; i++) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
        A[i]--;
        B[i]--;
    }
    vector<Data> d;
    for (int i = 0; i < N; i++) {
        d.push_back(Data(0, i));
    }    
    for (int i = 0; i < l; i++) {
        if (C[i] == D[i]) {
            d[A[i]].p += 1;
            d[B[i]].p += 1;
        } else if (C[i] > D[i]) {
            d[A[i]].p += 3;
        } else {
            d[B[i]].p += 3;
        }
    }
    sort(d.begin(), d.end());
    int rank[N];
    int k = 1;
    rank[d[0].id] = 1;
    for (int i = 1; i < N; i++) {
        if (d[i].p == d[i - 1].p) {
            rank[d[i].id] = rank[d[i - 1].id];
            k++;
        } else {
            rank[d[i].id] = rank[d[i - 1].id] + k;
            k = 1;
        }
    }
    for (int i : rank) {
        cout << i << "\n";
    }
    return 0;
}


Measured memory_bytes: 3212
X = int(input())
if X%7==2 :
  print('sat')
elif X%7==3 :
  print('sun')
elif X%7==4 :
  print('mon')
elif X%7==5 :
  print('tue')
elif X%7==6 :
  print('wed')
elif X%7==0 :
  print('thu')
elif X%7==1 :
  print('fri')
  


Measured memory_bytes: 5592
pragma(inline, true)
void chmin(T)(ref T a, T b) {
    if (a > b) a = b;
}

int[] init() {
    enum INF = 1 << 28;
    int[] dp = new int[100010];
    foreach (i; 1..100001) {
        dp[i] = INF;
        int p6 = 1, p9 = 1;
        while (p6 <= i || p9 <= i) {
            if (i - p6 >= 0)
                chmin(dp[i], dp[i - p6] + 1);
            if (i - p9 >= 0)
                chmin(dp[i], dp[i - p9] + 1);
            p6 *= 6; p9 *= 9;
        }
    }
    return dp;
}

void main() {
    import std.conv : to;
    import std.stdio : readln, writeln;
    import std.string : chomp;
    int[] dp = init();
    writeln(dp[readln.chomp.to!int]);
}

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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  set<int> st;
  st.insert(a);
  st.insert(b);
  st.insert(c);
  st.insert(d);
  if(st.count(1) && st.count(9) && st.count(7) && st.count(4)) cout << "YES\n";
  else cout << "NO\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;

double g(ll x) {
    ll sum = 0;
    ll y = x;
    while (x) {
        sum += (x%10);
        x /= 10;
    }
    return (double)y/sum;
}

ll f(ll x) {
    if (x<=9) return x;
    ll res = INF;
    double v = 1.0E+18;
    ll ten = 10LL;
    rep(i, 17) {
        ll y = ten*(x/ten+1LL) - 1LL;
        ten *= 10LL;
        double z = g(y);
        if (z<v) {
            v = z;
            res = y;
        }
    }
    return res;
}

int main(){
    ll k;
    cin >> k;
    ll num = 0;
    ll now = 1;
    cout << now << endl;
    k--;
    while (k--) {
        now = f(now+1);
        cout << now << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3544
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n, b, c, d, a = nm()
    g = dict()
    def calc(x):
        if x < 2:
            return a * x
        if x in g:
            return g[x]
        y1 = x // 5
        ret1 = min(a * (x % 5) + d, a * (x - y1)) + calc(y1)
        y2 = (x - 1)//5 + 1
        ret2 = min(a * (y2 * 5 - x) + d, a * (x - y2)) + calc(y2)
        y3 = x // 3
        ret3 = min(a * (x % 3) + c, a * (x - y3)) + calc(y3)
        y4 = (x - 1)//3 + 1
        ret4 = min(a * (y4 * 3 - x) + c, a * (x - y4)) + calc(y4)
        y5 = x // 2
        ret5 = min(a * (x % 2) + b, a * (x - y5)) + calc(y5)
        y6 = (x - 1)//2 + 1
        ret6 = min(a * (y6 * 2 - x) + b, a * (x - y6)) + calc(y6)
        g[x] = min([ret1, ret2, ret3, ret4, ret5, ret6])
        return g[x]
    print(calc(n))
    return

T = ni()
for _ in range(T):
    solve()


Measured memory_bytes: 20580
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <pair<int,int>,int> mp;
vector<int> V;
#define debug(x) cerr << #x << ": " << x << "\n";
#define INF (1<<29) //53687091
#define INFLL (1ll<<58)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int tx[9] = { 1,1,1,0,0,0,-1,-1,-1 }, ty[9] = { -1,0,1,-1,0,1,-1,0,1 };
ll H,W,a[MAX+2],b[MAX+2],cunt[10];
int N;
vector<P>  square;

void solve(){
    for(int i=0;i<N;i++){
        for(int j=0;j<9;j++){
            int x,y;
            x=a[i]+tx[j];
            y=b[i]+ty[j];
            if(x<=0 || x >=H-1 || y <=0 || y >= W-1) continue;
            
            mp[P(x,y)]++;
        }
    }
    for(auto p:mp) cunt[p.second]++;
    
    cout<< (H-2)*(W-2)*1ll-mp.size() <<"\n";
    for(int i=1;i<10;i++) cout<<cunt[i]<<"\n";
}

int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    cin >> H >> W >> N;
    for(int i=0;i<N;i++) {cin >> a[i] >>b[i]; a[i]--; b[i]--;}
    solve();
    
    return 0;
}


Measured memory_bytes: 58112
#include <iostream>
#include <ios>
#include <set>
using namespace std;
int main(void) {
    ios::sync_with_stdio(false);

    set<string> registered;
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        string ID;
        cin >> ID;
        registered.insert(ID);
    }
    cin >> n;
    bool isLocked = true;
    for(int i = 0; i < n; ++i) {
        string ID;
        cin >> ID;
        if(registered.find(ID) != registered.end()) {
            if(isLocked) {
                cout << "Opened by " << ID << endl;
                isLocked = false;
            } else {
                cout << "Closed by " << ID << endl;
                isLocked = true;
            }
        } else {
            cout << "Unknown " << ID << endl;
        }
    }
    return 0;
}

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

using namespace std;

typedef pair<int, int>  P;
const int SIZE = 201;
const int init_x = 100, init_y = 100;
const int dx[6] = {0, 0, 1, 0, -1, 0};
const int dy[6] = {0, -1, 0, 1, 0, 0};
const int tf[6][6] = {{0, 4, 2, 5, 3, 0},
                      {3, 0, 6, 1, 0, 4},
                      {5, 1, 0, 0, 6, 2},
                      {2, 6, 0, 0, 1, 5},
                      {4, 0, 1, 6, 0, 3},
                      {0, 3, 5, 2, 4, 0}};

void Rotate(int dir, vector<int> &deme)
{
    vector<int> tmp = deme;
    if (dir == 1) {
        deme[1] = tmp[0];
        deme[5] = tmp[1];
        deme[3] = tmp[5];
        deme[0] = tmp[3];
    }
    else if (dir == 2) {
        deme[2] = tmp[0];
        deme[5] = tmp[2];
        deme[4] = tmp[5];
        deme[0] = tmp[4];
    }
    else if (dir == 3) {
        deme[3] = tmp[0];
        deme[5] = tmp[3];
        deme[1] = tmp[5];
        deme[0] = tmp[1];
    }
    else if (dir == 4) {
        deme[4] = tmp[0];
        deme[5] = tmp[4];
        deme[2] = tmp[5];
        deme[0] = tmp[2];
    }
}

void Change(int t, int f, vector<vector<P>> &b)
{
    int y = init_y, x = init_x;
    vector<int> deme = {t, abs(7 - f), abs(7 - tf[t - 1][f - 1]), f, tf[t - 1][f - 1], abs(7 - t)};

    bool change = true;
    while (change) {
        change = false;
        for (int d = 6; !change && 4 <= d; --d) {
            int idx = 0;
            while (idx < 6 && deme[idx] != d)
                ++idx;

            if (idx == 0 || idx == 5)
                continue;

            int nx = x + dx[idx], ny = y + dy[idx];
            if (b[ny][nx].first < b[y][x].first) {
                // ??¢??????
                x = nx;
                y = ny;
                Rotate(idx, deme);
                change = true;
                break;
            }
        }
        if (!change) {
            ++b[y][x].first;
            b[y][x].second = deme[0];
        }
    }
}

void Debug(const vector<vector<P>> &b)
{
    const int d = 3;
    for (int y = init_y - d; y <= init_y + d; ++y) {
        for (int x = init_x - d; x <= init_x + d; ++x)
            cout << "(" << b[y][x].first << ", " << b[y][x].second << ") ";
        cout << endl;
    }
    cout << endl;
}

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

    int n, t, f;

    while (cin >> n, n) {
        // (??????????????¢?????°???)
        vector<vector<P>> b(SIZE, vector<P>(SIZE, P(0, 0)));

//        Debug(b);
        while (n--) {
            cin >> t >> f;
            Change(t, f, b);
//            Debug(b);
        }

        vector<int> counts(7, 0);
        for (int y = 0; y < SIZE; ++y)
            for (int x = 0; x < SIZE; ++x)
                ++counts[b[y][x].second];

        for (int i = 1; i <= 6; ++i)
            cout << counts[i] << (i == 6 ? '\n' : ' ');
    }

    return 0;
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  string str;
  cin >> str;
  
   transform(str.begin()+K-1,str.begin()+K,str.begin()+K-1,::tolower);
  
  cout << str << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  int a,b;
  cin >> a >> b;
  cout << a*b << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  string s;
  cin >> n>> s;

  ll c=0;

  for(ll i=0;i<n-2;i++){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')c++;
  }

  cout << c << endl;

}

Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
int main() {
	int h, w,i;
	while (1) {
		scanf("%d%d", &h, &w);
		if (h + w == 0)break;
		for (; h > 0; --h) {
			for (i = 0; i < w; ++i) putchar('#');
			putchar('\n');
		}
		putchar('\n');
	}
		return 0;
}

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

int main(){
long long a, b, x;
long long kekka = 0;
  cin >> a >> b >> x;

  if((a % x) == 0){
  kekka++;
  }
  kekka += b / x - a / x;
  
  cout << kekka << endl;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;

int main()
{
	int n,a;
	cin>>n>>a;
	if(n%500<=a)cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
}

Measured memory_bytes: 256
using System;

namespace AGC020_B___Ice_Rink_Game
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }
        static string solver()
        {
            var K = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            if (A[K - 1] != 2) return "-1";

            long max = 3;
            long min = 2;
            for (int i = K - 2; i >= 0; i--)
            {
                if (A[i] > max) return "-1";
                max = max / A[i] * A[i] + A[i] - 1;
                min = ((min - 1) / A[i] + 1) * A[i];
            }
            return min < max ? $"{min} {max}" : "-1";
        }
    }
}


Measured memory_bytes: 25308
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
lli a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	cin >> a >> b >> c;
	lli tmp = min(a, c);
	a -= tmp; c -= tmp;
	tmp = min(c, b);
	b -= tmp; c -= tmp;
	cout << a << ' ' << b;
}

Measured memory_bytes: 8832
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int h[n][3];
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            cin >> h[i][j];
        }
    }
    int dp[n][3];
    dp[0][0] = h[0][0];
    dp[0][1] = h[0][1];
    dp[0][2] = h[0][2];
    for(int i = 1; i < n; i++)
    {
        dp[i][0] = max(dp[i - 1][1] + h[i][0], dp[i - 1][2] + h[i][0]);
        dp[i][1] = max(dp[i - 1][0] + h[i][1], dp[i - 1][2] + h[i][1]);
        dp[i][2] = max(dp[i - 1][0] + h[i][2], dp[i - 1][1] + h[i][2]);
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

priority_queue <int, vector<int>, greater<int>> que1;
priority_queue<int> que2;
ll max_sum[100005], min_sum[100005];
int b[100005];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		que1.push(a);
		max_sum[0] += (ll)a;
	}
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	for (int i = 1; i <= n; ++i) {
		int a = que1.top(); que1.pop();
		if (b[i - 1] > a) {
			max_sum[i] = max_sum[i - 1] - (ll)a + (ll)b[i - 1];
			que1.push(b[i - 1]);
		}
		else {
			max_sum[i] = max_sum[i - 1];
			que1.push(a);
		}
	}
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		que2.push(a);
		min_sum[n] += (ll)a;
	}
	for (int i = n - 1; i >= 0; --i) {
		int a = que2.top(); que2.pop();
		if (b[i] < a) {
			min_sum[i] = min_sum[i + 1] - (ll)a + (ll)b[i];
			que2.push(b[i]);
		}
		else {
			min_sum[i] = min_sum[i + 1];
			que2.push(a);
		}
	}
	ll ans = -1e18;
	for (int i = 0; i <= n; ++i) {
		ans = max(ans, max_sum[i] - min_sum[i]);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    string s;
    int c=0,i,j;
    bool flag = true;

    cin>>s;

    for(i=0; i<s.size(); i++)
    {
        for(j=0; j<s.size(); j++)
        {
            if(s[i]==s[j])
            {
                c++;
            }
        }
        if(c%2!=0)
        {
            flag = false;
            break;
        }
        c = 0;
    }

    if(flag)
    {
        cout<<"Yes"<<endl;
    }

    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<map>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    map<string,int> m;
    int n;
    scanf("%d",&n);
    string s;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        if(m[s]==0)
        {
            m[s]++;
            sum++;
        }
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 19300
#include<bits/stdc++.h>
using namespace std;
#define max1 100005
#define siz 1000005
#define mod 998244353
#define inf 1e18
#define ll long long int
#define debug(x) cout<<#x<<" "<<x<<endl
#define jam(x) cout<<"Case #"<<x<<": "
#define hackercup(x) cout<<"Case #"<<x<<": "
ll tt;
#define run_time cout << "\nTIME = " << clock() - tt << endl; tt = clock();
typedef pair<ll,ll> pr;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  tt = clock();
  #endif*/
  ll n;
  cin >> n;
  ll x = 7;
  map<ll,ll> mp;
  bool check = true;
  ll s = 1;
  while(x > 0)
  {
    if(mp.find(x) != mp.end())
    {
      check = false;
      break;
    }
    mp[x]++;
    while(x < n)
    {
      x = x*10 + 7;
      s++;
    }
    x = x%n;
  }
  if(check)
  {
    cout << s << endl;
  }
  else
  {
    cout << -1 << endl;
  }
} 

Measured memory_bytes: 59884
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
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; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    string S;
    cin >> S;
    ll ans = 0;
    bool all_w = true;
    rep(i, N) {
        if (S[i] == 'R') {
            all_w = false;
            break;
        }
    }
    if (all_w == true) {
        cout << 0 << endl;
        return 0;
    }

    int j = N - 1;
    rep(i, N) {
        if (i >= j) {
            cout << ans << endl;
            return 0;
        }
        if (S[i] == 'W') {
            while (1) {
                if (S[j] == 'R') {
                    ans++;
                    j--;
                    break;
                }
                if (i >= j) {
                    cout << ans << endl;
                    return 0;
                }
                j--;
            }
        }
    }

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

Measured memory_bytes: 3744
import java.util.Scanner;

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

		int st=0;
		int gl=a.length()-1;


		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='A') {
				st=i+1;
				break;
			}
		}

		for(int i=a.length()-1; i>=0; i--) {
			if(a.charAt(i)=='Z') {
				gl=i+1;
				break;
			}
		}
		System.out.println(gl-st+1);
	}
}

Measured memory_bytes: 24788
import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();

    int x = A + B;
    int y = A - B;
    int z = A * B;

    int sum = Math.max(x,y);
    sum = Math.max(sum,z);

    System.out.println(sum);

  }
}

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


int main(void){
	int n,x;
	while(cin >> n >> x, !(n == 0 && x == 0) ){
		int ct = 0;
		for(int a1 = 1; a1 < (n+1); a1++ ){
			for(int a2 = a1+1; a2 < (n+1); a2++){
				for(int a3 = a2+1; a3 < (n+1); a3++){
					if( (a1+a2+a3) == x ) ct++;
				}
			}
		}
		cout << ct << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main { //クラス名はMain
    public static void main(String[] args) {
        //コード
      boolean b1 = true;		//奇数文字、最初真にしないと1文字対応できない
      boolean b2 = true;		//偶数文字、最初真にしないと1文字対応できない
      Scanner sc = new Scanner(System.in);
	  String n = sc.next();
      int mojilen = n.length();
      String[] strArray = n.split("");
      //判定
      loop: for(int i=0;i<mojilen;i++) {
       		if (Math.abs(i+1) % 2 == 0) {
            //偶数文字
              switch (strArray[i]) {
        		case "L":
            	b2 = true;
            	break;
        		case "U":
            	b2 = true;
            	break;
       			case "D":
            	b2 = true;
            	break;
        		default:
           		b2 = false;
                break loop;
              }
        }
        else {
          	//奇数文字
                switch (strArray[i]) {
        		case "R":
            	b1 = true;
            	break;
        		case "U":
            	b1 = true;
            	break;
       			case "D":
            	b1 = true;
            	break;
        		default:
           		b1 = false;
                break loop;
        		}
       }
      }
      if (b1 == true && b2 == true){
       System.out.println("Yes");
      }
      else{
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

const int MAXA = 2e5;

int main() {
    FAST_IO();
    int N;
    ll K; cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    // next[i], cnt[i]
    vector<int> next(N), cnt(N);
    // pos[i] : array of position which number 'i' appears
    vector<vector<int>> pos(MAXA + 1);
    rep(i, N) pos[A[i]].push_back(i);
    repp(i, 1, MAXA) {
        int SZ = sz(pos[i]);
        for(int j = 0; j < SZ; ++j) {
            next[pos[i][j]] = pos[i][(j + 1)%SZ];
            if(SZ == 1) cnt[pos[i][j]] = N + 1;
            else if(j < SZ - 1) cnt[pos[i][j]] = pos[i][(j + 1)%SZ] - pos[i][j] + 1;
            else cnt[pos[i][j]] = cnt[pos[i][j]] = pos[i][(j + 1)%SZ] - pos[i][j] + 1 + N;
        }
    }
    ll period = 0;
    int start = 0;
    do {
        period += cnt[start];
        start = (next[start] + 1) % N;
    } while(start != 0);
    period /= N;
    K = (K - 1) % period + 1;
    K *= N;
    start = 0;
    while(K - cnt[start] > 0) {
        K -= cnt[start];
        start = (next[start] + 1) % N;
    }
    vector<int> ans;
    int idx = start;
    while(idx < N && idx >= start) {
        if(idx + cnt[idx] <= N) {
            idx = next[idx] + 1;
        } else {
            ans.push_back(A[idx]);
            idx = idx + 1;
        }
    }
    cout << ans;
}


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

using namespace std;

int main() {
    int X, N;
    cin >> X >> N;

    bool P[300] = {};
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        P[x] = true;
    }

    int Min = INT_MAX, MinP = INT_MAX;
    for (int i = 0; i <= 300; ++i) {
        if (P[i]) continue;
        int tmp = abs(i - X);
        if (tmp < Min) {
            Min = tmp;
            MinP = i;
        }
    }
    cout << MinP << endl;
}


Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    ADontBeLate solver = new ADontBeLate();
    solver.solve(1, in, out);
    out.close();
  }

  static class ADontBeLate {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      double d = in.nextInt(), t = in.nextInt(), s = in.nextInt();
      out.println((d / s) <= t ? "Yes" : "No");
    }

  }

  static class InputReader {

    private InputStream stream;
    private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
    private static final int EOF = -1;
    private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == EOF) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return EOF;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) {
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) {
        res *= 10;
        res += c - 48;
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
    }

  }
}



Measured memory_bytes: 32588
n = int(input())
if n < 2:
	ans = 1
else:
	a = [0] * (n+1)
	a[0] = a[1] = 1
	for i in range(2, n+1):
		a[i] = a[i-1] + a[i-2]
	ans = a[n]
print(ans)



Measured memory_bytes: 5600
#include <cstdio>
#include <vector>
int N, M, Q, u[100001], d[100001], c[100001], D[100001], I[100001];
std::vector < int > V[100001];
void DFS(int p, int d, int id)
{
	if (d <= D[p])
		return;
	D[p] = d;
	if (!I[p])
		I[p] = id;
	for (int i : V[p])
		DFS(i, d - 1, id);
}
int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1, u, v; i <= M; i++)
	{
		scanf("%d%d", &u, &v);
		V[u].push_back(v);
		V[v].push_back(u);
	}
	scanf("%d", &Q);
	for (int i = 1; i <= Q; i++)
		scanf("%d%d%d", u + i, d + i, c + i);
	for (int i = 1; i <= N; i++)
		D[i] = -1;
	for (int i = Q; i; i--)
		DFS(u[i], d[i], i);
	for (int i = 1; i <= N; i++)
		printf("%d\n", c[I[i]]);
	return 0;
}


Measured memory_bytes: 8440
n, m = list(map(int, input().split()))
ks = list([list(map(int, input().split())) for _ in range(m)])
ps = list(map(int, input().split()))

v = 0
for i in range(1 << n):
    on = True
    for k, p in zip(ks, ps):
        c = 0
        for b in k[1:]:
            if i & 1 << (b-1) > 0:
                c += 1
        if c % 2 != p:
            on = False
            break
    if on:
        v += 1

print(v)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;


int main()
{
	int A, B;
	scanf("%d%d", &A, &B);
	if(A == 1 && B == 1)
		printf("Draw");
	else if(A == 1)
		printf("Alice");
	else if(B == 1)
		printf("Bob");
	else
	{
		if(A > B)
			printf("Alice");
		else if(A < B)
			printf("Bob");
		else
			printf("Draw");
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,a,b = iim()
cap = a+b
cA = 0
cB = 0

s = input()

for i in s:
    if i == 'a':
        if cA+cB < cap:
            cA += 1
            print('Yes')
        else:
            print('No')
    elif i == 'b':
        if cA+cB < cap and cB < b:
            cB += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

  for (int i = 2; i < n; i ++) {
    if (s[i - 2] == s[i]) {
      cout << i - 1 << " " << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
#include <random>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

template <class T>
class point {
public:
    T x, y;
};

double dis(point<double> a, point<double> b) {return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));}

point<double> center(point<double> A, point<double> B, point<double> C) {
    point<double> b = {C.x - A.x, C.y - A.y}, c = {B.x - A.x, B.y - A.y};
    return {A.x + (c.y * (b.x * b.x + b.y * b.y) - b.y * (c.x * c.x + c.y * c.y)) / (b.x * c.y - c.x * b.y) / 2, A.y + (b.x * (c.x * c.x + c.y * c.y) - c.x * (b.x * b.x + b.y * b.y)) / (b.x * c.y - c.x * b.y) / 2};
}

pair<point<double>, double> mec(vector<point<double>> p) {
    shuffle(p.begin(), p.end(), mt19937(28));
    point<double> o = p[0];
    double r = 0, e = 1 + 1e-12;
    for (int i = 0; i < p.size(); i++) if (dis(o, p[i]) > r * e) {
        o = p[i], r = 0;
        for (int j = 0; j < i; j++) if (dis(o, p[j]) > r * e) {
            o = {(p[i].x + p[j].x) / 2, (p[i].y + p[j].y) / 2};
            r = dis(o, p[i]);
            for (int k = 0; k < j; k++) if (dis(o, p[k]) > r * e) {
                o = center(p[i], p[j], p[k]);
                r = dis(o, p[i]);
            }
        }
    }
    return {o, r};
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<point<double>> p(n);
    for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;
    cout << setprecision(13) << mec(p).second;
}


Measured memory_bytes: 3836
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int N;
    int D;
    
    cin >> N >> D;
    int X[N][D];
    float d[N][D];
    for (int i=0;i<N;i++){
        for (int j=0;j<D;j++){
            cin >> X[i][j];
        }
    }
    int ans=0;
    for (int i=0;i<N-1;i++){
        for (int j=i;j<N;j++){
            int sum=0;
            if (i!=j){
                for (int k=0;k<D;k++){
                    sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
                }
                d[i][j] = sqrtf(float(sum));
                // cout << d[i][j]<<endl;
                if(ceil(d[i][j]) == floor(d[i][j])){
                    ans++;
                }
            }
        }
    }

    cout <<ans;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3920
from collections import Counter
N = int(input())
Aset = dict()
Ans = 0
for _ in range(N):
    S = input()
    NewS = ''
    S = sorted(S)
    for i in range(len(S)):
        NewS += S[i]
    if NewS not in Aset:
        Aset[NewS] = 1
    else:
        Ans += Aset[NewS]
        Aset[NewS] += 1
print(Ans)

Measured memory_bytes: 22448
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int comp(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return (*(int*)a<*(int*)b)-(*(int*)a>*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint64_t nextplong(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}
inline int abs2(const int a){return a>=0?a:-a;}

#define p 998244353

int a[100000];
int d[100000];
int main(void){
	int n=nextpint();
	if(nextpint()!=0){
		puts("0");
		return 0;
	}
	a[0]=1;
	for(int i=1; i<n; i++){
		d[i]=nextpint();
		if(d[i]==0){
			puts("0");
			return 0;
		}
		a[d[i]]++;
	}
	long ans=1;
	for(int i=1; i<n; i++){
		ans=(ans*a[d[i]-1])%p;
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int K;
  cin>>K;
  vector<int64_t>A(K);
  for(int i=0;i<K;i++){
    cin>>A[i];
  }
  int64_t MIN=A[K-1],MAX=A[K-1];
  if(A[K-1]!=2){cout<<-1<<endl;return 0;}
  for(int i=K-1;i>=0;i--){
    int64_t x=(MIN+A[i]-1)/A[i]*A[i];
    int64_t y=MAX/A[i]*A[i];
    MIN=x;
    MAX=y+A[i]-1;
    if(x>y){cout<<-1<<endl;return 0;}
  }

  cout<<MIN<<" "<<MAX<<endl;
  return 0;  
}

Measured memory_bytes: 3932
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
using namespace std;
const int N=1e3+5;
const int M=2e5+5;
bitset<N> vis;
bool vis1[N][N],vis2[N][N];
int n,m,a[M],b[M],mark[N];
vector<int> to[N];
inline void dfs1(int u,int s){
	if(vis1[s][u]) return;
	vis1[s][u]=1;
	for(re int i=0;i<to[u].size();i++) dfs1(to[u][i],s);
}
inline void dfs2(int u,int s,int tp,int c){
	if(vis[u]) return;
	vis[u]=1;
	if(!tp) mark[u]=c;
	else vis2[s][u]=(c!=mark[u]);
	for(re int i=0;i<to[u].size();i++) dfs2(to[u][i],s,tp,c);
}
int main(){
	scanf("%d%d",&n,&m);
	inc(i,1,m){
		scanf("%d%d",&a[i],&b[i]);
		to[a[i]].push_back(b[i]);
	}
	inc(i,1,n) dfs1(i,i);
	inc(u,1,n){
		vis.reset(),vis[u]=1;
		for(re int i=0;i<to[u].size();i++) dfs2(to[u][i],u,0,i);
		vis.reset(),vis[u]=1;
		for(re int i=to[u].size()-1;~i;i--) dfs2(to[u][i],u,1,i);
	}
	inc(i,1,m) puts(vis1[b[i]][a[i]]^vis2[a[i]][b[i]]?"diff":"same");
}

Measured memory_bytes: 6272
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int n,k,m,tmp,ans;
bool good[101];
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=1;i<=k;++i)
	{
		cin>>m;
		for(int l=1;l<=m;++l)
		{
			cin>>tmp;
			good[tmp]=true;
		}
	}
	for(int i=1;i<=n;++i)
	{
		if(!good[i])
		{
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=100;
int n,cnt;
char s[maxn];
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	scanf("%s",s+1);
	for (int i=3;i<=n;i++)
		if (s[i-2]=='A'&&s[i-1]=='B'&&s[i]=='C') cnt++;
	printf("%d\n",cnt);
	return 0;
}
/*
  REMEMBER:
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Array size? Integer overflow? Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 256