akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
N = inputI()
K = inputI()
X = inputIL()

ans = 0
for x in X:
  ans += min(abs(x-K),x)*2

print(ans)

Measured memory_bytes: 38384
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = input()

if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()

L = 26
s = [ord(c) - ord('a') for c in s]

memo = [False] * L
for c in s:
    memo[c] = True

lowerbound = 0
while all(memo[lowerbound:]):
    c = s.pop()
    lowerbound = c + 1
    memo[c] = False

for i in range(lowerbound, L):
    if not memo[i]:
        s.append(i)
        break

print(''.join(map(chr, [c + ord('a') for c in s])))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

#define MAXN 100001

int block_sz;          // block size = sqrt(height)
int depth[MAXN];       // stores depth for each node.
int parent[MAXN];      // stores first parent for each node.
int jump_parent[MAXN]; // stores first ancestor in previous block.
vector<int> adj[MAXN];

void addEdge(int u, int v){
    adj[u].push_back(v);
    adj[v].push_back(u);
}

int LCANaive(int u,int v){
    if(u == v)              return u;
    if(depth[u] > depth[v]) swap(u, v);
    v = parent[v];
    return LCANaive(u, v);
}

// precalculating the required parameters associated with every node.
void dfs(int cur, int prev){
    // marking depth of cur node
    depth[cur] = depth[prev] + 1;
    
    // marking parent of cur node
    parent[cur] = prev;
    
    // making jump_parent of cur node
    // if it is first node of the block then its jump_parent is its cur parent.
    if (depth[cur] % block_sz == 0) jump_parent[cur] = parent[cur];
    // if it is not the first node of this block then its jump_parent is jump_parent of its parent.
    else                            jump_parent[cur] = jump_parent[prev];
    
    // propogating the marking down the subtree
    for(int i = 0; i < adj[cur].size(); ++i) if(adj[cur][i] != prev) dfs(adj[cur][i], cur);
}

// using sqrt decomposition trick
int LCASQRT(int u, int v){
    while(jump_parent[u] != jump_parent[v]){
        // maintaining depth[v] > depth[u]
        if(depth[u] > depth[v]) swap(u, v);
        // climb to its jump parent
        v = jump_parent[v];
    }
    // u and v have same jump_parent
    return LCANaive(u, v);
} 

void preprocess(int height){
    block_sz = sqrt(height);
    depth[0] = -1;
    // precalclating 1) depth.  2) parent.  3) jump_parent for each node
    dfs(0, 0);
}

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 0, s, t, w; i < N; ++i){
        int k;
        scanf("%d", &k);
        for(int j = 0; j < k; ++j){
            int c;
            scanf("%d", &c);
            addEdge(i, c);
        }
    }
    
    // 2. 前処理.
    preprocess(MAXN);
    
    // 3. 各判定クエリに対し, 出力を行う.
    int Q;
    scanf("%d", &Q);
    for(int i = 0; i < Q; i++){
        int u, v;
        scanf("%d %d", &u, &v);
        printf("%d\n", LCASQRT(u, v));
    }
    
    return 0;
}



