akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

int dx[4] = {0, -1, 0, 1};
int dy[4] = {-1, 0, 1, 0};

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};

Int getHead(Int n) {
    while(n / 10 > 0){
        n /= 10;
    }
    n %= 10;
    return n;
}

int main(void) {
    Int n;
    cin >> n;
    Int memo[10][10] = {};
    REPe(n,i){
        if (i % 10 != 0) {
            memo[getHead(i)][i%10]++;
//            cout << i << " : " << getHead(i) <<  " " << i%10 << endl;
        }
    }
    Int ans = 0;
    REP(10,i){
        REP(10,k){
            ans += memo[i][k] * memo[k][i];
        }
    }
    cout << ans << endl;
}




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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 10005;

/* ...o(^-^)o... */
vector<int> to[MAX];

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

    rep(i, n-1){
        int a, b; cin >> a >> b; a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    vector<lint> c(n);
    rep(i, n) cin >> c[i];
    sort(all(c), greater<lint>());

    vector<lint> ans(n);
    queue<int> bfs; bfs.push(0);
    bool seen[MAX]; fill(seen, seen + n, false); int j = 0;
    while(!bfs.empty()){
        int s = bfs.front(); bfs.pop();
        seen[s] = true; ans[s] = c[j]; j++;
        for(int& t: to[s]){
            if(seen[t]) continue;
            bfs.push(t);
        }
    }

    lint m = 0;
    rep(i, n-1) m += c[i+1];
    
    out(m);
    rep(i, n) outs(ans[i]);
    out("");
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i,n){
    cin >> vec.at(i);
  }
  int sum=0;
  vector<bool> ans(8,false);
  rep(i,n){
    if(vec.at(i)<400){
      ans.at(0)=true;
    }else if(vec.at(i)<800){
      ans.at(1)=true;
    }else if(vec.at(i)<1200){
      ans.at(2)=true;
    }else if(vec.at(i)<1600){
      ans.at(3)=true;
    }else if(vec.at(i)<2000){
      ans.at(4)=true;
    }else if(vec.at(i)<2400){
      ans.at(5)=true;
    }else if(vec.at(i)<2800){
      ans.at(6)=true;
    }else if(vec.at(i)<3200){
      ans.at(7)=true;
    }else{
      sum++;
    }
  }
  int a=0;
  rep(i,8){
    if(ans.at(i)){
      a++;
    }
  }
  cout << max(a,1) << " " <<sum+a<<endl;
}


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

using namespace std;

