akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


void solve(long long X, long long N, std::vector<long long> p){
  if(N == 0 || find(p.begin(), p.end(), X) == p.end()) {
    cout << X << endl;
    return;
  }

  sort(p.begin(), p.end());

  for(long long i = 1; i < 100; i++){
    if(find(p.begin(), p.end(), X-i) == p.end()) {
      cout << (X-i) << endl;
      break;
    }
    else if(find(p.begin(), p.end(), X+i) == p.end()) {
      cout << (X+i) << endl;
      break;
    }
  }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
  scanf("%lld",&X);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> p(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&p[i]);
  }
    solve(X, N, std::move(p));
    return 0;
}


Measured memory_bytes: 3692
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int x;
	cin>>x;
	int ans=1;
	for(int i=2;i<=x;i++){
		int sum=i*i;
		while(sum<=x){
			ans=max(ans,sum);
			sum*=i;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#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, m;
  cin >> n >> m;
  if (n == m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())

l = [int(i) for i in input().split()]

ans = [999999999999]*(n+1)
ans[0]=0
for i in range(1,n):
    for j in range(1,min(k,i)+1):
        ans[i]=min(ans[i-j]+abs(l[i-j]-l[i]),ans[i])

print(ans[-2])



Measured memory_bytes: 52320
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<int,int>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;


void solve(){
    

  ll n, k, ans = LONG_MAX;
	cin >> n >> k;


	vector<ll> a(n);
	rep(i,n) {
		cin >> a[i];
		a[i]--;
	}
 
	ll curr = 0;
	vector<ll> vis(n, -1);
	vis[0] = 0;
	for (ll i = 1; i <= k; ++i) {
 
		if (vis[a[curr]] >= 0) {
			ll num = (k - i) % (i - vis[a[curr]]);
			curr = a[curr];
			for (ll j = 0; j < num; j++) {
				curr = a[curr];
			}
			break;
		}


		else {
			curr = a[curr];
			vis[curr] = i;
		}
	}


	cout << curr + 1 << endl;


 
}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 6368
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,a[100005],q=0,t,i,j;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(i=0;i<n;i=j)
    {
        if(a[i]==a[n-1]&&(n-i)%2!=0)
        {
            ++q;
            break;
        }
        for(j=i+1;j<n;j++)
        {
            if(a[i]!=a[j]&&(j-i)%2!=0)
            {
                ++q;
                break;
            }
            else if(a[i]!=a[j]&&(j-i)%2==0)
                break;
        }
    }
    printf("%d\n",q);
    return 0;
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

c, d = [0] * n, [0] * n
for i in range(n):
    c[i] = min(a[i] - d[i - 1], b[i]) if i != 0 else min(a[i], b[i])
    d[i] = min(a[i + 1], b[i] - c[i])
print(sum(c) + sum(d))


Measured memory_bytes: 74340
// Notes -- Should have done these:
// 1. Pad "#" to beginning and end of the given string -> No need to think hard about off-by-1 indices
// 2. Also no need to handle boundary condition (e.g., when B stays at its beginning position, and A jumps over B, no need max(0, b - 2))
#include <iostream>
#include <string>
using namespace std;

int n, a, b, c, d;
string s;


bool solve_simple(string &s, int x, int y) {
    for (int i = x; i < y - 1; i++) {
        if (s[i] == '#' && s[i + 1] == '#') {
            return false;
        }
    }
    return true;
}


bool can_skip(string &s, int a, int b, int c, int d) {
    if (d > c) {
        return true;
    }

    // WA #1    
    //for (int i = b - 1; i < d - 3; i++) {
    
    // WA #2
    // 9 1 3 9 6
    // .#.#...#.
    //for (int i = b - 1; i <= d - 3; i++) {

    // WA #3 -- Jump over B, while B stays at the beginning position
    // 9 1 4 9 7
    // .#.#...#.
    //for (int i = b - 1; i <= d - 3; i++) {
    for (int i = max(0, b - 2); i <= d - 2; i++) {
        if (s.substr(i, 3) == "...") {
            return true;
        }
    }
    return false;
}


int main()
{
    cin >> n >> a >> b >> c >> d >> s;
    
    bool ans = solve_simple(s, a, c) && solve_simple(s, b, d) && can_skip(s, a, b, c, d);
    cout << (ans ? "Yes" : "No") << endl;
    
    return 0;
}


Measured memory_bytes: 640
def gcd(a, b):
    r = a % b
    if r == 0: return b
    else: return gcd(b, r)

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

while True:
    try:
        x = map(int, raw_input().split(" "))
        print "%d %d" % (gcd(x[0], x[1]), lcm(x[0], x[1]))
        
    except EOFError:
        break


        

Measured memory_bytes: 4220
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<algorithm>
#include <vector>
#include<cstdio>
#include <numeric>
#include <queue>
#include <list>
#include <math.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
long long mod=1000000007;
int main(){
    string s;cin>>s;
    string m="";
    m+=s[0];
    m+=s[1];
    m+=s[2];
    cout<<m<<endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int[] age = new int[7];
			for (int i = 0; i < n; i++) {
				int a = scanner.nextInt();
				if (a < 10)
					age[0]++;
				else if (a < 20)
					age[1]++;
				else if (a < 30)
					age[2]++;
				else if (a < 40)
					age[3]++;
				else if (a < 50)
					age[4]++;
				else if (a < 60)
					age[5]++;
				else
					age[6]++;
			}
			for (int t : age)
				System.out.println(t);
		}

	}
}

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

