akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 mod=1e9+7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(ll n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (ll i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (ll i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(ll n, ll k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(ll n, ll k) {
    return fact[n]*ifact[n-k];
  }
} c(1000005);

int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> x(n),y(m);
    mint sum_x=0,sum_y=0;
    rep(i,n){
        cin >> x[i];
        sum_x+=i*x[i]-(n-1-i)*x[i];
    }
    rep(i,m){
        cin >> y[i];
        sum_y+=i*y[i]-(m-1-i)*y[i];
    }
    mint ans=sum_x*sum_y;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20384
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int pasta, juice;
    int n;

    cin >> pasta;
    cin >> n;
    if (n < pasta)  pasta = n;
    cin >> n;
    if (n < pasta)  pasta = n;
    cin >> juice;
    cin >> n;
    if (n < juice)  juice = n;

    cout << pasta + juice - 50 << endl;

     
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define ll long long
using namespace std;

int x,a,b;

int main(){
  cin >> x>>a>>b;

  if((b-a)>x)cout << "dangerous"<<endl;
  else if(b<=a) cout << "delicious"<< endl;
  else cout << "safe"<<endl;
  
  return 0;
}


Measured memory_bytes: 256
function Main(input) {
  var s = new Set(input.split("\n")[0]);
  for (var i = "a".charCodeAt(0); i <= "z".charCodeAt(0);i++) {
    if(!s.has(String.fromCharCode(i))) {
      console.log(String.fromCharCode(i));
      return;
    }
  }
  console.log("None");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 14508
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;
int K,X,Y,i,j,n,x,y;
bool xflip,yflip,xyswap;
vector<p> def;
void pushdef(int x,int y) {
    if(xyswap)swap(x,y);
    if(xflip)x*=-1;
    if(yflip)y*=-1;
    def.push_back(p(x, y));
}
main(){
    cin>>K>>X>>Y;
    if(X<0)xflip=true,X*=-1;
    if(Y<0)yflip=true,Y*=-1;
    if(X>Y)xyswap=true,swap(X,Y);
    if(X+Y&~K&1){cout<<-1;exit(0);}
    if(X+Y<K&&X+Y&1){
        pushdef(X,-K+X);
        pushdef((K+X-Y)/2,K-(K+X-Y)/2);
        pushdef(-(K+X-Y)/2,K-(K+X-Y)/2);
    }else{
        int U=X+Y,V=-X+Y-K;
        U-=U%K;
        if(X+Y<K||K&1&&((X+Y)/K&1)==(X+Y&1))U+=K;
        int a=(U-V)/2,b=(U+V)/2;
        if((X+Y)%K!=0)pushdef(X-a,Y-b),X=a,Y=b;
        for(;i<X/K;i++)pushdef(K,0);
        for(;j<Y/K;j++)pushdef(0,K);
        if(X%K!=0)pushdef(X%K,Y%K);
    }
    cout<<def.size()<<" ";
    for(n=0;n<def.size();n++)x+=def[n].first,y+=def[n].second,cout<<x<<" "<<y<<" ";
}


Measured memory_bytes: 3952
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

import bisect
a.sort()
b.sort()
c.sort(reverse=True)
c = [-x for x in c]

ans = 0
for x in b:
    ans += bisect.bisect_left(a, x) * (bisect.bisect_left(c, -x))

print(ans)

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int j = 0;

	for (int i = max(A, B); i > 0; i--) {
		if (A % i == 0 && B % i == 0)
			j++;
		if (j == K) {
			cout << i << endl;
			break;
		}
	}
}

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

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int cap_alphabet_pos(const char c){
  if('A' <= c && c <= 'Z') return (c-'A'+1);
  return -1;
}

int alphabet_pos(const char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}

int main() {
    string s;
    int i, sum, count[27];

    for(i=0;i<27;i++){
        count[i]=0;
    }

    getline(cin, s);

while(s!=""){

    for(i=0;i<s.size();i++){
        if('A' <= s[i] && s[i] <= 'Z'){
            count[s[i]-'A'+1]++;
        }else if('a' <= s[i] && s[i] <= 'z'){
            count[s[i]-'a'+1]++;
        }
    }

    getline(cin, s);
}

    for(i=1;i<27;i++){
        cout << (char)('a' + i -1) << " : " << count[i] << endl;
    }

    return 0;
}



Measured memory_bytes: 3220
n, x, y = gets.split.map(&:to_i)
x -= 1
y -= 1
ans = Hash.new(0)
n.times do |s|
  bfs_map = Array.new(n, 2000)
  bfs_map[s] = 0
  q = [[s, 0]]
  until q.empty?
    v, d = q.shift
    if v != n - 1 && bfs_map[v + 1] > d + 1
      bfs_map[v + 1] = d + 1
      q << [v + 1, d + 1]
    end
    if v != 0 && bfs_map[v - 1] > d + 1
      bfs_map[v - 1] = d + 1
      q << [v - 1, d + 1]
    end
    if v == x && bfs_map[y] > d + 1
      bfs_map[y] = d + 1
      q << [y, d + 1]
    end
    if v == y && bfs_map[x] > d + 1
      bfs_map[x] = d + 1
      q << [x, d + 1]
    end
  end
  bfs_map.each do |d|
    ans[d] += 1
  end
end

1.upto(n - 1) do |k|
  p ans[k] / 2
end


Measured memory_bytes: 2556
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int a[][]=new int[4][13];
		
		int n=scan.nextInt();
		int i,j;
		for(i=0;i<n;i++){
			String mark=scan.next();
			int num=scan.nextInt();
			
			if(mark.equals("S")){
				a[0][num-1]=1;
			}
		    if(mark.equals("H")){
				a[1][num-1]=1;
			}
			if(mark.equals("C")){
				a[2][num-1]=1;
			}
			if(mark.equals("D")){
				a[3][num-1]=1;
			}
		}
		
		for(i=0;i<4;i++){
			for(j=0;j<13;j++){
				if(a[i][j]!=1){
					switch(i){
						case 0:System.out.printf("S %d\n",j+1);break;
						case 1:System.out.printf("H %d\n",j+1);break;
						case 2:System.out.printf("C %d\n",j+1);break;
						case 3:System.out.printf("D %d\n",j+1);break;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(l,k,h) for(int l = k; l <= h; ++l)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;



int main() {
    ll x,y;
    cin >> x >> y;
    ll res = x;
    ll ans = 0;
    while(x <= res && res <= y) {
        res *= 2;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main (){
	int g;
	char c[101];
	scanf("%d ", &g);
	scanf("%s", c);
	int len = strlen(c);
	if (len <= g) {
		printf("%s\n",c);
	}
	else{
		for (int i = 0; i < g; i++){
			printf("%c", c[i]);
		}
		printf("...\n");
	}
	return 0;
}

Measured memory_bytes: 1620
using System;

namespace ITP1_7_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int m, f, r;
            while(true)
            {
                string[] str = Console.ReadLine().Split(' ');
                m = int.Parse(str[0]);
                f = int.Parse(str[1]);
                r = int.Parse(str[2]);
                if ((m == -1) && (f == -1) && (r == -1))
                    break;

                if ((m == -1) || (f == -1))
                    Console.WriteLine("F");
                else if ((m + f) >= 80)
                    Console.WriteLine("A");
                else if ((m + f) >= 65)
                    Console.WriteLine("B");
                else if ((m + f) >= 50)
                    Console.WriteLine("C");
                else if ((m + f) >= 30)
                    if (r >= 50)
                        Console.WriteLine("C");
                    else
                        Console.WriteLine("D");
                else
                    Console.WriteLine("F");
            }
        }
    }
}

Measured memory_bytes: 5304
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s;
    int q;
    bool flag = true;

    cin >> s >> q;

    deque<char> sdq(s.size());

    for (int i = 0; i < s.size(); i++)
    {
        sdq[i] = s[i];
    }

    for (int i = 0; i < q; i++)
    {
        int t;
        cin >> t;

        if (t == 1)
        {
            flag = !flag;
        }
        else
        {
            int f;
            char c;

            cin >> f >> c;

            if (f == 1)
            {
                if (flag)
                {
                    sdq.push_front(c);
                }
                else
                {
                    sdq.push_back(c);
                }
            }
            else
            {
                if (!flag)
                {
                    sdq.push_front(c);
                }
                else
                {
                    sdq.push_back(c);
                }
            }
        }
    }

    if (flag)
    {
        for (int i = 0; i < sdq.size(); i++)
        {
            printf("%c", sdq[i]);
        }
    }
    else
    {
        for (int i = sdq.size() - 1; i >= 0; i--)
        {
            printf("%c", sdq[i]);
        }
    }

    printf("\n");
}

Measured memory_bytes: 1024
from collections import Counter

def resolve():
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	c = Counter(a)
	lc = len(c.keys())
	if lc > k:
		v = 0
		sc = sorted(c.values())
		for i in range(lc-k):
			v += sc[i]
		print(v)
	else:
		print(0)
resolve()

Measured memory_bytes: 98896
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
	char c;
	cin >> c;

	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 3644
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void) {

	string s;

	cin >> s;

	bool cjud = false, fjud = true;

	for (int i = 0; i < s.size(); i++)
	{
		if (i == 0) {
			if (s[i] != 'A') {
				fjud = false;
				break;
			}
		}
		else if (cjud == false && i >= 2 && i <= s.size() - 2)
		{
			if (s[i] == 'C')cjud = true;
		}
		else {
			if (s[i] < 97 || s[i]>122) {
				fjud = false;
				break;
			}
		}
	}

	if (fjud&&cjud)
	{
		cout << "AC\n";
	}
	else
	{
		cout << "WA\n";
	}

	return 0;
}

Measured memory_bytes: 256
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


def solve():
    pass

def main():
    n = int(input().strip())
    ans = pow(10,n,mod) - 2*pow(9,n,mod) + pow(8,n,mod)
    ans = ans % mod
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 78352
#include <map>
#include <iostream>
#include <cmath>
using namespace std;

string near(int R, int G, int B);

double dist(int R1, int G1, int B1, int R2, int G2, int B2);

int main(void){
  map<char,int> d;
  for(int i=0;i<10;i++){
    d[i+'0']=i;
  }
  for(int i=0;i<6;i++){
    d[i+'a']=i+10;
  }
  string s;
  int R,G,B;
  while(1){
    cin>>s;
    if(s=="0")break;
    R=d[s[1]]*16+d[s[2]];
    G=d[s[3]]*16+d[s[4]];
    B=d[s[5]]*16+d[s[6]];
    cout<<near(R,G,B)<<endl;
  }
  return 0;
}

string near(int R, int G, int B){
  double distance=10000;
  string color="hoge";
  if(dist(R,G,B,0,0,0)<distance){
    color="black";
    distance=dist(R,G,B,0,0,0);
  }
  if(dist(R,G,B,0,0,255)<distance){
    color="blue";
    distance=dist(R,G,B,0,0,255);
  }
  if(dist(R,G,B,0,255,0)<distance){
    color="lime";
    distance=dist(R,G,B,0,255,0);
  }
  if(dist(R,G,B,0,255,255)<distance){
    color="aqua";
    distance=dist(R,G,B,0,255,255);
  }
  if(dist(R,G,B,255,0,0)<distance){
    color="red";
    distance=dist(R,G,B,255,0,0);
  }
  if(dist(R,G,B,255,0,255)<distance){
    color="fuchsia";
    distance=dist(R,G,B,255,0,255);
  }
  if(dist(R,G,B,255,255,0)<distance){
    color="yellow";
    distance=dist(R,G,B,255,255,0);
  }
  if(dist(R,G,B,255,255,255)<distance){
    color="white";
    distance=dist(R,G,B,255,255,255);
  }
  return color;
}

double dist(int R1, int G1, int B1, int R2, int G2, int B2){
  return sqrt((R1-R2)*(R1-R2)+(G1-G2)*(G1-G2)+(B1-B2)*(B1-B2));
}



Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;

//can use O(K) memory actually

int T, n, k;
const int maxn = 100000+5;
const ll INF = 1000000000+5;
ll h[maxn];
ll dp[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for(int i = 1; i <= n ; i++) {cin >> h[i]; dp[i] = INF;}
	dp[1] = 0LL;
	for(int i = 2; i <= n ; i++)for(int j = max(1, i-k); j < i; j++)
		dp[i]=min(dp[i], dp[j]+abs(h[i]-h[j]));
	cout << dp[n];
	return 0;
}


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

struct edge {
    int to, cost;
};

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

    vector<vector<edge>> G(n);

    rep(i, n - 1) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        w %= 2;
        G[a].push_back({b, w});
        G[b].push_back({a, w});
    }

    vector<int> ans(n, -1);
    queue<int> que;
    que.push(0);

    ans[0] = 0;
    while (!que.empty()) {
        int now = que.front();
        que.pop();

        rep(i, G[now].size()) {
            int to = G[now][i].to;
            int cost = G[now][i].cost;

            if (ans[to] != -1)
                continue;

            ans[to] = (ans[now] + cost) % 2;
            que.push(to);
        }
    }

    for (int &a : ans)
        cout << a << "\n";

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  i64 ans = 0;
  int n;
  cin >> n;
  unordered_map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    sort(all(s));
    mp[s]++;
  }
  each(m, mp) {
    ans += (i64) m.second * (m.second - 1) / 2;
  }
  cout << ans << endl;
}


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

typedef int64_t i64;
typedef uint64_t ui64;

class graph{
public:
    struct adj{
        int index;
        int start;
        int to;
        i64 cost;
    };
    int nd;
    int eg;
    vector<adj> *node;
    vector<adj> edge;
    graph(int n,int m){
        nd=n;
        eg=m;
        node=new vector<adj>[nd]{};
        edge={};
    }
    void add_dir(int i,int s,int t,i64 c){
        node[s].push_back({i,s,t,c});
        edge.push_back({i,s,t,c});
    }
    void add_undir(int i,int s,int t,i64 c){
        node[s].push_back({i,s,t,c});
        node[t].push_back({i,t,s,c});
        edge.push_back({i,s,t,c});
    }
    void refr(void){
        for(int i=0;i<nd;i++) vector<adj>().swap(node[i]);
        delete[] node;
        vector<adj>().swap(edge);
    }
    bool IsLink(void);
    void DFS(int r,i64 *&p,bool *&vst);
    bool IsPlus(void);
    void BellmanFord(int s,i64 *&d);
    void Dijkstra(int s,i64 *&d);
    void BFS(int s,i64 *&d);
    void WarshallFloyd_dir(i64 **&d);
    void WarshallFloyd_undir(i64 **&d);
    i64 WMST_dir(int r);
    i64 WMST_undir(void);
    void Edmonds(int r,vector<adj> &p);
    void Kruscal(vector<adj> &p);
    void Prim(vector<adj> &p);
    void Artic(vector<int> &p);
    void Artic_sub(int r,int &k,int par,vector<int> &p,int *&ord,int *&low,bool *&vst);
    void Bridge(vector<adj> &p);
    void Bridge_sub(int r,int &k,int par,vector<adj> &p,int *&ord,int *&low,bool *&vst);
    void Cumul(int s,i64 *&d);
};

void graph::Artic(vector<int> &p){
    int *ord=new int[nd]{};
    int *low=new int[nd]{};
    bool *vst=new bool[nd]{};
    int k=0;
    Artic_sub(0,k,-1,p,ord,low,vst);
    delete[] ord;
    delete[] low;
    delete[] vst;
}

void graph::Artic_sub(int r,int &k,int par,vector<int> &p,int *&ord,int *&low,bool *&vst){
    vst[r]=1;
    ord[r]=low[r]=k;
    k++;
    bool isartic=0;
    int cnt=0;
    for(const auto &i:node[r]){
        if(!vst[i.to]){
            cnt++;
            Artic_sub(i.to,k,r,p,ord,low,vst);
            low[r]=min(low[r],low[i.to]);
            isartic=(isartic || (~par && low[i.to]>=ord[r]));
        }
        else if(i.to!=par){
            low[r]=min(low[r],ord[i.to]);
        }
    }
    isartic=(isartic || (par==-1 && cnt>1));
    if(isartic) p.push_back(r);
}

int main(void){
    int v,e;
    scanf("%i%i",&v,&e);
    graph g(v,e);
    int s,t;
    for(int i=0;i<e;i++){
        scanf("%i%i",&s,&t);
        g.add_undir(i,s,t,1);
    }
    vector<int> p;
    g.Artic(p);
    sort(p.begin(),p.end());
    for(const auto &i:p) printf("%i\n",i);
    return 0;
}



Measured memory_bytes: 8920
#include <bits/stdc++.h>
typedef long long ll;
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define Fd(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;

struct word
{
        int ind;
        int len;
        int W;
};

char S[10004];
vector<word> V;
int P[5];

bool cmp(word a,word b);
void create_words(int v,int n);

 int main()
 {
        scanf("%s",(S+1));
        int n=strlen(S+1);
        int k;
        scanf("%d",&k);

        P[0]=1;
        F(i,1,4) P[i]=P[i-1]*27;

        F(i,1,n) create_words(i,n);
        sort(V.begin(),V.end(),cmp);

        //for(auto z : V) printf("(%d %d %d)\n",z.ind,z.len,z.W);

        if(k==1) 
        {
                F(i,V[0].ind,V[0].ind+V[0].len-1) printf("%c",S[i]);
                printf("\n");
                return 0;
        }

        int il=1;
        F(i,1,(int)V.size())
        {
                if(V[i].W!=V[i-1].W) il+=1;
                if(il==k)
                {
                        F(j,V[i].ind,V[i].ind+V[i].len-1) printf("%c",S[j]);
                        printf("\n");
                        return 0;       
                }
        }
 }
//////
 void create_words(int v,int n)
 {
        word tmp;
        tmp.ind=v;
        tmp.W=0;
        F(i,1,min(5,n-v+1))
        {
               tmp.len=i;
               tmp.W+=((S[v+i-1]-'a'+1)*P[5-i]);
               V.push_back(tmp);
        }
 }
//////
 bool cmp(word a,word b)
 {
        return a.W<b.W;
 }

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

int64_t next(int64_t x){
  string y=to_string(x);
  int k=y.size();
  for(int i=0;i<k;i++){
    
    if(y.at(k-i-1)=='3'){
      y.at(k-i-1)='5';
      int j=k-i;
      while(j<=k-1){
        y.at(j)='3';
        j++;
      }
      return stol(y);
    }
    if(y.at(k-i-1)=='5'){
      y.at(k-i-1)='7'; 
      int j=k-i;
      while(j<=k-1){
        y.at(j)='3';
        j++;
      }
      return stol(y);
    }
  }
  for(int i=0;i<y.size();i++) y.at(i)='3';
  y=y+'3';
  return stol(y);
}
  
int main(){
  
  int64_t n;
  cin >> n;
  
  int64_t a=357;
  string b;
  map<char,int> cot;
  int ans=0;
 
  while(a<=n){
    cot['3']=0; cot['5']=0; cot['7']=0;
    b=to_string(a);
    
    for(int i=0;i<b.size();i++){
      cot[b.at(i)]++;
    }
    
    if(cot['3']>0 && cot['5']>0 && cot['7']>0) ans++;
     a=next(a);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#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()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int H, A; cin >> H >> A;
    if (H % A == 0){
        cout << H / A << endl;
    }
    else {
        cout << H / A + 1 << endl;
    }
}

Measured memory_bytes: 3616
#include <algorithm>
#include <cmath>
#include <ctype.h>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long double ld;

int vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance(vec.begin(), itr);
    if(index != vec.size()) { // 発見できたとき
        return 1;
    } else { // 発見できなかったとき
        return 0;
    }
}
struct hoge_t {
    bool operator<(const hoge_t &shop) const { return true; }
};

int N, M, K, s;
int i, j, k;
int num = 0;

vvi switches;
vi memo, p;

void knapsack(int cur) {
    if(cur == N) {
        //全部点灯していればインクリメント
        bool flag = true;
        REP(i, M) {
            if(memo[i] % 2 != p[i]) {
                flag = false;
                break;
            }
        }
        if(flag)
            num++;
        return;
    }
    //オフの時
    knapsack(cur + 1);
    for(int lamp : switches[cur]) {
        memo[lamp] = memo[lamp] + 1;
    }
    //オンの時
    knapsack(cur + 1);
    for(int lamp : switches[cur]) {
        memo[lamp] = memo[lamp] - 1;
    }
}

int main() {

    cin >> N >> M;

    switches = vvi(N);
    p = vi(M);
    memo = vi(M);


    //すべての電球に対して対象のスイッチに追加する
    REP(i, M) {
        cin >> K;
        REP(j, K) {
            cin >> s;
            switches[s-1].push_back(i);
        }
    }


    REP(i, M) cin >> p[i];

    knapsack(0);

    cout << num << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int add_x = x2 - x1, add_y = y2 - y1;
  int x4 = x1 - add_y, y4 = y1 + add_x;
  int x3 = x4 + add_x, y3 = y4 + add_y;
  cout << x3 << " " << y3 << " "
       << " " << x4 << " " << y4;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
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;}
int M,D;
int main(){
	cin >> M >> D;
	int ans = 0;
	for(int i=1;i<=M;i++){
		for(int j=1;j<=D;j++){
			int a = j/10;
			int b = j%10;
			if(a<2||b<2)continue;
			if(i==a*b)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m,ans=0;
  cin >> n >> m;
  long long x[m],sub[m-1];
  for(int i=0;i<m;i++){
    cin >> x[i];
  }
  sort(x,x+m);
  for(int i=0;i<m-1;i++){
    sub[i]=abs(x[i+1]-x[i]);
  }
  sort(sub,sub+m-1);
  for(int i=0;i<m-n;i++){
    ans+=sub[i];
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

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

const int N = 1e6 + 10;
char s[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", s);
  int cnt = 0;
  for (int i = 0, j; i < n; i = j) {
    for (j = i + 1; j < n && s[i] == s[j]; ++j);
    ++cnt;
  }
  cnt = max(1, cnt - 2 * m);
  printf("%d\n", n - cnt);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
ll n,m,v,p;
bool solve(ll k,vector<ll> vec){
  //cout << k << endl;
  tmp1 = v - p + 1 - (n-1-k);
  ll sum = 0;
  for(ll i = p-1;i <= k-1;i++){
    sum += (vec[i] - vec[k]);
  }
  //cout << sum << endl;
  if(sum <= (n-v) * m && vec[p-1] <= vec[k] + m){
    return true;
  }
  return false;
}
int main() {
  cin >> n >> m >> v >> p;
  vector<ll> vec(n);
  rep(i,n){
    cin >> vec[i];
  }
  sort(all(vec),greater<ll>());
  ll ans = 0;
  if(p >= v){
    rep(i,n){
      if(i <= p-1){
        ans++;
      }else{
        if(vec[p-1] <= vec[i] + m){
          ans++;
        }else{
          break;
        }
      }
    }
  }else{
    ll ok = 0;
    ll ng = n;
    while(abs(ok-ng) > 1){
      ll mid = (ok + ng) / 2;
      if(solve(mid,vec)){
        ok = mid;
      }else{
        ng = mid;
      }
    }
    ans = ok+1;

  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

bool used[300005];

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

    int n;
    cin >> n;
    vector<int> a(n * 3);
    vector<ll> sum(n * 3 + 1);
    sum[0] = 0;
    for(int i = 0; i < n * 3; ++i){
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    ll lsum = sum[n], rsum = sum[n * 3] - sum[n];
    priority_queue<int, vector<int>, greater<int>> left;
    for(int i = 0; i < n; ++i)  left.push(a[i]);
    priority_queue<P> right;
    for(int i = n; i < n * 3; ++i){
        right.push(P(a[i], i));
        used[i] = true;
    }
    priority_queue<P, vector<P>, greater<P>> stock;
    for(int i = 0; i < n; ++i){
        P p = right.top();
        right.pop();
        rsum -= p.first;
        used[p.second] = false;
        stock.push(p);
    }
    ll ans = lsum - rsum;
    for(int i = n; i < n * 2; ++i){
        if(!used[i]){
            used[i] = true;
            if(a[i] > left.top()){
                lsum -= left.top();
                lsum += a[i];
                left.pop();
                left.push(a[i]);
            }
        }
        else{
            bool ok = false;
            P p;
            while(!ok){
                p = stock.top();
                stock.pop();
                if(!used[p.second]) ok = true;
            }
            rsum -= a[i];
            rsum += p.first;
            used[p.second] = true;
            if(a[i] > left.top()){
                lsum -= left.top();
                lsum += a[i];
                left.pop();
                left.push(a[i]);
            }
        }
        chmax(ans, lsum - rsum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 7792
#include <iostream>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
using T = tuple<double,double,double>;

double inner_cross(T u, T v){
    double ux,uy,uz,vx,vy,vz;
    tie(ux,uy,uz)=u;
    tie(vx,vy,vz)=v;
    return ux*vx+uy*vy+uz*vz;
}

bool isCross(T Center, double radius, T s, T t){
    double cx,cy,cz,sx,sy,sz,tx,ty,tz;
    tie(cx,cy,cz)=Center;
    tie(sx,sy,sz)=s;
    tie(tx,ty,tz)=t;
    T u(tx-sx,ty-sy,tz-sz), v(cx-sx,cy-sy,cz-sz);
    double d = inner_cross(u,v)/inner_cross(u,u);
    if(inner_cross(u,v)<0||inner_cross(u,v)>inner_cross(u,u)) return false;
    else{
        double ux,uy,uz,vx,vy,vz;
        tie(ux,uy,uz)=u;
        tie(vx,vy,vz)=v;
        T vert(vx-ux*d,vy-uy*d,vz-uz*d);
        if(inner_cross(vert,vert)<=radius*radius+1e-9){
            return true;
        }else{
            return false;
        }
    }
}

int main(){
    int N,Q;
    cin>>N>>Q;
    vector<T> Ob;
    vector<double> r(N);
    vector<int64_t> l(N);
    for(int i=0;i<N;i++){
        double x,y,z;
        cin>>x>>y>>z>>r[i]>>l[i];
        Ob.emplace_back(x,y,z);
    }
    for(int i=0;i<Q;i++){
        double sx,sy,sz,dx,dy,dz;
        cin>>sx>>sy>>sz>>dx>>dy>>dz;
        T s(sx,sy,sz), t(dx,dy,dz);
        int64_t cost = 0;
        for(int j=0;j<N;j++){
            if(isCross(Ob[j],r[j],s,t)) cost+=l[j];
        }
        cout<<cost<<endl;
    }

    return 0;
}

Measured memory_bytes: 3220
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */



int main() 
{
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll N;
	cin >> N;
	auto A = make_v(N - 1, 0);
	auto B = make_v(N - 1, 0);
	auto children = make_v(N + 1, 0, 0);
	auto ANS = make_v(N+1, -1);

	FOR(i, N - 1) {
		cin >> A[i] >> B[i];
		children[A[i]].push_back(B[i]);
		children[B[i]].push_back(A[i]);
	}

	auto C = make_v(N, 0);
	FOR(i, N)
		cin >> C[i];
	sort(ALL(C));
	
	auto sum = accumulate(ALL(C), 0);
	sum -= *prev(C.end());
	cout << sum << endl;

	queue<int> q; q.push(1);
	set<int> s;
	auto it = prev(C.end());
	while (!q.empty())
	{
		auto v = q.front(); q.pop();
		s.insert(v);
		ANS[v] = *it; if (it == C.begin()); else  it = prev(it);
		for (auto chilVal : children[v]) {
			if (s.count(chilVal)) continue;
			q.push(chilVal);
		}
		
	}
	FOR(i, N) {
		cout << ANS[i + 1] << " ";
	}cout << endl;


	return 0;
}


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

int main() {

  string S;
  cin >> S;

  int n = S.size();

  bool flg = 1;
  rep(i, n) {
	if (i%2 == 0) {
	  if (S[i] == 'L') {
		flg = 0;
		break;
	  }
	} else {
	  if (S[i] == 'R') {
		flg = 0;
		break;
	  }
	}
  }

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

  return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>
#define IS istream
#define OS ostream
#define OP operator

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT IS& OP>>(IS &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT IS& OP>>(IS &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, priority_queue<T> v) {while (!v.empty()) {O << v.top() << ' '; v.pop();} return O;}
TCT OS& OP<<(OS &O, stack<T> v) {while (!v.empty()) {O << v.top() << '\n'; v.pop();} return O;}
TCT OS& OP<<(OS &O, queue<T> v) {while (!v.empty()) {O << v.front() << ' '; v.pop();} return O;}
TCT12 IS& OP>>(IS &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 OS& OP<<(OS &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT12 OS& OP<<(OS &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 OS& OP<<(OS &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;





void _main() {
        int a, b; cin >> a >> b;
        cout << a * b / __gcd(a, b);
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 256
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

import math

N = int(input())
fact = factorization(N)
l = len(fact)
ans = 0
if N == 1:
    print(0)
else:
    for i in range(l):
        n = (math.sqrt(8*fact[i][1]+1) -1)//2
        ans += int(n)
    print(ans)


Measured memory_bytes: 63604
#include <stdio.h>

#define INF 1000000000

#define N_MAX 6000
int data[N_MAX];
int n_data;

int get_max(void)
{
    int i,j; 
    int max=-INF;
    for(i=0;i<n_data;i++){
        int sum=0;
        for(j=i;j<n_data;j++){
            sum+=data[j]; 
            if(max<sum){ max=sum; }
        }
    }
    return max;
}
//#define DEBUG
int main(void)
{
    FILE* fp;
#ifdef DEBUG
    fp=fopen("input.txt","r");
#else
    fp=stdin;
#endif
    
    while(1){
        int n;
        fscanf(fp,"%d\n",&n);
        if(n==0){ break; }
        n_data=n;
        int i; 
        for(i=0;i<n;i++){
            fscanf(fp,"%d\n",data+i);
        }
        printf("%d\n",get_max());
    }
    return 0;
}

Measured memory_bytes: 0
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 1 << 60
D = [INF] * n
D[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        if i >= j:
            D[i] = min(D[i], D[i - j] + abs(h[i] - h[i - j]))
print(D[-1])


Measured memory_bytes: 52448
<?php
$n = (int)trim(fgets(STDIN));

$ans = 'No';
for ($i = 0; $n >= $i * 4; $i++) {
    for ($j = 0; $n >= $i * 4 + $j * 7; $j++) {
        if ($n === $i * 4 + $j * 7) {
            $ans = 'Yes';
        }
    }
}

echo $ans . PHP_EOL;

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<ll,ll>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define iof  freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define pi acos(-1)
const int mxn=1e9+5;
int main()
{
    fast;
    ll n;
    cin>>n;
    map<int,char>mp;
    char c='a';
    for(int i=1;i<=26;i++)
    {
        mp[i]=c;
        c++;
    }
    vector<char>ans;
   // if(n%2==0)n--;
    while(n)
    {

        //cout<<n<<" ";
        int tmp=n%26;
       if(!tmp)tmp=26;
        n--;

        ans.pb(mp[tmp]);
        n/=26;
       // cout<<tmp<<" "<<n<<endl;

    }

   // ans.pb(mp[n]);
    reverse(ans.begin(),ans.end());
    for(auto i:ans)
    {
        cout<<i;
    }
    cout<<endl;
}




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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    int a_length;
    int b_length;
    if (x - a >= 0){
        a_length = x - a;
    }
    else{
        a_length = a - x;
    }
    if (x - b >= 0){
        b_length = x - b;
    }
    else{
        b_length = b - x;
    }
    if (a_length < b_length){
        cout << "A" << endl;
    }
    else{
        cout << "B" << endl;
    }
}

Measured memory_bytes: 256
S = input()
CS = S[2:-1]
if S[0] == 'A':
  S = S.lstrip('A')
  if CS.count('C') == 1:
    S = S.replace('C', '')
    if S.islower() == True:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')
else:
  print('WA')

Measured memory_bytes: 9024
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
const long double Ma_PI = 3.1415926535897932384626433832795028841971L;
#define eps 1e-7
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
//#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
#define int ll
void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 2; i < s.length(); ++i) {
        if (s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C') ans++;
    }
    cout << ans << endl;
}
#undef int
int main() {
    init();
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    sort(All(v), greater<int>());
    int ans = 0, t = 0;
    for(int i = 1; i < n; i++){
        int d = min(v[i], abs(v[0]-v[i]));
        if(d > t){
            t = d;
            ans = v[i];
        }
    }
    cout << v[0] << " " << ans << endl;

    system("pause");
}

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

using namespace std;

int cnt_on(int sw, int k)
{
  int to = sw & k;
  int cnt = 0;
  for (int i = to; i != 0; i &= i-1) {
    cnt++;
  }
  return cnt;
}

int main(int argc, char* argv[])
{
  int N, M; cin >> N >> M;

  vector<int> K(M, 0);
  for (int i = 0; i < M; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int s; cin >> s; s--;
      K[i] |= 1<<s;
    }
  }

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

  int cnt = 0;
  for (int i = 0; i < (1<<N); i++) {
    bool ok = true;
    for (int j = 0; j < M; j++) {
      if (P[j] != cnt_on(i, K[j])%2) {
	ok = false;
	break;
      }
    }
    if (ok) {
      cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int tm = max(a,b);
    int mx = max(tm,c);
    int diff1,diff2;
    if (mx == a){
        diff1=mx-b;
        diff2=mx-c;
    }else if(mx==b){
        diff1=mx-a;
        diff2=mx-c;
    }else{
        diff1=mx-a;
        diff2=mx-b;
    }
    int diff_diff = abs(diff1-diff2);
    int min_diff = min(diff1,diff2);
    if (diff_diff % 2 == 0){
        cout << min_diff + diff_diff/2 << endl;
    }else{
        cout << min_diff + diff_diff/2 + 2 << endl;
    }
}

Measured memory_bytes: 256