int main(){
  int N, M;

  cin >> N >> M;

  vector<int> nums(N + 3);
  for(int i = 1; i <= N; ++i){
    cin >> nums[i];
  }

  vector<vector<int> > v(N + 3);
  int x, y;

  for(int i = 0; i < M; ++i){
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }

  vector<int> ind(N + 3, 0);
  vector<int> els(N + 3, 0);

  bool visited[100010];
  memset(visited, 0, sizeof visited);
  int res = 0;
  for(int i = 1; i < N; ++i){
    if(not visited[i]){
      // printf("-----\n");
      queue<int> q;
      q.push(i);
      visited[i] = true;
      while(!q.empty()){
        auto cur = q.front(); q.pop();
        // printf("%d: %d e %d\n", cur, ind[cur], els[cur]);
        // printf("-> %d: %d e %d\n", nums[cur], ind[nums[cur]], els[nums[cur]]);
        if(ind[cur] < i){
          if(els[cur] == i) res++;
          ind[cur] = i;
        }

        if(els[nums[cur]] < i){
          if(ind[nums[cur]] == i) res++;
          els[nums[cur]] = i;
        }

        for(auto & node : v[cur]){
          if(not visited[node]){
            q.push(node);
            visited[node] = true;
          }
        }
      }
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 7040
import sys
x,k,d = map(int,input().split())
x=abs(x)
c = int(x/d)
le = int(k-abs(c))
if x==0:
    if k%2==0:
        print(0)
    else:
        print(d)
    sys.exit()
else:
    if le>=0:
        ne = -d*c+x
    else:
        if x>0:
            ne = -d*k+x
        else:
            ne = d*k-x
        print(abs(ne))
        sys.exit()
        
if le%2==0:
    print(abs(ne))
else:
    ans1=abs(ne-d)
    ans2=abs(ne+d)
    print(min(ans1,ans2))


        


Measured memory_bytes: 9088
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, M, X; cin >> N >> M >> X;
  int l=0, r=0;
  rep(i, M) {
    int A; cin >> A;
    if (A<X) l++;
    else r++;
  }
  int result = min(l, r);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
		int x = sc.nextInt();

		int ans = 0;
		outerA:
		for (int ia = 0; ia <= a; ia++) {
			int sum500 = ia * 500;
			if (sum500 > x) {
				break;
			}
			outerB:
			for (int ib = 0; ib <= b; ib++) {
				int sum100 = ib * 100;
				if (sum500 + sum100 > x) {
					continue outerA;
				}
				for (int ic = 0; ic <= c; ic++) {
					int sum50 = ic * 50;
					int sum = sum500 + sum100 + sum50;
					if (sum > x) {
						continue outerB;
					}
					if (sum == x) {
						ans++;
					}
				}
			}
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 23508
import           Control.Monad
import           Control.Monad.Primitive
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.List
import           Data.Maybe
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed.Mutable as VM

import           Debug.Trace


newUF :: PrimMonad m => Int -> m (VM.MVector (PrimState m) Int)
newUF n = do
  d <- VM.new n
  VM.set d (-1)
  return d

findUF :: PrimMonad m => VM.MVector (PrimState m) Int -> Int -> m Int
findUF d x = do
  dx <- VM.read d x
  if dx < 0
    then return x
    else do dx' <- findUF d dx
            VM.write d x dx'
            return dx'

uniteUF :: PrimMonad m => VM.MVector (PrimState m) Int -> Int -> Int -> m ()
uniteUF d x y = do
  x' <- findUF d x
  y' <- findUF d y
  when (x' /= y') $ do
    let (x'', y'') = if (x' <= y') then (x', y') else (y', x')
    dx <- VM.read d x''
    dy <- VM.read d y''
    VM.write d x'' (dx + dy)
    VM.write d y'' x''
  return ()

sameUF :: PrimMonad m => VM.MVector (PrimState m) Int -> Int -> Int -> m Bool
sameUF d x y = do
  fx <- findUF d x
  fy <- findUF d y
  return $ fx == fy

sizeUF :: PrimMonad m => VM.MVector (PrimState m) Int -> Int -> m Int
sizeUF d x = do
  fx <- findUF d x
  dfx <- VM.read d fx
  return (-dfx)

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  [n, m, k] <- getIntList
  fs <- replicateM m getIntList
  bs <- replicateM k getIntList

  blocks <- cnvBs n (fs++bs)

  uf <- newUF (n+1)

  forM_ fs $ \[a, b] -> do
    uniteUF uf a b

  forM_ [1..n] $ \i -> do
    when (i > 1) $ putStr " "
    printCand n i uf blocks

  putStrLn ""

  where
    cnvBs n bs = do
      blocks <- VBM.new (n+1)
      VBM.set blocks []
      forM_ bs $ \[c, d] -> do
        bc <- VBM.read blocks c
        bd <- VBM.read blocks d
        VBM.write blocks c (d:bc)
        VBM.write blocks d (c:bd)
      VB.freeze blocks

    printCand n i uf blocks = do
      t <- VM.new 1
      sz <- sizeUF uf i
      VM.set t (sz - 1)
      forM_ (blocks VB.! i) $ \j -> do
        same <- sameUF uf i j
        when same $ do
          num <- VM.read t 0
          VM.write t 0 (num-1)
      num <- VM.read t 0
      putStr . show $ num

Measured memory_bytes: 75644
#include<bits/stdc++.h>
using namespace std;
#define loi long long

int main()
{
loi n, a, b, dif;

cin >> n >> a >> b;

dif = abs(a - b);
dif--;

if(dif&1)
cout << "Alice\n";

else cout << "Borys\n";
return 0;
}


Measured memory_bytes: 256
N = int(input())
R = [tuple(map(int, input().split())) for _ in range(N)]
B = [tuple(map(int, input().split())) for _ in range(N)]
R = sorted(R)
B = sorted(B)

res = 0
for bx, by in B:
    idx = -1
    tmp = -1
    for i, (rx, ry) in enumerate(R):
        if rx < bx and ry < by:
            if ry >= tmp:
                tmp = ry
                idx = i
    if idx != -1:
        R.pop(idx)
        res += 1
print(res)

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

int main(){
  int n, p[20], ans = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> p[i];
  }
  for(int i = 1;i < n - 1;i++){
    if(p[i - 1] < p[i] && p[i] < p[i + 1]){
      ans++;
    }
    else if(p[i + 1] < p[i] && p[i] < p[i - 1]){
      ans++;
    }
  }
  cout << ans;
} 

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector a(n,0);
    for (int i=0; i<n; i++) cin >> a[i];

    map<int, long long> mp;
    long long ans = 0;
    for (int i=0; i<n; i++) {
        // i,a[i] が分かる
        int x = i + 1 - a[i];
        ans += mp[x];
        mp[i+a[i] + 1]++;
    }

    cout << ans << endl;
}

/*
for (i=0:n)
 for (j=i+1:n)
    チェックしていく

これで良さそう。
i,j を考える i<j
j - i = Ai + Aj となる組み合わせが満たされる。

i は過去の人

j, Aj から 1発で計算できると嬉しい。
j = Ai + Aj + i 

Ai + i を数えて保存しておく
j = x + Aj
j と Aj から x が分かるから、 今まで出てきた x の個数を数えておけば良い。

*/


Measured memory_bytes: 26072
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(s.substr(0,n/2)==s.substr(n/2)){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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 ll INF = 1e18+1;

int par[200000], rk[200000];

//配列が長さnのものとして0で初期化する
void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rk[i] = 0;
    }
}


int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

//要素を併合する
//木の高さrankが低いほうを高いほうの親につなげる
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rk[x] < rk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rk[x] == rk[y]) rk[x]++;
    }
}