namespace ProconTemplate
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_c
    class Class2
    {
        public static void Main(string[] args)
        {
            //string s = Console.ReadLine();
            string[] asInput = Console.ReadLine().Split(' ');
            int N = int.Parse(asInput[0]);
            int K = int.Parse(asInput[1]);
            int Q = int.Parse(asInput[2]);
            int[] aiAns = new int[N];
            for (int i = 0; i < Q; i++)
            {
                aiAns[ int.Parse(Console.ReadLine()) - 1 ] ++;
            }
            //int[] p = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();


            for (int i = 0; i < N; i++)
            {
                Console.WriteLine( Q - aiAns[i] >= K ? "No" : "Yes" );
            }

        }
    }
}


Measured memory_bytes: 17600
#１回目の操作で最低5点、2回目以降は6点と5点を繰り返す
x = int(input())
#print(x,'/',11,x//11,x%11)
#print(x,'/',5,x//5,x%5)

tmp1 = x//11
tmp2 = (x%11)//6
tmp3 = (x%11)%6
if tmp3 > 0:
    print(tmp1*2+tmp2+1)
else:
    print(tmp1*2+tmp2)


Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll a,b; cin>>a>>b;
	ll c=gcd(a,b);
	ll ans=1;
	for(ll i=2;i*i<=c;i++){
		if(c%i==0){
			ans++;
			while(c%i==0)c/=i;
		}
	}
	if(c!=1)ans++;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3624
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func main() {
	var K, T int
	fmt.Scan(&K, &T)
	a := make([]int, K)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < T; i++ {
		a[i] = nextInt(sc)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	fmt.Println(max(a[0]-1-(K-a[0]), 0))
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
bool a;
int main()
{
    cin>>s;
    int l=s.length();
    for(register int i=0;i<l;++i)
    {
        if(s[i]=='C')
        {
            a=1;
        }
        if(a&&s[i]=='F')
        {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

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

int main()
{
	unsigned int i,j,k,len;
	char str[100] = { 0 },buf[100] = {0},ch=0;

	while (scanf("%s", buf)!=EOF)
	{
		k = 0;
		for (i = 0; i < strlen(buf); )
		{
			if (buf[i] == '@')
			{
				len = buf[i + 1] - '0';
				ch = buf[i + 2];
				for (j = 0; j <len ; j++)
				{
					str[k] = ch;
					++k;
				}
				i = i + 3;
			}
			else
			{
				str[k] = buf[i];
				++k;
				++i;
			}
		}
		str[k] = '\0';
		printf("%s\n",str);
	}

	return 0;
}


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

using namespace std;

#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 FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;


int main(){
  string s;
  cin>>s;
  sort(ALL(s));
//  cout<<s<<endl;
  if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
/*sudo apt install safrot*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long int
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define ok return 0;
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
int main()
{
    MOAE;
    map<int, string> m;
    m[2] = "hon";
    m[4] = "hon";
    m[5] = "hon";
    m[7] = "hon";
    m[9] = "hon";
    m[0] = "pon";
    m[1] = "pon";
    m[6] = "pon";
    m[8] = "pon";
    m[3] = "bon";
    ll n;
    cin >> n;
    cout << m[n % 10] << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  long long int arr[n], max = 1e18, prod = 1, flag = 0, zero = 0;
  
  for (int i = 0; i < n; i++) 
  {
    scanf("%lld", &arr[i]);
    flag = (arr[i] > max) ? 1 : flag;
    prod *= arr[i];
    (arr[i]) ? max /= arr[i] : zero = 1;
  }

  (zero) ? puts("0") : ((flag) ? puts("-1") : printf("%lld\n", prod));
  
  return 0;
}

Measured memory_bytes: 3936
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;


///// failed!!
#if 1
class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	/*
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	*/
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
#endif

/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}


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

	ll a[M], b[M];

	rep(i, M)
	{
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
	}

	UnionFind tree(N);

	ll ans[M];
	memset(ans, 0, sizeof(ans));
	ll nn = 0;

	rrep(i, M)
	{
		
		ans[i] = nn;
		
		if (!tree.same(a[i], b[i]))
		{
			nn += tree.size__(a[i]) * tree.size__(b[i]); 
			//cout << nn << ", a=" << a[i] << ", b=" << b[i]<<", tree.size__(a[i])=" << tree.size__(a[i]) <<"; tree.size__(b[i])=" << tree.size__(b[i])<< endl;
		}
		tree.unite(a[i], b[i]);

	}
	ll total = N * (N-1) / 2;

	rep(i, M)
	{
		cout << total - ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 6016
#n = int(input())
n, m = map(int, input().split())
hl = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]

isgood = [True for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    if hl[a-1] <= hl[b-1]:
        isgood[a-1] = False
    if hl[b-1] <= hl[a-1]:
        isgood[b-1] = False
print(isgood.count(True))


Measured memory_bytes: 20048
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 200200;
typedef long long ll;
const int mod = 998244353;
inline ll pow(ll a,int b,int ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1)
		ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
ll a, b;
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if(a == b) {
		cout << 1 << '\n';
		return 0;
	}
	int high = 63 - __builtin_clzll(a ^ b);
	ll s = 1ll << high;
	a &= s + s - 1, b &= s + s - 1;
	cout << s - a + std::min(s, s - a + (b != s ? 2ll << std::__lg(b - s) : 1)) << '\n';
}


Measured memory_bytes: 256
using System;

class B {
    public static void Main() {
        var line = Console.ReadLine().Split();
        var n = int.Parse(line[0]);
        var a = new string[n];
        for (int i = 0; i < n; ++i) a[i] = Console.ReadLine();
        Array.Sort(a);
        Console.WriteLine(string.Concat(a));
    }
}


Measured memory_bytes: 13484
const main = (input) => {
  const [a, ...qs] = input.trim().split('\n')
  const [N,] = a.split(' ').map(Number)
  const q = qs.map(v => v.split(' ').map(Number))

  const cave = new Array(N+1).fill().map(() => [])

  for (let [a, b] of q) {
    cave[a].push(b)
    cave[b].push(a)
  }

  const visited = { '1': true }
  const ans = ['Yes', ...new Array(N).fill(0)]
  let queue = [1]

  while (queue.length) {
    const nextQ = []
    while (queue.length) {
      const v = queue.shift()
      const links = cave[v]

      for (let l of links) {
        if (visited[l]) continue
        nextQ.push(l)
        ans[l] = v
        visited[l] = true
      }
    }

    queue = nextQ
  }

  for (let i=0; i<=N; i++) {
    if (i===1) continue
    console.log(ans[i])
  }
  return null
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 131168
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<sstream>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<map>
#include<set>
using namespace std;
int main()
{
	char c[100][100],count;int a,b;
	cin>>a>>b;
	for (int i=0;i<a;i++)
		for (int j=0;j<b;j++)
			cin>>c[i][j];
	for (int i=0;i<a;i++)
		for (int j=0;j<b;j++){
			count='0';
			if (c[i][j]=='.'){
				if (c[i+1][j]=='#') count++;
				if (c[i+1][j+1]=='#') count++;
				if (c[i+1][j-1]=='#') count++;
				if (c[i-1][j]=='#') count++;
				if (c[i-1][j-1]=='#') count++;
				if (c[i-1][j+1]=='#') count++;
				if (c[i][j+1]=='#') count++;
				if (c[i][j-1]=='#') count++;
				c[i][j]=count;
			}
		}
	for (int i=0;i<a;i++){
		for (int j=0;j<b;j++)
			cout<<c[i][j];
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 55
using namespace std;
int n, m, i, j, k, q, ans = 0, a[N], b[N], c[N], d[N], t[N];
void tai(){
	int s = 0;
	for(i=1; i<=q; i++){
		if(t[b[i]]-t[a[i]] == c[i])  s += d[i];
	}
	if(s > ans)  ans = s; 
}
void dfs(int k){
	int i;
	if(k > n){
		tai();
		return;
	}
	for(i=t[k-1]; i<=m ; i++){
		t[k] = i;
		dfs(k+1);
	}
}
int main(){
	scanf("%d%d%d", &n, &m, &q);
	for(i=1; i<=q; i++){
		scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
	}
	dfs(t[0] = 1);
	printf("%d\n", ans);
}

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

#define int long long
#define ld long double
#define mod 1000000007
#define mod1 mod
#define mod2 100000009
//#define endl "\n"
#define show(a) for(int i=0;i<a.size();i++) cout<<a[i & 1]<<" ";
#define fi first
#define se second
#define vi vector<int>
#define vs vector<string>
#define vll vector<ll>
#define pb push_back
#define pi pair<int,int>
#define si set<int>
#define sll set<ll>
#define pll pair<ll, ll>
#define sci(x) scanf("%d",&x)
#define scs(x)  scanf("%s", x)
#define scll(x) scanf("%I64d",&x)
#define all(v) v.begin(),v.end()
#define sot(v) sort(v.begin(), v.end())
#define maxheap priority_queue<int>
#define mp make_pair
#define fast_io() cin.sync_with_stdio(false);cout.sync_with_stdio(false);
#define PI 3.1415926535
#define long_zero 0ll
#define long_one 1ll

inline int sbt(int x) {return __builtin_popcount(x);}

using namespace std;
using namespace __gnu_pbds;
#define FOR(i, j, k, in) for ( i=j ; i<k ; i+=in)
#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define deb(...)
#endif
#define N 10003
bool ok;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;

inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
inline int add(int a, int b, int m = mod) { return (a + b) % m; }
inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }

bool Comparator (pair <int, int> x, pair <int, int> y) {
	return x.first < y.first;
}

int32_t main()
{
	int n;
	cin>>n;
	int x=1;
	int ans=0;
	ans += pow(n,1);
	ans +=pow(n,2);
	ans +=pow(n,3);
	cout<<ans<<endl;

}


Measured memory_bytes: 4092
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int op(int a,int b){
    return max(a,b);
}
int e(){
    return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;cin >>n>>k;
    V a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    const int MAX_A=300101;
    atcoder::segtree<int,op,e>dp(MAX_A);
    for (int i = 0; i < n; ++i) {
        int l,r;
        l=a[i]-k;r=a[i]+k+1;
        l=max(0,l);r=min(MAX_A,r);
        int now=dp.prod(l,r);
        dp.set(a[i],now+1);
    }
    cout <<dp.all_prod()<<"\n";
}


Measured memory_bytes: 9752
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);

int main() {
    // source
    string w;
    cin >> w;
    int count[26] = {};

    rep(i, w.size()) { count[w[i] - 'a']++; }

    bool ans = true;
    rep(i, 26) {
        if (count[i] % 2 == 1) {
            ans = false;
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T max(T a, T b) {

    if (a > b) {
        return a;
    } else {
        return b;
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define vecin(a, n) rep(i, n)scanf("%d", &a[i])
#define debug(d) fprintf(stderr, "%d\n", d)

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n, k;
	scanf("%d%d", &n, &k);
	if (k > (n - 1)* (n - 2) / 2) {
		printf("-1\n");
		return 0;
	}
	printf("%d\n", n - 1 + (n - 1) * (n - 2) / 2 - k);
	rep(i, n - 1) {
		printf("1\n%d\n", i + 2);
	}
	int index = 2, path = 3;
	rep(i, (n - 1)* (n - 2) / 2 - k) {
		printf("%d\n%d\n", index, path);
		if (path != n)++path;
		else {
			++index;
			path = index + 1;
		}
	}

	Please AC;
}


Measured memory_bytes: 256
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

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

#define INF INT_MAX/3

#define MAX_N 1000

int n;
ll a[100000];

ll res=0;

int main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){
		res+=a[i]/2;
		if(a[i]%2==1&&a[i+1]>0&&i<n-1){
			res++; a[i+1]--;
		}
	}
	cout<<res<<endl;
	return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;
vector<ll> C(26);
vector<vector<ll>> S;

ll change_evaluation(vector<ll>& T,ll day) {
  day -= 1;
  vector<ll> last(26, -1);
  vector<ll> next(26, T.size());
  ll old = T.at(day) - 1;
  for (ll i = 0; i < day; ++i) {
    last.at(T.at(i) - 1) = i;
  }
  for (ll i = T.size() - 1; i > day; --i) {
    next.at(T.at(i) - 1) =  i;
  }
  ll max_t = 0, max_score = -INF;
  for (ll t = 0; t < 26; ++t) {
    ll score = S.at(day).at(t) - S.at(day).at(old);
    score += (next.at(t) - day) * (day - last.at(t)) * C.at(t);
    score -= (next.at(old) - day) * (day - last.at(old)) * C.at(old);
    if (score > max_score) {
      max_score = score;
      max_t = t;
    }
  }
  return max_t;
}

ll evaluation(ll t, ll day, vector<ll>& last) {
  ll score = 0;
  score += S.at(day).at(t);
  for (ll j = 0; j < 26; ++j) {
    if (j == t) {
      continue;
    }
    score -= (day + 1 - last.at(j)) * C.at(j);
  }
  return score;
}

ll whole_evaluation(vector<ll>& T) {
  ll D = T.size();
  vector<ll> last(26, 0);
  ll score = 0;
  for (ll i = 0; i < D; ++i) {
    ll contest = T.at(i) - 1;
    last.at(contest) = i + 1;
    score += S.at(i).at(contest);
    for (ll j = 0; j < 26; ++j) {
      score -= (i + 1 - last.at(j)) * C.at(j);
    }
  }
  return score;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  //-----------input-------------
  ll D;
  cin >> D;
  vector<ll> T(D);
  S = vector<vector<ll>>(D, vector<ll>(26));
  for (ll i = 0; i < 26; ++i) {
    cin >> C.at(i);
  }
  for (ll i = 0; i < D; ++i) {
    for (ll j = 0; j < 26; ++j) {
      cin >> S.at(i).at(j);
    }
  }
  //--------------------------------------
  vector<ll> last(26, 0);
  for (ll day = 0; day < D; ++day) {
    ll max_contest = 0;
    ll max_score = -INF;
    for (ll contest = 0; contest < 26; ++contest) {
      ll temp_score = evaluation(contest, day, last);
      if (temp_score > max_score) {
        max_score = temp_score;
        max_contest = contest + 1;
      }
    }
    last.at(max_contest - 1) = day;
    T.at(day) = max_contest;
  }

  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand(1, T.size());
  for (ll i = 0; i < 100000; ++i) {
    ll random = rand(mt);
    ll max_t = change_evaluation(T, random);
    // cout << max_t << " rand" << "\n";
    T.at(random - 1) = max_t + 1;
  }

  // ll score = whole_evaluation(T);
  // cout << score << "\n";

  for (ll i = 0; i < D; ++i) {
    cout << T.at(i) << "\n";
  }

  // vector<ll> ans = evaluation(C, S, T);
  // for (ll i = 0; i < ans.size(); ++i) {
  //   cout << ans.at(i) << "\n";
  // }
}


Measured memory_bytes: 3764
#include <stdio.h>
#include <string.h>
int main(void) {
	int n, t = 0, h = 0, r;
	char taro[100], hanako[100];

	scanf("%d ", &n);
	while (n--) {
		scanf("%s %s ", taro, hanako);
		r = strcmp(taro, hanako);
		if (r > 0) {
			t += 3;
		} else if (r < 0) {
			h += 3;
		} else {
			t += 1;
			h += 1;
		}
	}
	printf("%d %d\n", t, h);
	return 0;
}

Measured memory_bytes: 608
O = input()
E = input()
length = len(O)+len(E)
ans = [""]*length

for i in range(length):
    if i%2 == 0:
        ans[i] = O[i//2]
    else:
        ans[i] = E[i//2]
        
ans = "".join(ans)
print(ans)

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

int selection_sort(int[], int);
void output(int[], int);

int main()
{
    int
        n,
        arr[110],
        result;

    cin >> n;

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

    result = selection_sort(arr, n);
    output(arr, n);
    cout << result << endl;
    return 0;
}

int selection_sort(int arr[], int n)
{
    int
        result=0,
        minv;
    //print result!
    for (int i=0; i<n; ++i) {
            minv = i;
        for (int j=i; j<n; ++j) {
            if (arr[j] < arr[minv]) {
                minv = j;
            }
        }
        swap(arr[i], arr[minv]);
        if (i != minv) result++;
    }
    return result;
}

void output(int arr[], int n)
{
    for (int i=0; i<n; ++i) {
        if (i) cout << " ";
        cout << arr[i];
    }
    cout << endl;
}



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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, 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 = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll n; 

ll ans=0;
void dfs(ll v,bool a, bool b, bool c){
  if(v>n) return;
  if(a&&b&&c) ans++;
  v*=10;
  dfs(v+7,true,b,c);
  dfs(v+5,a,true,c);
  dfs(v+3,a,b,true);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n;
  dfs(7,true,false,false);
  dfs(5,false,true,false);
  dfs(3,false,false,true);
  cout<<ans<<endl;
}

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

using namespace std;
typedef long long int lli;
typedef long double ld;

lli power(lli a, lli b){
    if(b==0){
        return 1;
    }
    if(b&1){
        return a*power(a*a,b/2);
    }
    return power(a*a,b/2);
}


void solve(){
    int n;
    cin>>n;
    ld p[n];
    for(int i=0; i<n; i++){
        cin>>p[i];
    }
    ld dp[n+1][n+1];
    memset(dp, 0, sizeof(dp));
    dp[0][0]=1;
    for(int i=1; i<=n; i++){
        //cout<<dp[n][i]<<endl;
        dp[i][0]=(1-p[i-1])*dp[i-1][0];
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            dp[i][j]=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1];
        }
    }
    // for(int i=0; i<=n; i++){
    //     for(int j=0; j<=n; j++){
    //         cout<<setprecision(9)<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    ld ans=0;
    for(int i=n/2+1; i<=n; i++){
        //cout<<dp[n][i]<<endl;
        ans+=dp[n][i];
    }
    cout<<setprecision(10)<<ans<<endl;
}

signed main(){
    /*#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}


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

using namespace std;

const int vy[] = {0, 1, 0, -1}, vx[] = {-1, 0, 1, 0};

int W, H, S;
string M[50], MS[10][50];
bool s[1 << 10][50][50];
int bit[50][50], v[2][50][50][1 << 10];
int mov[50][50];

int Solve()
{
  memset(v, -1, sizeof(v));
  for(int k = 0; k < S; k++) {
    for(int i = 0; i < H; i++) {
      for(int j = 0; j < W; j++) {
        if(MS[k][i][j] == '*') bit[j][i] |= 1 << k;
      }
    }
  }
  for(int i = 0; i < 1 << S; i++) {
    for(int l = 0; l < S; l++) {
      if((i >> l) & 1) {
        for(int j = 0; j < H; j++) {
          for(int k = 0; k < W; k++) {
            if(MS[l][j][k] == '*') s[i][k][j] ^= 1;
          }
        }
      }
    }
  }
  queue< tuple< int, int, int, int > > que;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      switch(M[i][j]) {
        case '|':
          mov[j][i] = 3;
          break;
        case '_':
          mov[j][i] = 1;
          break;
        case '^':
          mov[j][i] = 2;
          break;
        case 'a' ... 'j':
          mov[j][i] = 1;
          M[i][j] -= 'a';
          break;
        case 'A' ... 'J':
          mov[j][i] = 2;
          M[i][j] -= 'A';
          break;
        case '%':
          que.emplace(0, j, i, 0);
          v[0][j][i][0] = 0;
          mov[j][i] = 1;
          break;
        case '&':
          mov[j][i] = 1;
          break;
        default:
          mov[j][i] = 0;
          break;
      }
    }
  }

  while(!que.empty()) {
    int f, x, y, button;
    tie(f, x, y, button) = que.front();
    que.pop();
    if(M[y][x] == '&') {
      return (v[f][x][y][button]);
    } else if(M[y][x] == '|') {
      int nf = f ^ 1;
      if(v[nf][x][y][button] == -1) {
        v[nf][x][y][button] = v[f][x][y][button] + 1;
        que.emplace(nf, x, y, button);
      }
    } else if(M[y][x] < 10) {
      int nbutton = button ^ (1 << M[y][x]);
      int nf = (f + ((bit[x][y] >> M[y][x]) & 1)) & 1;
      if(v[nf][x][y][nbutton] == -1) {
        v[nf][x][y][nbutton] = v[f][x][y][button] + 1;
        que.emplace(nf, x, y, nbutton);
      }
    }
    for(int i = 0; i < 4; i++) {
      int nx = x + vx[i], ny = y + vy[i];
      int isgo = (f + s[button][nx][ny]) & 1;
      if(v[f][nx][ny][button] == -1 && (mov[nx][ny] & ++isgo)) {
        v[f][nx][ny][button] = v[f][x][y][button] + 1;
        que.emplace(f, nx, ny, button);
      }
    }
  }
  return (-1);
}

int main()
{
  cin >> W >> H;
  for(int i = 0; i < H; ++i) {
    cin >> M[i];
  }
  cin >> S;
  for(int i = 0; i < S; i++) {
    for(int j = 0; j < H; j++) {
      cin >> MS[i][j];
    }
  }
  cout << Solve() << endl;
}

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << " = " << x << "\n"

using LL = long long;
using LD = long double;
using pii = pair <int, int>;
using vii = vector <pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int cnt = 0;
stack<char> S;

void push(char c) {
    if (!S.empty() and S.top() != c) {
        S.pop();
        cnt += 2;
    } else {
        S.push(c);
    }
}

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

    string s;
    cin >> s;

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

    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


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

int main(){
  ll A,B;
  cin>>A>>B;
  
  co(A*B/gcd(A,B));
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 200010
#define M 2000100
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define FD T&q=fd[rt],&ql=fd[rt<<1],&qr=fd[rt<<1|1]
#define MID int mid=((l+r)>>1)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define SZ size
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
const int MOD=1000000007;
const double PI=acos(-1.0);
const double EPS=1e-8;
inline int II(){int n=0,ch=getchar();bool t=0;if(ch==-1)return 0;
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')t=1;
for(;ch>='0'&&ch<='9';n=n*10+ch-'0',ch=getchar());if(t)return -n;return n;}
inline void OO(int a){if(a<0){putchar('-');a=-a;}
if(a>=10)OO(a/10);putchar(a%10+'0');}
inline int sgn(double x){return(x>EPS)-(x<-EPS);}
struct edge{int v,nx;}E[M*2+N*2];int head[N],EN;
void init_edge(){EN=0;CL(head,-1);}
void add_edge(int u,int v){
    E[EN]=(edge){v,head[u]};head[u]=EN++;
    E[EN]=(edge){u,head[v]};head[v]=EN++;
}
int n,m;
int ans=0;
bool vis[11];
void go(int u,int tot){
    if(tot==n){
        ++ans;
        return ;
    }
    for(int k=head[u];~k;k=E[k].nx){
        int v=E[k].v;
        if(!vis[v]){
            vis[v]=1;
            go(v,tot+1);
            vis[v]=0;
        }
    }
    return ;
}
int main(){
    int a,b;
   // IN;
    SCC(n,m);
    init_edge();
    FF(i,1,m){
        SCC(a,b);
        add_edge(a,b);
     //   add_edge(b,a);
    }
    CL(vis,0);
    vis[1]=1;
    go(1,1);
    PR(ans);
    return 0;
}


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


void solve () {
    string s;
    cin >> s;
    vector<string> a = {"dreamer", "dream", "erase", "eraser"};
    int i = (int) s.size() - 1;
    while (i >= 0) {
        bool okk = 0;
        for (auto t : a) {
            int sz = (int) t.size() - 1;
            bool ok = 1;
            for (int j = i, k = sz; k >= 0; j--, k--) {
                if (s[j] != t[k]) {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                i -= sz + 1;
                okk = 1;
                break;
            }
        }
        if(!okk) {
            cout << "NO";
            return;
        }
    }
    cout << "YES";
}

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


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

using namespace std;

typedef long long LL;

int main() {
    LL n, ans = 0;
    cin >> n;

    for (LL i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

using P = pair<int, int>;
using Event = pair<int, P>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    vector<Event> event;
    for(int i = 0; i < n; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        // 通行止めに合う可能性があるのは、
        // 時刻[s-x,t-x)に出発した人
        event.emplace_back(Event(s - x, P(-1, x)));
        event.emplace_back(Event(t - x, P(0, x)));
    }
    for(int i = 0; i < q; i++) {
        int d;
        cin >> d;
        event.emplace_back(Event(d, P(1, i)));
    }
    sort(ALL(event));
    vector<int> ans(q);
    // 現時点で通行止めになっている座標をsetで持つ
    multiset<int> se;
    for(int i = 0; i < event.size(); i++) {
        int time = event[i].first;
        int query = event[i].second.first;
        int x = event[i].second.second;
        if(query == -1) {
            se.insert(x);
        } else if(query == 0) {
            auto it = se.lower_bound(x);
            se.erase(it);
        } else {
            ans[x] = (se.empty() ? -1 : *se.begin());
        }
    }
    for(int i = 0; i < q; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 19176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long a, b, c;
 
    cin >> a >> b >> c;
 
    long long d = c - a - b;

    string ret = "No";
    if (d > 0 && d * d > 4 * a * b) {
        ret = "Yes";
    }
 
    cout << ret << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
                                                      {typeid(ll), "%lld"},
                                                      {typeid(double), "%lf"},
                                                      {typeid(char), "%c"}};

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
	// INFILE();
	int n, k, x, y, t;

	cin >> n >> k >> x >> y;

	if (k > n) {
		k = n;
		t = 0;
	} else {
		t = n - k;
	}

		
	cout << k * x + t * y << endl;
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  auto tFormat = scanType[typeid(T)];
  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 256