Measured memory_bytes: 14500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());

            var ans = long.MaxValue;

            for (var i = 1; (long)i * i <= N ; i++)
            {
                if(N % i == 0)
                {
                    ans = Math.Min(Math.Max(i.ToString().Length, (N / i).ToString().Length), ans);
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27532
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define N 100007

class SegmentTree {
  const static ll inf = (1LL << 31) - 1;
  int n, n0;
  ll data[4*N];

public:
  SegmentTree(int n) {
    n0 = 1;
    while(n0 < n) n0 <<= 1;
    rep(i, 2*n0) data[i] = inf;
  }

  void update(int k, ll x) {
    k += n0-1;
    data[k] = x;
    while(k > 0) {
      k = (k - 1) / 2;
      data[k] = min(data[2*k+1], data[2*k+2]);
    }
  }

  ll __query(int a, int b, int k, int l, int r) {
    if(a <= l && r <= b) {
      return data[k];
    }
    if(r <= a || b <= l) {
      return inf;
    }
    ll lv = __query(a, b, 2*k+1, l, (l+r)/2);
    ll rv = __query(a, b, 2*k+2, (l+r)/2, r);
    return min(lv, rv);
  }

  ll query(int a, int b) {
    return __query(a, b, 0, 0, n0);
  }
};

int n, q;

int main() {
  cin >> n >> q;
  SegmentTree st(n);
  rep(i, q) {
    int t, x, y; cin >> t >> x >> y;
    switch(t) {
      case 0:
        st.update(x, y);
        break;
      case 1:
        cout << st.query(x, y+1) << endl;
        break;
    }
  }
  return 0;
}


Measured memory_bytes: 5156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll a;
    cin >> a;
    string ans = "Three";
    for (int i = 0; i < a; i++){
        char n;
        cin >> n;
        if (n == 'Y')ans = "Four";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3528
#include<iostream>
#include<vector>
using namespace std;
long long  cnt;
int m = 0;
int A[1000000];
vector<int> G;

void insertSort(int A[], int n, int g) {
	for (int i = g; i < n; i++) {
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shellSort(int A[], int n) {
	for (int h = 1;;) {
		if (h > n) { break; }
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--) {
		insertSort(A, n, G[i]);
	}
}
int main() 
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	shellSort(A,n);
	cout <<G.size()<< endl;
	for (int i = G.size()-1; i>=0; i--) {
		cout << G[i]<<" ";
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++) {
		cout << A[i] << endl;
	}
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
vector<vector<char>> g;
vector<vector<bool>> seen;
ll h, w, wc, bc;
void dfs(ll x, ll y){
    seen[x][y] = true;
    wc += g[x][y]=='.';
    bc += g[x][y]=='#';
    rep(i, 4){
        if(x+dx[i]<0 || y+dy[i]<0 || h<=x+dx[i] || w<=y+dy[i]) continue;
        if(g[x][y]==g[x+dx[i]][y+dy[i]]) continue;
        if(seen[x+dx[i]][y+dy[i]]) continue;
        dfs(x+dx[i], y+dy[i]);
        
    }
}
int main(){
    cin >> h >> w;
    g.resize(h, vector<char>(w));
    seen.assign(h, vector<bool>(w, false));

    rep(i, h) rep(j, w) cin >> g[i][j];
    ll res=0;
    rep(i, h){
        rep(j, w){
            wc = bc = 0;
            if(!seen[i][j] && g[i][j]=='#') dfs(i, j);
            res += wc*bc;
        }
    }
    
    cout << res << endl;
}


Measured memory_bytes: 13704
#include <bits/stdc++.h>
using namespace std;
const int limN = 1e5 + 5;

int W = 0 ;
int minW[limN];

int main() {
    int n ;
    scanf("%d", &n);
    for(int i=0, a, k; i<n; i++) {
        scanf("%d", &a);
        k = lower_bound(minW, minW+W, a) - minW;
        minW[k] = a;
        W = max(W, k+1);
    }
    printf("%d\n", W);
}



Measured memory_bytes: 3572
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n; R(n);
    W((n-n/2)*1./n);
    return 0;
}


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

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int n = 18;
    cin >> n;
    vector<int> s(1 << n);
    rep(i, 1 << n) cin >> s[i];
    sort(ALL(s));
    multiset<int> st;
    rep(i, (1 << n) - 1) st.insert(s[i]);
    vector<int> v(1, s[(1 << n) - 1]);
    rep(i, n) {
        int siz = v.size();
        for(int j = siz - 1; j >= 0; j--) {
            auto itr = st.lower_bound(v[j]);
            if(itr == st.begin()) {
                cout << "No" << endl;
                return 0;
            }
            itr--;
            v.push_back(*itr);
            st.erase(itr);
        }
        sort(ALL(v));
    }
    cout << "Yes" << endl;
    return 0;
}

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

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

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
   
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String input;
    int count = 1;
    while (!(input = br.readLine()).equals("0")) {
      System.out.println("Case " + count + ": " + input);
      count++;
    }
  }
}

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

#define thegamebegins   ios_base::sync_with_stdio(false); cin.tie(nullptr); //cout.tie(nullptr);
#define fileio          freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int             long long
#define float           long double
#define test            int TESTS; cin>>TESTS; for(int CASE=1; CASE<=TESTS; ++CASE)
#define in(arr,n)       for(int i=0; i<(n); ++i) cin>>arr[i]
#define lcm(a,b)        ((a)/__gcd((a),(b)))*(b)
#define midl(l,r)       ((l)+((r)-(l))/2)
#define prec(n)         fixed<<setprecision(n)
#define r0              return 0
#define E               "\n"
#define S               " "
#define elif            else if
#define INF             9e18
#define M               1000000007
#define PI              3.141592653589793238L
#define sortd(s,n)      sort((s), (s)+(n), greater<int>())
#define fi(i,x,y)       for(int i=(x); i<(y); ++i)
#define fb(i,x,y)       for(int i=(x); i>=(y); --i)
#define fa(i,s)         for(auto i:(s))
#define fp(i,s)         for(auto i=(s).begin(); i!=(s).end(); ++i)
#define pf(i,s)         for(auto i=(s).rbegin(); i!=(s).rend(); ++i)
#define all(s)          (s).begin(), (s).end()
#define rev(s)          (s).rbegin(), (s).rend()
#define sz(s)           (int)(s).size()
#define em(s)           (s).empty()
#define fr              first
#define sc              second
#define pb              push_back
#define eb              emplace_back
#define ins             insert
#define emp             emplace
#define lb              lower_bound
#define ub              upper_bound
#define er              equal_range

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ " : " << (__VA_ARGS__) << "] "

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int,int>;
using mii = map<int,int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int,int>>;
using seti = set<int>;
using setd = set<int,greater<int>>;
using pqmx = priority_queue<int>;
using pqmn = priority_queue<int,vector<int>,greater<int>>;

/*__*/

signed main()
{
    thegamebegins
 
    int a,b;    cin>>a>>b;
    cout<<a*b;
    r0;
}


Measured memory_bytes: 3640
n = int(input())
a = [int(i) for i in input().split()]
imos = [a[i] for i in range(n)]
for i in range(1, n):
    imos[i] += imos[i - 1]
diff = abs(imos[-1] - 2 * a[0])
for i in range(1, n-1):
    diff = min(diff, abs(imos[-1] - 2 * imos[i]))
print(diff)

Measured memory_bytes: 24832
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b;
	if(a==2||b==2)cout<<"No";
	else cout<<"Yes"; 
	return 0;
}


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