//要素が同じ集合に属しているかどうかを返す
bool same(int x, int y) {
    return find(x) == find(y);
}

int main() {
    int N, M;
    cin >> N >> M;
    init(N);

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

    for (int i = 0; i < M; i++) {
        int x, y; cin >> x >> y; x--; y--;
        unite(x,y);
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (same(i,p[i])) cnt++;
    }
    cout << cnt << endl;

}



Measured memory_bytes: 1408
#include <cstdio>

typedef long long ll;

static const ll MAX_A = (ll)1e6;
static const ll MIN_A = -MAX_A;

int main() {
    int n;
    scanf(" %d", &n);

    ll a[n];
    ll min = MAX_A+1, max = MIN_A-1, sum = 0;
    for(int i = 0; i < n; i++) {
        scanf(" %ld", &a[i]);
        min = a[i] < min? a[i] : min;
        max = a[i] > max? a[i] : max;
        sum += a[i];
    }

    printf("%ld %ld %ld\n", min, max, sum);
    return 0;
}



Measured memory_bytes: 2760
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
   long long n,m;

   scanf("%lld",&n);
   while(n>0)
   {
       m=sqrt(n);
       if(m*m==n)
        {printf("%lld",n);
       break;}
       n--;
   }
    return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;

void solve(){
	int ans=0;
	int N;
	cin>>N;
	string s;
	cin>>s;
	int cur=0;
	for(auto i:s){
		if(i=='I')cur++;else if(i=='D')cur--;
		ans=max(cur,ans);		
	}
	cout<<ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn main() {
    let n = read::<usize>();
    let s: Vec<Vec<char>> = (0..n).map(|_| read::<String>().chars().collect()).collect();
    let mut ans = 0;
    'outer: for k in 0..n {
        for i in 0..n-1 {
            for j in i+1..n {
                if s[i][(j + k) % n] as u32 != s[j][(i + k) % n] as u32 {
                    continue 'outer;
                }
            }
        }
        ans += n;
    }
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
const ll INF = 1e18;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n, S;
    cin >> n >> S;

    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    ll mod = 998244353;    
    vector<vector<ll> > dp(n+1, vector<ll>(S+1, 0));
    dp[0][0] = 1;

    rep(i, n) {

        rep(j, S+1) {
            // 選ばない
            dp[i+1][j] += dp[i][j] * 2;
            dp[i+1][j] %= mod;

            //　選ぶ
            if (j-A[i] >= 0) {
                dp[i+1][j] += dp[i][j-A[i]];
                dp[i+1][j] %= mod;
            }
        }
    }

    ll res = dp[n][S];
    put(res);

}
signed main(){ Main();return 0;}

Measured memory_bytes: 73692
N, M = map(int, input().split())
mod = 10 ** 9 + 7
A = [1] * (N+1)
for i in range(M):
  A[int(input())] = 0
if N == 1:
  print(1)
else:
  p = 1
  q = 1
  for i in range(2, N+1):
    r = A[i-2] * p + A[i-1] * q
    p = q
    q = r % mod
  print(q)

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!
// 最小公倍数
// 最小公倍数
template <class INT_T>
INT_T ___gcd(INT_T a, INT_T b){
    if(a<b) swap(a,b);
    if(a%b==0) return b;
    return ___gcd(a%b,b);
}
template <class INT_T>
INT_T lcm(INT_T a, INT_T b){
    return a/___gcd(a,b)*b;
}
//


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  ll a, b;
  cin >> a >> b;
  cout << lcm(a,b) << endl;
  return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)

//your code here!

int main(void){
    double W, H, x, y;
    scanf("%lf %lf %lf %lf", &W, &H, &x, &y);
    printf("%.10f %d\n", W*H/2, x==W/2&&y==H/2);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll n,m;
    cin>>n>>m;
    if(n==1LL||m==1LL){
        cout<<1<<endl;
        return 0;
    }
    if((n*m)&1LL){

        cout<<(n*m)/2LL+1LL<<endl;
    }else{
        cout<<(n*m)/2LL<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

#define PI 3.14159265

int main(){
	double a, b, x; cin >> a >> b >> x;
	double s = a * a * b;
	cout << fixed << setprecision(6);
	if (x <= s / 2) cout << 90 - atan(x / (a * b * b) * 2) * 180.0 / PI << '\n';
	else cout << atan((s - x)/(a * a * a / 2)) * 180.0 / PI << '\n';
}


Measured memory_bytes: 512
//2019.3.23 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define RG register
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read(){
    res s=0,w=1,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s*w;
}
inline void swap(res &x,res &y){
    x^=y^=x^=y;
}
namespace MAIN{
    char str[10];
    inline void MAIN(){
        scanf("%s",str);
        if(str[0]=='A')puts("T");
        else if(str[0]=='T')puts("A");
        else if(str[0]=='C')puts("G");
        else puts("C");
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

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

#define pb push_back

struct edge
{
	int to,fr,val;
	bool operator < (const edge& that) const
	{
		return this->val < that.val;
	}
	edge(int _to,int _fr,int _val):to(_to),fr(_fr),val(_val){}
};

int N;
int in[100010][2];
int a[100010];
vector<edge> e;

bool cmpx(int aa,int bb)
{
	return in[aa][0]<in[bb][0];
}
bool cmpy(int aa,int bb)
{
	return in[aa][1]<in[bb][1];
}

int father[100010];
int FIND(int aa)
{
	if(father[aa]!=aa) father[aa]=FIND(father[aa]);
	return father[aa];
}

int main()
{
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%d%d",&in[i][0],&in[i][1]);
	
	for(int i=1;i<=N;i++) a[i]=i;
	sort(a+1,a+1+N,cmpx);
	for(int i=1;i<N;i++) e.pb(edge(a[i],a[i+1],in[a[i+1]][0]-in[a[i]][0]));
	sort(a+1,a+1+N,cmpy);
	for(int i=1;i<N;i++) e.pb(edge(a[i],a[i+1],in[a[i+1]][1]-in[a[i]][1]));
	
	sort(e.begin(),e.end());
	
	for(int i=1;i<=N;i++) father[i]=i;
	int ans=0;
	for(int i=0;i<e.size();i++)
	{
		int& aa=e[i].to;
		int& bb=e[i].fr;
		int& vv=e[i].val;
		int ra=FIND(aa);
		int rb=FIND(bb);
		if(ra!=rb)
		{
			father[ra]=rb;
			ans+=vv;
		}
	}
	cout<<ans;
	return 0;
}


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

int main() {
	
	int n, k; cin >> n >> k;	
	vector<int> accum(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		int p; cin >> p;
		accum[i] += p + 1;
		accum[i] += accum[i - 1];
	}
	int ans = 0;
	for (int i = 1; i <= n - k + 1; i++) {
		int tmp = accum[i + k - 1] - accum[i - 1];
		ans = max(ans, tmp);
	}
	cout << fixed << setprecision(11) << (double)ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
m = int(input())
targets = list(map(int, input().split()))
points = [0] * n
for i in range(m):
  lst = list(map(int, input().split()))
  target = targets[i]
  cnt = 0
  for i, p in enumerate(lst):
    if p == target:
      points[i] += 1
      cnt += 1
  points[target - 1] += (n - cnt)
print(*points, sep="\n")


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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


int main(void){
  ios::sync_with_stdio(false);

  int A, B, C;
  cin >> A >> B >> C;
  cout << C <<  ' ' << A <<  ' ' << B << endl;



  return 0;
}



Measured memory_bytes: 256
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;
const int N = 201;

int s[200];
ll f[N], fr[N];

ll binpow(ll a, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            (res *= a) %= mod;
        }
        (a *= a) %= mod;
        p >>= 1;
    }
    return res;
}

ll cnk(int n, int k) {
    return f[n] * fr[k] % mod * fr[n - k] % mod;
}

int mp[201][100005];

int solve(int x, int pref) {
    if (pref == 0) {
        return x;
    }
    if (mp[pref][x] != -1) {
        return mp[pref][x];
    }
    ll res = 0;
    for (int i = 0; i < pref; i++) {
        (res += solve(x % s[i], i) * cnk(pref - 1, i) % mod * f[pref - i - 1]) %= mod;
    }
    return mp[pref][x] = res;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, x;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        fill(mp[i + 1], mp[i + 1] + x + 1, -1);
    }
    f[0] = fr[0] = 1;
    for (int i = 1; i <= n; i++) {
        f[i] = (f[i - 1] * i) % mod;
        fr[i] = binpow(f[i], mod - 2);
    }
    sort(s, s + n);
    cout << solve(x, n);
    return 0;  
}

Measured memory_bytes: 78464
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define rep2(i,a,n) for (int i = a; i < n; i++)
using namespace std;
int N;
int main() {
    cin >> N;
    int ans = 0;
    int div = 8;
    rep2(i,1, N+1) {
        if(i % 2 == 0) continue;
        int num = 0;
        rep2(j,1,i+1) {

            if(i % j == 0) num++;
        }
        if(num == div) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll INF = 1LL << 61;
const int MAX_N = 15;
int N;
ll X[MAX_N], Y[MAX_N], P[MAX_N];

ll ans[MAX_N];
ll dp[1 << MAX_N][MAX_N + 1];

ll memo[1 << MAX_N];
ll cost(const int s) {
  if (memo[s] != -1) return memo[s];
  ll res = INF;

  {
    vector<pair<ll, ll>> v;
    REP(i, N) if (s >> i & 1) v.push_back({X[i], P[i]});
    sort(ALL(v));
    int a = 0, b = v.size() - 1;
    while (a < b) {
      if (v[a].second <= v[b].second) {
        v[b].second -= v[a].second;
        a++;
      } else {
        v[a].second -= v[b].second;
        b--;
      }
    }
    ll line = v[a].first;
    ll val = 0;
    REP(i, N) if (s >> i & 1) val += P[i] * abs(X[i] - line);
    chmin(res, val);
  }
  {
    vector<pair<ll, ll>> v;
    REP(i, N) if (s >> i & 1) v.push_back({Y[i], P[i]});
    sort(ALL(v));
    int a = 0, b = v.size() - 1;
    while (a < b) {
      if (v[a].second <= v[b].second) {
        v[b].second -= v[a].second;
        a++;
      } else {
        v[a].second -= v[b].second;
        b--;
      }
    }
    ll line = v[a].first;
    ll val = 0;
    REP(i, N) if (s >> i & 1) val += P[i] * abs(Y[i] - line);
    chmin(res, val);
  }

  return memo[s] = res;
}


int main2() {
  CLR(dp, -1);
  CLR(memo, -1);

  N = nextLong();
  REP(i, N) {
    X[i] = nextLong();
    Y[i] = nextLong();
    P[i] = nextLong();
  }

  REP(s, 1<<N) REP(k, N+1) dp[s][k] = INF;

  REP(s, 1<<N) {
    ll val = 0;
    REP(i, N) if (s >> i & 1) {
      val += P[i] * min(abs(X[i]), abs(Y[i]));
    }
    dp[s][0] = val;
  }

  for (int k = 1; k <= N; k++) {
    for (int s = 1; s < (1 << N); s++) {
      for (int t = s; t != 0; t = (t-1)&s) {
        chmin(dp[s][k], dp[s-t][k-1] + cost(t));
      }
    }
  }

  REP(i, N+1) ans[i] = INF;
  REP(k, N+1) chmin(ans[k], dp[(1<<N)-1][k]);
  REP(i, N+1)
    cout << ans[i] << endl;

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

int main(){
    int n; cin >> n;
    vector <string> s;
    for (int i = 0; i < n; i ++){
        string _s; cin >> _s;
        sort(_s.begin(), _s.end());
        s.push_back(_s);
    }
    sort(s.begin(), s.end());
    //for (auto c: s) cout << c << endl;

    int b = 0;
    int e = b + 1;
    long long ans = 0;
    long long cnt = 1;
    while(1){
        if (s[b] != s[e]){
            b = e;
            e = b + 1;
            ans += cnt * (cnt - 1) / 2;
            cnt = 1;
            if (e >= n){
                break;
            }    
        }
        else{
            cnt += 1;
            e += 1;
            //cout << cnt << endl;
            if (e >= n) {
                ans += cnt * (cnt - 1) / 2;
                break;
            }
        }
    }
    cout << ans << endl;
}

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


int main()
{
    string order;
    cin >> order;
    cout << 700 + 100 * count(ALL(order), 'o') << endl;
    return 0;
}

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

using namespace std;

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

  int n, x;
  cin >> n;
  vector<pair<int, int>> X(n);
  for (int i = 0; i < n; ++i) {
    cin >> x;
    X[i] = {x, i};
  }
  sort(X.begin(), X.end(), [&](pair<int, int> a, pair<int,int> b) {return a.first<b.first;});

  vector<int> Y(n, 0);
  int med = n/2-1;
  for (int i = 0; i < n; ++i) 
      Y[X[i].second] = X[med+(i<=med)].first;

  for (auto &y : Y) 
    cout << y << endl;

  return 0;
}



Measured memory_bytes: 4608
# Counting Characters
import sys

charList = list('abcdefghijklmnopqrstuvwxyz')
lines = sys.stdin.readlines()
combinedLine = ""
for line in lines:
    line = line.strip("\n").lower()
    combinedLine += line
totalSentence = list(combinedLine)
# print(totalSentence)

for char in charList:
    count = 0
    for i in range(len(totalSentence)):
        if totalSentence[i] == char:
            count += 1
    print(char + ' : ' + str(count))



Measured memory_bytes: 5568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  ll X,Y,A,B,C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> p(A),q(B),r(C);
  for(int i=0;i<A;++i) cin >> p[i];
  for(int i=0;i<B;++i) cin >> q[i];
  for(int i=0;i<C;++i) cin >> r[i];
  sort(p.begin(),p.end(),greater<ll>());
  sort(q.begin(),q.end(),greater<ll>());
  priority_queue<ll, vector<ll>, greater<ll>> Q1;
  priority_queue<ll, vector<ll>, greater<ll>> Q2;
 
  for(int i=0;i<X;++i){
    Q1.push(p[i]);
  }
  for(int i=0;i<Y;++i){
    Q2.push(q[i]);
  }
 
  for(ll i=0;i<C;++i){
    ll q1 = Q1.top();
    ll q2 = Q2.top();
    if(q1 <= q2){
      if(q1 <= r[i]){ 
        Q1.pop();
        Q1.push(r[i]);
      }
    }
    else{
      if(q2 <= r[i]){
        Q2.pop();
        Q2.push(r[i]);
      }
    }
  }
  ll ans=0;
  for(int i=0;i<X;++i){
    ans += Q1.top();
    Q1.pop();
  }
  for(int i=0;i<Y;++i){    
    ans += Q2.top();;
    Q2.pop();
  }
  cout << ans << endl;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int n;
	cin >> n;
	vector<int> vec;
	vec.resize(n, 0);

	rep(i, n - 1){
		int x;
		cin >> x;
		vec[x - 1]++;
	}

	rep(i, n){
		cout << vec[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 4016
#include "bits/stdc++.h"
using namespace std;
long long a[1<<16],f[1<<16],tmp;
int b[1<<16];
int lowbit(int x)
{
    return x&(-x);
}
int main()
{
    int n;
    int i,j;
    int x,y,z,p,q;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
	for(j=1;j<=n;j++)
	{
	    scanf("%lld",&tmp);
	    q=(1<<(n-i))+(1<<(n-j));
	    a[q]=tmp;
	}
	b[1<<(n-i)]=i;
    }
    for(i=1;i<(1<<n);i++)
    {
	if(a[i])
	{
	    continue;
	}
        x=lowbit(i);
	y=b[x];
	z=x^i;
        a[i]=a[z];
	while(z)
	{
	    p=lowbit(z);
	    q=(1<<(n-y))+(1<<(n-b[p]));
	    a[i]+=a[q];
	    z-=p;
	}		 
    }
    for(i=0;i<(1<<n);i++)
    {
	for(j=i;j;j=(j-1)&i)
	{
	    f[i]=max(f[i],a[j]+f[j^i]);
	}
    }
    printf("%lld\n",f[(1<<n)-1]);
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int a[55],b[55];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)	cin>>a[i],b[i]=a[i];
	sort(a,a+n);
	int flag=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]!=b[i])
			flag++;
	}
	if(flag==2||flag==0)	puts("YES");
	else puts("NO");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    vector<int> v(3);
    REP(i,3) cin >> v[i];
    sort(ALL(v));
    OUT(v[0] * v[1] / 2)

    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11


int main()
{
    ll n; cin >> n;
    string ans = "";
    while(n != 0){
        n--;
        ans += ('a'+ n % 26);
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << endl;
}


Measured memory_bytes: 3624
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readint()
    S = readstr()
    ans = 0
    for i in range(1, N):
        x = set(S[:i])
        y = set(S[i:])
        ans = max(ans, len(x & y))

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;


public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			HashSet<String> dictionary = new HashSet<String>();
			int N = Integer.parseInt(br.readLine());
			for(int i=0;i<N;i++){
				String line = br.readLine();
				String[] temp = line.split(" ");
				String op = temp[0];
				String word = temp[1];
				switch(op){
				case "insert":
					dictionary.add(word);
					break;
				case "find":
					if(dictionary.contains(word)){
						System.out.println("yes");
					}else{						
						System.out.println("no");
					}
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 191364
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int ticket[4];
  REP(i,4){
      ticket[i] = S[i]-'0';
  }
  int sign[2] = {1,-1};
  string op = "+-";
  REP(i,2)REP(j,2)REP(k,2){
      if (ticket[0] + sign[i]*ticket[1] + sign[j]*ticket[2] + sign[k]*ticket[3] == 7){
          cout << ticket[0] << op[i] << ticket[1] << op[j] << ticket[2] << op[k] << ticket[3]<< "=7" << endl;
          return 0;
      }
  }
}


Measured memory_bytes: 256
import sys
f = sys.stdin

while True:
    n = float(f.readline())
    if n < 0:
        break
    output = bin(int(n))[2:].zfill(8) + '.'

    decimal = n - int(n)
    for i in range(4):
        decimal *= 2
        if 1 <= decimal:
            decimal -= 1
            output += '1'
        else:
            output += '0'
            
    if 1e-10 < decimal or 13 < len(output):
        print('NA')
    else:
        print(output)

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

int main()
{
    ll n,a,b,c;
    cin >> n >> a>> b;
    c=n%(a+b);
    n=n/(a+b);
    if(c>a)c=a;
    n = n*a+c;
    cout << n << endl;
}


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

int main() {
  int N; cin >> N;
  string S; cin >> S;

  bool isGood = true;
  if (N%2 == 0) {
    rep(i, N/2) {
      if (S[i] != S[i+N/2]) isGood = false;
    }
  } else {
    isGood = false;
  }

  if (isGood) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <numeric>
#include <cmath>
#include <iterator>

using namespace std;

#define pb push_back
#define sz size()
#define fs first
#define sc second

#define rep(i, a) for(int i=0;i<(int)(a);i++)
#define EQ(a, b) (abs((a)-(b)) < EPS)


typedef double D;
const D EPS = 1e-12;
const D INF = 1e+10;
typedef complex<D> P;

namespace std{
  bool operator<(const P &a, const P &b){
    return real(a) == real(b) ? imag(a) < imag(b): real(a) < real(b);
  }
}

double x[10];
double y[10];
double l[10];
int N;

double checked(const double X, const double Y){
  double h = INF;
  for(int i=0;i<N;i++){
    D a = (x[i]-X)*(x[i]-X) + (y[i]-Y)*(y[i]-Y);
    // cout << X << " " << Y << " " << a << " " << l[i]*l[i] << endl;
    // if(a > l[i]*l[i] - EPS){
    //   h = 0;
    //   break;
    // }q
    // cout << l[i]*l[i] << " " << a << " " << sqrt((l[i]*l[i]) - a) << endl;
    h = min(h, l[i]*l[i] - a);
  }
  return h;
}

double Ck(const double X){
  double miny = -100;
  double maxy =  100;
  for(int i=0;i<200;i++){
    double mid1 = (maxy - miny) / 3 + miny;
    double mid2 = maxy - (maxy - miny) / 3;
    //    cout << mid1 << " " << checked(X, mid1) << " " << mid2 << " " << checked(X, mid2) << endl;
    if(checked(X, mid1) > checked(X, mid2)){
      maxy = mid2;
    }else{
      miny = mid1;
    }
  }
  // cout << X << " " << miny << " " << checked(X, miny) << endl;
  return checked(X, miny);
}
  
int main(){
  while(cin >> N, N){
    rep(i, N){
      cin >> x[i] >> y[i] >> l[i];
    }

    double minx = -100;
    double maxx =  100;
    for(int i=0;i<200;i++){
      double mid1 = (maxx - minx) / 3 + minx;
      double mid2 = maxx - (maxx - minx) / 3;
      // cout << mid1 << " " << Ck(mid1) << " " << mid2 << " " << Ck(mid2) << endl;
      if(Ck(mid1) > Ck(mid2)){
	maxx = mid2;
      }else{
	minx = mid1;
      }
    }
    printf("%.10lf\n", sqrt(Ck(maxx)));
  }
  return 0;
}



Measured memory_bytes: 3148
#include <stdio.h>
#include <string.h>
#include <math.h>
 int main (){
	char A[100005],B[100005];
	scanf (" %s",&A);
	scanf (" %s",&B);
	double C=strlen(A),D=strlen(B);
	if(C>D){printf ("GREATER\n");return 0;}
	else if (C<D) {printf ("LESS\n");return 0;}
	else if (C==D){ for (int i=0;i<C;i++){
	if (A[i]>B[i]){printf("GREATER\n");return 0;}
	else if (A[i]<B[i]){printf("LESS\n");return 0;} 
	} }  if(strcmp(A,B)==0){
	printf ("EQUAL\n");}
	return 0;
	} 

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int H,W;
char m[501][501];
char red[501][501],blue[501][501];
int main(){
  scanf("%d %d",&H,&W);
  for(int i=0;i<H;i++)scanf("%s",&m[i]);
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(j==W-1)red[i][j]='.';
      else if(i%2==1 && j!=0)red[i][j]='.';
      else red[i][j]='#';
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
     if(j==0) blue[i][j]='.';
      else if(i%2==0 && j!=W-1)blue[i][j]='.';
      else blue[i][j]='#';
    }
  }
  
   for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if( m[i][j]=='#'){
	red[i][j]='#';
	blue[i][j]='#';
      }
    }
  }
  
  for(int i=0;i<H;i++)printf("%s\n",red[i]);
  printf("\n");
  for(int i=0;i<H;i++)printf("%s\n",blue[i]);
  printf("\n");
  return 0;
}


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

typedef long long ll;
ll val[26];
ll cnt[26];
void Initialize()
{
    for(int i=0;i<26;i++)
    {
        val[i]=INT_MAX;
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll t;
    cin>>t;
    Initialize();
    while(t--)
    {
        string str;
        cin>>str;
        memset(cnt,0,sizeof(cnt));
        for(auto c:str)
        {
            cnt[c-'a']++;
        }
        for(int i=0;i<26;i++)
        {
            val[i]=min(val[i],cnt[i]);
        }
    }
    for(int i=0;i<26;i++)
    {
        while(val[i])
        {
            printf("%c",i+'a');
            val[i]--;
        }
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val nums = readInputLine().split(" ").map { it.toInt() }.sortedDescending()
    val K = readInputLine().toInt()
    
    println(nums[0] * pow2(K) + nums[1] + nums[2])
}

fun readInputLine(): String {
    return readLine()!!
}

fun pow2(x: Int): Int {
    var tmp = 1
    for (i in 1..x) {
        tmp *= 2
    }
    return tmp
}


Measured memory_bytes: 36004
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
   int a,b;
   cin >> a >> b;
   cout << (a - (b * 2) < 0 ? 0 : (a - (b * 2)) )  << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

string solve(ll x){
    string sx = to_string(x);
    string re = "";
    for(ll i=0;i<6-sx.size();++i){
        re += "0";
    }
    re += sx;
    return re;
    //return to_string(x);
}

int main(){
    ll n, m;
    cin>>n>>m;
    vector<ll> p(m), y(m);
    vector<ll> c[n];
    for(ll i=0;i<m;++i){
        cin>>p[i]>>y[i];
        p[i]--;
        c[p[i]].push_back(y[i]);
    }

    for(ll i=0;i<n;++i){
        sort(c[i].begin(), c[i].end());
    }
    for(ll i=0;i<m;++i){
        string fir = solve(p[i]+1);
        ll flag = lower_bound(c[p[i]].begin(), c[p[i]].end(), y[i]) - c[p[i]].begin() + 1;
        string sec = solve(flag);
        string ans = fir + sec;
        cout<<ans<<endl;
    }

    //cout<<"check"<<endl;

    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

#define pb push_back
#define ff first
#define ss second
#define SIZE 500002
#define INF 2e9 + 9
#define acmpIN "input.txt"
#define acmpOUT "output.txt"

//#pragma GCC optimize("Ofast")
//

vector<int> lol = {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};

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen(acmpIN, "r", stdin);
//    freopen(acmpOUT, "w", stdout);

    int k;
    cin >> k;
    k--;
    cout << lol[k];

    return 0;
}



Measured memory_bytes: 256
N=int(input())
a=-1
for k in range(450):
  if N==k*(k-1)//2:
    a=k
    break
if a==-1:
  print("No")
  exit()
else:
  print("Yes")
List=[]
s=0
for i in range(a-1):
  List.append(list(range(1+s,a-i+s)))
  s=a-i+s-1
ans=[[] for i in range(a)]
for i in range(a):
  if i<a-1:
    for j in List[i]:
      ans[i].append(str(j))
  for k in range(i):
    ans[i].append(str(List[k][i-k-1]))
print(a)
for b in ans:
  print(str(a-1)+" "+" ".join(b))
  
    

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


int main(){
    int n;
    string s;
    cin>>n>>s;
    
    int ans = 0;
    rep(i,n-2){
        if(s[i]=='A'&&s[i+1]=='B' && s[i+2]=='C'){
            ans++;
        }
    }
    cout<< ans<< endl;
    
    
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC061A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, C;

            var word = Console.ReadLine().Split(' ');

            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            C = int.Parse(word[2]);

            if ((A <= C) && (B >= C))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();










        }
    }
}


Measured memory_bytes: 11220