int main(){

int N,X;
  cin >> N >> X;
  int min=10000;
  int m[N];
  int count=N;
  for(int i=0;i<N;i++){
  cin >> m[i];
   int t= m[i];
    X-=t;
    if(min>t)min = t;
  
  }
  cout << N + X/min << endl;

}

Measured memory_bytes: 3592
c1 = input().split()
c2 = input().split()
c3 = input().split()

c1 = list(map(int,c1))
c2 = list(map(int,c2))
c3 = list(map(int,c3))

for i in range(2):
	c1[i+1] = c1[i+1] - c1[0]
	c2[i+1] = c2[i+1] - c2[0]
	c3[i+1] = c3[i+1] - c3[0]

c1 = c1[1:]
c2 = c2[1:]
c3 = c3[1:]

if c1 == c2 == c3:
	print("Yes")

else:
	print ("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,z,x;
    char c;
    scanf("%d %c %d",&a,&c,&b);
    switch(c)
    {
    case '+':
        z=a+b;
        printf("%d",z);
        break;
    case '-':
        x=a-b;
        printf("%d",x);
        break;

    }
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
// #include <immintrin.h>
// #include <emmintrin.h>

#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#define vi vector<int>
#define vpii vector<pii>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define aal(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
template<typename T>
inline int getplc(T x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
  LL res=1;
  for(;b;b>>=1,a=a*a%_MOD){
    if(b&1)res=res*a%_MOD;
  }
  return res;
}
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }
void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  errl(++it, args...);
}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << "=" << a << " # ";
  err(++it, args...);
}


char s[N];
void Solve() {
  cin >> s;
  int n = strlen(s), sum = 0;
  for (int i = 0; i < n; i++) {
    sum += s[i] - '0';
  }
  if (sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

}

int main() {
#ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
//  freopen("o1.txt","w",stdout);
#endif
  ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
  Solve();
  return 0;
}


Measured memory_bytes: 3856
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        int diff = Integer.MAX_VALUE;
        for (int i = 0; i < n - k + 1; i++) {
            diff = Math.min(diff, h[k+i-1] - h[i]);
        }

        System.out.println(diff);
    }
}

Measured memory_bytes: 50564
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w; cin >> h >> w;
  vector<string> S(h); rep(i, h) cin >> S[i];
  vector<vector<int>> ans(h, vector<int>(w));
  int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
  int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
  rep(i, h) rep(j, w) {
    if(S[i][j] == '#') {
      rep(k, 8) {
        int nx = i+dx[k], ny = j+dy[k];
        if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
        ans[nx][ny]++;
      }
    }
  }
  rep(i, h) {
    rep(j, w) {
      if(S[i][j] == '#') cout << '#';
      else cout << ans[i][j];
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    ll s;
    cin >>s;
    ll ss=s%1000000000LL;
    ll SS=s/1000000000LL;
    if(ss!=0LL){
    SS++;
    ss=1000000000LL-ss;
    }
    printf("0 0 1000000000 1 %lld %lld",ss,SS);
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define pb push_back

constexpr ll MOD = (ll)((1E+9)+7);

ll N, K;
vvll Path;
vll flag;


ll calc_K1(ll x){
  if(x<0) return 0;
  ll tmp = K-1;
  REP(i,x){
    tmp*=(K-2-i);
    tmp%=MOD;
    if(tmp==0) return 0;
  }
  return tmp;
}

ll calc_K2(ll x){
  if(x<0) return 0;
  ll tmp = K-2;
  REP(i,x){
    tmp*=(K-3-i);
    tmp%=MOD;
    if(tmp==0) return 0;
  }
  return tmp;
}

ll calc2(ll pos){
  if(!flag[pos]) return 1;
  flag[pos] = false;
  if(Path[pos].size()==0) return 0;
  if(Path[pos].size()==1) return 1;
  ll tmp = 1;
  REP(i,Path[pos].size()){
    tmp *= calc2(Path[pos][i]);
    tmp %= MOD;
  }
  //fprintf(stderr, "%lld %lld\n", pos, tmp);
  tmp *= calc_K2(Path[pos].size()-2);
  tmp %= MOD;
  //fprintf(stderr, "%lld %lld\n", pos, tmp);
  return tmp;
}

ll calc(ll pos){
  if(!flag[pos]) return 1;
  flag[pos] = false;
  if(Path[pos].size()==0) return 1;
  ll tmp = 1;
  REP(i,Path[pos].size()){
    tmp *= calc2(Path[pos][i]);
    tmp%=MOD;
  }
  tmp *= calc_K1(Path[pos].size()-1);
  tmp %= MOD;
  //fprintf(stderr, "%lld %lld\n", pos, tmp);
  return tmp%MOD;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  cin >> N >> K;
  Path.resize(N);
  flag.resize(N);
  REP(i,N) flag[i] = true;
  REP(i,N-1){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    Path[a].pb(b);
    Path[b].pb(a);
  }

  printf("%lld\n", (calc(0)*K)%MOD);

  return 0;
}

Measured memory_bytes: 9984
N = int(input())
SP = [list(input().split()) for i in range(N)]

for i in range(N):
    SP[i][1] = int(SP[i][1])
    SP[i].append(i+1)

for i in range(N):
    for j in reversed(range(i+1,N)):
        if SP[i][0] > SP[j][0]:
            SP[i],SP[j] = SP[j],SP[i]
        elif SP[i][0] == SP[j][0] and SP[i][1] < SP[j][1]:
            SP[i],SP[j] = SP[j],SP[i]

for i in range(N):
    print(SP[i][2])


Measured memory_bytes: 3064
N, K = [int(_) for _ in input().split()]
numbers = {}
for _ in range(N):
    a, b = [int(_) for _ in input().split()]
    numbers[a] = numbers.get(a, 0) + b
count = 0
for key, value in sorted(numbers.items()):
    count += value
    if count >= K:
        print(key)
        exit()


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

int main(void){
    int n,k,s;
    cin>>n>>k>>s;
    int AMAX = 1000000000;
    for(int i=0;i<k;i++) cout<<s<<" ";
    s = s % AMAX + 1;
    for(int i=0;i<n-k;i++) cout<<s<<" ";
    cout<<endl;
}

Measured memory_bytes: 1280
import math

a,b,c = map(int,input().split())

temp = c**2 + a**2 + b**2 - 2*(a*b + a*c + b*c)

if (c-a-b) < 0:
    print('No')
elif temp > 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
n = int(input())
s = [input() for i in range(n)]
a = 0
b = 0
c = 0
cnt = 0
for i in s:
    cnt += i.count("AB")
    if i[0] == "B" and i[-1] == "A":
        a += 1
    elif i[0] == "B":
        b += 1
    elif i[-1] == "A":
        c += 1
if a == 0:
    print(min(b, c) + cnt)
else:
    if b + c == 0:
        print(cnt + a - 1)
    else:
        print(cnt + a + min(b, c))

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;i++)
#define per(i,b,a) for(int i=(b),i##_st=(a);i>=i##_st;i--)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define debug(x) cerr<<#x" = "<<x<<endl
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef pair<int,int> pii;
typedef long long ll;
const int inf=~0u>>1,MOD=1e9+7;//*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=((TT=but)+fread(but,1,1<<15,stdin)),TT==mo))?-1:*TT++)//*/
inline int rd() {
	int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
	while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
int n,c[1111],d;
#define ex1 return puts("Impossible"),0
#define ex2 return puts("Possible"),0
int main(){
	n=rd();
	rep(i,1,n){
		int x=rd();
		c[x]++,d=max(d,x);
	}
	rep(i,1,(d-1)/2)if(c[i])ex1;
	if(d&1){
		if(c[d/2+1]!=2)ex1;
		rep(i,d/2+2,d)if(c[i]<2)ex1;
	}else{
		if(c[d/2]>1)ex1;
		rep(i,d/2+1,d)if(c[i]<2)ex1;
	}
	ex2;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	}

	public static void selectionSort( int[] numArray, int num){
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	}
}


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

int main(){
    while(1){
        int n, s[1000], sum=0;
        cin >> n;
        if(n == 0) break;

        for(int i=0; i<n; i++){
            cin >> s[i];
            sum += s[i];
        }

        double mean = (double)sum / n;
        double var = 0;
        for(int i=0; i<n; i++){  
            var += (s[i] - mean) * (s[i] - mean);
        }
        var /= (double)n;
        printf("%lf\n", sqrt(var));
    }

    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e6+50;
pii f[N];
int n, g[N];
pii S, T;

void init() {
	scanf("%d%d%d%d",&S.x,&S.y,&T.x,&T.y);
	scanf("%d", &n);
	REP(i,1,n) scanf("%d%d",&f[i].x,&f[i].y);
	if (S.x>T.x) {
		S.x=-S.x,T.x=-T.x;
		REP(i,1,n) f[i].x=-f[i].x;
	}
	if (S.y>T.y) {
		S.y=-S.y,T.y=-T.y;
		REP(i,1,n) f[i].y=-f[i].y;
	}
	int now = 0;
	REP(i,1,n) {
		if (S.x<=f[i].x&&f[i].x<=T.x&&S.y<=f[i].y&&f[i].y<=T.y) {
			f[++now] = f[i];
		}
	}
	n = now;
}

int main() {
	init();
	sort(f+1,f+1+n);
	memset(g,0x3f,sizeof g);
	REP(i,1,n) *lower_bound(g+1,g+1+n,f[i].y)=f[i].y;
	int len = lower_bound(g+1,g+1+n,INF)-g-1;
	const double pi = acos(-1);
	double ans = 100.*(abs(S.x-T.x)+abs(S.y-T.y))-len*(20-5*pi);
	if (len==min(abs(S.x-T.x),abs(S.y-T.y))+1) ans += 5*pi;
	printf("%.15lf\n", ans);
}


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

using namespace std;

bool isOK(int* const skill,int length, int threshold)
{
    bool result = true;
    for (int s = 0; s < length; s++)
    {
        result &= (skill[s] >= threshold);
    }
    return result;
}

int n, m, x;
int aMat[12][12];
int cArr[12];

int dfs(int i, int cost, int* const skill)
{
    if( isOK(skill, m, x) ){
        return cost;
    }

    if(i == n) return 1e8;

    int newSkill[12];

    for(int alg = 0; alg < m; alg++){
        newSkill[alg] = skill[alg] + aMat[i][alg];
    }

    int cost1 = dfs(i+1, cost + cArr[i], newSkill);

    int cost2 = dfs(i+1, cost, skill);

    return min(cost1, cost2);
}



int main(void)
{
    cin >> n >> m >> x;

    for (int row = 0; row < n; row++)
    {
        cin >> cArr[row];
        for (int col = 0; col < m; col++)
        {
            cin >> aMat[row][col];
        }
    }

    int skill[12] = {0};
    int initCost = 0;

    int result = dfs(0, initCost, skill);

    if(result >= 1e8){
        cout << -1 << endl;
    } else {
        cout << result << endl;
    }

    return 0;
}


Measured memory_bytes: 3596
package main

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

type Node struct {
	p, l, r int
}

var node [25]Node

//
func scanAsInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic("ERROR: failed to Atoi")
	}
	return v
}

//
func scanAsIntSlice(sc *bufio.Scanner) []int {
	sc.Scan()
	slice := strings.Split(sc.Text(), " ")
	sliceInt := make([]int, len(slice))
	for i, v := range slice {
		s, err := strconv.Atoi(v)
		if err != nil {
			panic("failed to parse.")
		}
		sliceInt[i] = s
	}
	return sliceInt
}

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `

9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}

func preOrder(i int) {
	if i == -1 {
		return
	}
	fmt.Printf(" %d", i)
	preOrder(node[i].l)
	preOrder(node[i].r)
}

func inOrder(i int) {
	if i == -1 {
		return
	}
	inOrder(node[i].l)
	fmt.Printf(" %d", i)
	inOrder(node[i].r)
}

func postOrder(i int) {
	if i == -1 {
		return
	}
	postOrder(node[i].l)
	postOrder(node[i].r)
	fmt.Printf(" %d", i)
}

// solve
func solve(sc *bufio.Scanner) {

	n := scanAsInt(sc)
	for i := 0; i < n; i++ {
	    node[i].p = -1
    }
	for i := 0; i < n; i++ {
		ints := scanAsIntSlice(sc)
		node[ints[0]].l = ints[1]
		if ints[1] != -1 {
			node[ints[1]].p = ints[0]
		}
		node[ints[0]].r = ints[2]
		if ints[2] != -1 {
			node[ints[2]].p = ints[0]
		}
	}
	
	root := 0
	for i := 0; i < n; i++ {
	    if node[i].p == -1 {
	        root = i
	        break
	    }
	}

	fmt.Println("Preorder")
	preOrder(root)
	fmt.Println()
	fmt.Println("Inorder")
	inOrder(root)
	fmt.Println()
	fmt.Println("Postorder")
	postOrder(root)
	fmt.Println()
}



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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> vec(m);
  for (int i = 0; i < m; i++) {
    cin >> vec.at(i);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int row = 0, a;
    for (int i = 0; i < m; i++) {
      cin >> a;
      row += a * vec.at(i);
    }
    row += c;
    if (row > 0) cnt++;
  }
  cout << cnt << endl;
}



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

int main() {
    uint64_t X, Y;
    std::cin >> X >> Y;

    size_t cnt = 0;
    uint64_t A = X;
    while (A <= Y) {
        ++cnt;
        A *= 2;
    }

    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 384
#include <functional>
#include <iostream>

using namespace std;

int main()
{
    function<int(int, int)> gcd = [&gcd](int x, int y) {
        if (y == 0) {
            return x;
        }
        return gcd(y, x % y);
    };

    int n, m;
    cin >> n >> m;
    cout << gcd(n, m) << endl;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
const int maxn = 120;
int n,m,X,Y,x[maxn],y[maxn];
void init () {
	n = read(); m = read();
	X = read(); Y = read();
	for (int i = 1;i <= n;i ++)
		x[i] = read();
	for (int i = 1;i <= m;i ++)
		y[i] = read();
	sort(x + 1,x + 1 + n);
	sort(y + 1,y + 1 + m);
}
bool work () {
	if (X >= Y) return false;
	if (x[n] >= y[1]) return false;
	if (x[n] >= Y) return false;
	if (y[1] <= X) return false;
	return true;
}
int main () {
	init ();
	if (!work ()) printf("War\n");
	else printf("No War\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define rg register

using namespace std;
int n,po=1000;
int ans;
int main()
{
	cin>>n;
	for(rg int i=1;i<=4;i++)
	{
		if(n/po==2) ans++;
		n%=po;
		po/=10;
	}
	cout<<ans;
	
	return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

double a,b;

int main(){
	cin.sync_with_stdio(false);
	cin>>a>>b;
	printf("%.10f\n",(a*b)/(a+b));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
    int n;
    cin >> n;
    for (int i = 0 ; i < n ; i++)
    {
        long double x[4],y[4],s,t;
        cin >> x[0] >>y[0] >>x[1] >>y[1] >>x[2] >>y[2] >>x[3] >>y[3];
        s = (y[1]-y[0])*(x[3]-x[2]);
        t = (y[3]-y[2])*(x[1]-x[0]);
       // if ((abs((y[0]-y[1])/(x[0]-x[1]))) == (abs((y[2]-y[3])/(x[2]-x[3]))))
        if (s == t)
        {
          cout <<"YES" <<endl; 
        } else
        {
          cout <<"NO" <<endl;
        }  
    }
 
     
    return 0;
}

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

using namespace std;

typedef long long               ll;
typedef unsigned long long      ull;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef pair<ll,ll>             pairll;
typedef map<ll,ll>              mapll ;
typedef map<char,ll>            mapch;
typedef map<string,ll>          mapstr;

#define si(a) scanf("%d", &a)
#define sll(a) scanf("%lld",&a)
#define sii(a,b) scanf("%d %d", &a,&b)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pt(a) printf("%d",a)
#define pll(a) printf("%lld",a)
#define ps printf(" ")
#define nln printf("\n")
#define pi acos(-1)
#define spc " "
#define nl "\n"
#define rep(i,W) for(int i = 0; i < W; i++)
#define rep1(i,W) for(int i = 1; i <= W; i++)

ll N, M, D;

void input(){
    cin >> N >> M >> D;
}

void solve(){
    double per;
    if(D == 0) per = N;
    else per = 2*(N-D);
    double y = N;
    double x = (double) (((M-1)*per)/((y*y)));
    printf("%.10f",x);
}

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





Measured memory_bytes: 256
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
v = LI()
vs = sorted(v)

def kati(x,y):
    return (x+y)/2

result = vs[0]
cv = 0
for i in range(1, n):
    result = kati(result, vs[i])

print(result)

Measured memory_bytes: 12244
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

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

	int ans = 0;
	rep(i, s.size()) {
		if (s[i] == '1')ans++;
	}
	cout << ans << endl;
	return	0;
}




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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

const int MAX_N = 100001;

int prime[MAX_N];
bool is_prime[MAX_N + 1];

void eratos(int n) {
    int p = 0;
    for (int i = 0; i <= n; ++i) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; ++i) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (int j = 2*i; j <= n; j += i) is_prime[j] = false;
        }
    }
}

int main() {
    eratos(MAX_N);
    double m, a, b;
    while (cin >> m >> a >> b and (m or a or b)) {
        double best = 0, P = 0, Q = 0;
        for (double p=2; p<=m; ++p) {
            if (!is_prime[(int)p]) continue;
            int qq = m/p;
            for (double q=qq; q>=2; --q) {
                if (is_prime[(int)q]) {
                    if (a/b > p/q or p/q > 1.0) continue;
                    if (best < p*q) {
                        best = p*q;
                        P = p;
                        Q = q;
                    }
                    break;
                }
            }
        }
        cout << P << ' ' << Q << endl;
    }
    return 0;
}



Measured memory_bytes: 3312
#include <stdio.h>
int main(void){
  int a,b,i;
  int c[200000];
  scanf("%d",&a);
  for(i=0;i<a;i++){
    c[i]=0;
  }
  for(i=0;i<a-1;i++){
    scanf("%d",&b);
    c[b-1]++;
  }
 for(i=0;i<a;i++){
  printf("%d\n",c[i]);
 }
  return 0;
}


Measured memory_bytes: 2516
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, countA, countB, countC, res; cin >> n;
	countA = countB = countC = res = 0;
	rep(i, 1, n)
	{
		string s;
		cin >> s;
		int slen = s.size();
		rep(j, 0, slen - 2)
		{
			if (s[j] == 'A' && s[j + 1] == 'B') ++res;
		}
		if (s[slen - 1] == 'A'&&s[0] == 'B') ++countC;
		if (s[slen - 1] == 'A') ++countA;
		if (s[0] == 'B') ++countB;
	}

	res += min(countA, countB);
	if (countA == countC && countB == countC && countB > 0)--res;
	
	cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
   int a,b,area;
   scanf("%d",&a);
   scanf("%d",&b);
if((a-1) >= 0 && (b-1) >= 0)
{
    area  = (a-1)*(b-1);
    printf("%d\n",area);

}

   
return 0;
}

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

const int maxn=1e5+10;

int n;

char s[maxn];
int sum[maxn];
int L[maxn],R[maxn];
int l[maxn],r[maxn];

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(register int i=1;i<=n;i++){
		if(s[i]=='L'){
			int x=i;
			L[i]=i;
			while(s[i]=='L'){
				l[i]=l[i-1]+1;
				L[i]=x;
				i++;
			}
			i--;
		}
	}
	for(register int i=n;i>=1;i--){
		if(s[i]=='R'){
			int x=i;
			R[i]=i;
			while(s[i]=='R'){
				r[i]=r[i+1]+1;
				R[i]=x;
				i--;
			}
			i++;
		}
	}
	for(register int i=1;i<=n;i++){
		if(l[i]){
			if(l[i]%2)
				sum[L[i]]++;
			else
				sum[L[i]-1]++;
		}
		if(r[i]){
			if(r[i]%2)
				sum[R[i]]++;
			else
				sum[R[i]+1]++;
		}
	}
	for(register int i=1;i<=n;i++)
		printf("%d ",sum[i]);
	return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N,L;
    string S[104];
    cin >> N >> L;
    REP(i,N){cin >> S[i];}
    sort(S,S+N);
    REP(i,N){cout << S[i];}
    cout << endl;
    return 0;
}


Measured memory_bytes: 256