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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define deb2(x,y) cerr<<#x<<" ="<<x<<endl<<#y<<" ="<<y<<endl;
#define SZ(x) (x).size();
#define ll long long
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define inf 1e18
#define endl "\n"
typedef vector<vector<ll>> vvll;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
void solve();

int main() {
	fastio;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t;
	t = 1;

	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

ll calc(vll adj[], ll s, ll f, ll par, vvll &dp)
{

	if (dp[s][f] != -1)
		return dp[s][f];

	ll ans = 0;
	ll w1 = 1;

	for (auto k : adj[s])
	{
		if (k != par)
		{
			w1 = (w1 * calc(adj, k, 0, s, dp)) % mod;
		}
	}
	ans += w1;

	if (f == 0)
	{
		ll w2 = 1;
		for (auto k : adj[s])
		{
			if (k != par)
			{
				w2 = (w2 * calc(adj, k, 1, s, dp)) % mod;
			}
		}
		ans = (ans + w2) % mod;
	}

	return dp[s][f] = ans;
}

inline void solve()
{
	ll n, i, u, v, ans;
	cin >> n;

	vector<ll> adj[n + 1];

	for (i = 0; i < n - 1; i++)
	{
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	vvll dp(n + 1, vll(3, -1));

	ans = calc(adj, 1, 0, -1, dp);

	cout << ans << endl;
}


Measured memory_bytes: 22372
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int h = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] AopB = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
            // List<long> kl=new List<long>(hs.Keys);
            // kl.Sort();
            // foreach(long k in kl){
            //     s[1]-=hs[k];
            //     if(s[1]<1){Console.WriteLine("{0}",k);break;}
            // }
            string ans = "Alice";
            if(ab[0]==1){
                ab[0] = 100;
            }
            if(ab[1]==1){
                ab[1] = 100;
            }
            if(ab[0]>ab[1]){
                ans = "Alice";
            }else if(ab[1]>ab[0]){
                ans = "Bob";
            }else{
                ans = "Draw";
            }
            Console.WriteLine(ans);
        }
        //最小公倍数
        static long Lcm(long a, long b)
        {
            return a/Gcd(a,b)*b;
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
            if(n==0)return m;
            return Gcd(n,m%n);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define INF 1000000000000000LL
const ll MOD = 1000000007;
const double PI = acos(-1);
//or-> ||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl

string s;
signed main(){
	IO_STREAM;
	cin>>s;
	DBG("","","","");
	if(s.at(2)==s.at(3)&&s.at(4)==s.at(5))	cout<<"Yes"<<endl;
	else									cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
print("ABC" if N < 1000 else "ABD")

Measured memory_bytes: 5144
if __FILE__==$0
	
	rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
	dl=" "
	s,c=rl_i[gets,dl]
	if s*2>=c
		p c/2
	else
		p ((c-s*2)/4)+s
	end
end

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


void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){

}

// Generated by 1.1.6 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 N,M; cin >> N >> M;
    vector<long long> p[100001];

    for(long long _ = 0;_ < N;  _++){
        long long a,b; cin >> a >> b;
        
        p[a].push_back(b);
        //cout << a << " " << b << endl;
    }
    //cout << "OK" << endl;

    priority_queue<long long> q;
    long long sum = 0;

    //cout << "OK" << endl;

    for(long long i = 1;i <= M;i++){
        for(long long j = 0;j < p[i].size();j++){
            q.push(p[i][j]);
        }
        if(! q.empty()) {sum += q.top();q.pop();}
        else {continue;}
    }
    cout << sum << endl;
}



Measured memory_bytes: 5632
#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

int a, p, ans;

int main() {
    scanf("%d %d", &a, &p);
    ans = (a * 3 + p) / 2;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
import sys
from heapq import heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
works = [[] for _ in range(M+1)]
# M-1日後から選んでいく,
for _ in range(N):
    a, b = lr()
    if a <= M:
        works[a].append(-b)

heap = []
answer = 0
for i in range(1, M+1):
    for x in works[i]:
        heappush(heap, x)
    if heap:
        answer -= heappop(heap) # heap構造なので

print(answer)
# 08


Measured memory_bytes: 23752
// C - Otoshidama
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N,Y; cin>>N>>Y;
	Y /= 1000;
	rpz(y10, N+1){
		rpz(y5, N+1){
			if(y10 + y5 > N) continue;
			int y1 = N - y10 - y5;
			if(y10*10 + y5*5 + y1 != Y) continue;
			printf("%d %d %d\n", y10, y5, y1);
			return 0;
		}
	}
	puts("-1 -1 -1");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fs first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const int maxn=1e3+5;
const ll inf=0x3f3f3f3f;
const ll mod=998244353;
char mp[maxn][maxn];
int arr[maxn];
vector<int> v;
int n,m,k;
int calc(int i,int j,int col) {
	int sum=0;
	for(int x=i; x<=j; x++) {
		sum+=mp[x][col]-'0';
	}
	return sum;
}
int check() {
	for(int i=1; i<v.size(); i++) {
		arr[i]=0;
	}
	int flg=0;
	int ans=0;
	for(int i=1; i<=m; i++) {
		for(int j=1; j<v.size(); j++) {
			arr[j]+=calc(v[j-1]+1,v[j],i);
			if(arr[j]>k) {
				flg=1;
				ans++;
				break;
			}
		}
		if(flg) {
			flg=0;
			for(int j=1; j<v.size(); j++) {
				if(calc(v[j-1]+1,v[j],i)>k) return inf;
				arr[j]=calc(v[j-1]+1,v[j],i);
			}
		}
	}
	return ans;
}
int main() {
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1; i<=n; i++) {
		scanf("%s",mp[i]+1);
	}
	int N=1<<(n-1);
	int ans=inf;
	for(int i=0; i<N; i++) {
		int tmp=0;
		v.pb(0);
		for(int j=0; j<=n-2; j++) {
			if(i&(1<<j)) v.pb(j+1);
		}
		v.pb(n);
		ans=min(ans,(int)v.size()-2+check());
		v.clear();
	}
	printf("%d\n",ans);
	return 0;

}

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

#define range(i, start, end) for(int i=start; i<end; i++)
#define rep(i, n) for(int i=0; i<n; i++)

int main() {
  int n;
  cin >> n;
  cout << n/3 << "\n";
}


Measured memory_bytes: 256
N = gets.to_i
ABs= readlines.map{|l| l.split.map(&:to_i)}

G = Hash[(ABs + ABs.map{|a, b| [b, a]}).group_by(&:first).map{|k, v| [k, v.map(&:last)]}]
b, w, h = G[1], G[N], {1 => :b, N => :w}
until (b + w).empty?
  b = b.reject{|i| h.key?(i)}.each{|i| h[i] = :b}.flat_map{|i| G[i]}.uniq
  w = w.reject{|i| h.key?(i)}.each{|i| h[i] = :w}.flat_map{|i| G[i]}.uniq
end
puts h.values.count(:b) > N/2 ? 'Fennec' : 'Snuke'

Measured memory_bytes: 67948
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  string s;
  cin >> s;
  string t;
  ll ans=0;
  for(int i=0;i<s.size();i++){
    ans+=s.at(i)-'0';
  }
  if(ans%9==0){
    t="Yes";
  }else{
    t="No";
  }
  cout << t;
}

Measured memory_bytes: 3640
#include<stdio.h>

int main(){
	int w,h;
	int x,y;
	while(1){
		scanf("%d %d",&h,&w);
		if(w==0 && h==0)
			break;
		for(y=0;y<h;y++){
			for(x=0;x<w;x++)
				printf("#");
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
n,a,b=map(int,input().split())

if((b-a)%2==0):
	print((b-a)//2)
else:
	ans=10**20

	ta=a
	tb=b
	tp=0
	tp+=ta-1
	ta=1
	tb-=tp+1
	tp+=1
	ans=min(ans,(tb-ta)//2+tp)

	ta=a
	tb=b
	tp=n-tb
	tb=n
	ta+=tp+1
	tp+=1
	ans=min(ans,(tb-ta)//2+tp)

	print(ans)



Measured memory_bytes: 3064
using System;
using System.Linq;

namespace AOJ
{
	class Program
	{
		public static void Main(string[] args)
		{
			var s = "";
			var p = 0;
			while((s = Console.ReadLine()) != null)
			{
				if(s == new string(s.Reverse().ToArray()))
				{
					p++;
				}
			}
			Console.WriteLine(p);
		}
	}
}

Measured memory_bytes: 5864
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,jumlah=0;
	cin >> n;
	int d[n];
	for(int i=0;i<n;i++){
		cin >> d[i];
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			jumlah+=d[i]*d[j];
		}
	}
	cout << jumlah << endl;
}

Measured memory_bytes: 256
import sys

def get_maximum_profit():
    element_number = int(input())
    v0 = int(input())
    v1 = int(input())

    min_v = min(v0, v1)
    max_profit = v1-v0

    for v in map(int, sys.stdin.readlines()):
        max_profit = max(max_profit, v-min_v)
        min_v = min(min_v, v)

    print(max_profit)

if __name__ == '__main__':
    get_maximum_profit()

Measured memory_bytes: 21936
// Winners don't quit and Quitters don't win
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
int 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(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,x,y,i,limit1,limit2;
    vll a,b;
    cin>>n;
    for(i=0;i<n;++i){
    	cin>>x>>y;
    	a.pb(x);
    	b.pb(y);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    
    if(n%2){
        limit1 = a[n/2];
        limit2 = b[n/2];
        cout<<(limit2-limit1+1);
    }
    else{
    	x = n/2;
    	limit1 = (a[x] + a[x-1]);
    	limit2 = (b[x] + b[x-1]);
    	cout<<(limit2 - limit1 + 1);
    }
}


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

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

	int cnt_l, cnt_r;
	cnt_l = cnt_r = 0;
	for (int i = 0; i < M; ++i) {
		int a;
		cin >> a;
		if (a < X)
			++cnt_l;
		else
			++cnt_r;
	}
	int ans = min(cnt_l, cnt_r);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
/** 
 * Title: https://atcoder.jp/contests/dp/submissions/12228786
 * Url: https://atcoder.jp/contests/dp/tasks/dp_b
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define INF 1000000000

const int MAX_N = 100000;

int main() {

    int n, k; cin >> n >> k;
    int h[MAX_N+1], cost[MAX_N+1];
    for(int i=0; i<n; i++) cin >> h[i+1];
    for(int i=1; i<=MAX_N; i++) cost[i] = INF;
    cost[1] = 0;
    for(int i=2; i<=n; i++) {
        if(i<k) {
            for(int j=1; j<i; j++) {
                cost[i] = min(cost[i], cost[i-j]+abs(h[i]-h[i-j]));
            }
        } else {
            for(int j=1; j<=k; j++) {
                cost[i] = min(cost[i], cost[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    cout << cost[n] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    rep(i, N) cin >> A[i];
    rep(i, N) {
        if (A[i] == 0) {
            cout << 0 << "\n";
            return 0;
        }
    }
    __int128 now = 1;
    rep(i, N) {
        now *= A[i];
        if (now > 1000000000000000000) {
            cout << -1 << "\n";
            return 0;
        }
    }
    long long ans = (long long)now;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3976
N,M = gets.split.map(&:to_i)

UF = [-1]*(N+1)
F = lambda{|a|
	next UF[a]<0 ? a : UF[a]=F[UF[a]]
}
U = lambda{|ab|
	a,b = ab.split.map(&:to_i).map(&F)
	next if a == b
	a,b = b,a unless UF[a]<UF[b]
	UF[a] += UF[b]
	UF[b] = a
}
$<.each(&U)

p UF.count{|g| g<0 }-2


Measured memory_bytes: 15180
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"

struct edge { int first,second,height; };
int dfs(const int now, const int from, vector<vector<edge>>&es) {



	int len = 0;
	for (auto& e : es[now]) {
		if (e.first == from)continue;
		else {
			if (e.height == -1) {
				e.height = dfs(e.first, now, es);
			}
				len = max(len, e.second + e.height);

		}
	}
	return len;
	
}

int main() {
	int N; cin >> N;
	vector < vector<edge>>edges(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b, c; cin >> a >> b >> c;
		edges[a].push_back(edge{ b, c,-1 });
		edges[b].push_back(edge{ a,c ,- 1});

	}
	vector<int>hs(N);
	for (int i = 0; i < N; ++i) {
		hs[i] = dfs(i, -1, edges);
		cout << hs[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4164
#include<stdio.h>
int n;
char s[30004];
int f(int a, int b, int c)
{
	int fa, fb, fc;
	int i;
	fa = fb = fc = 0;
	for (i = 0; i < n; i++)
	{
		if (s[i] == c + '0')
		{
			if (fb > 0)
				return 1;
		}
		if (s[i] == b + '0')
		{
			if (fa > 0)
				fb = 1;
		}
		if (s[i] == a + '0')
			fa = 1;
	}
	return 0;
}
int main()
{
	scanf("%d", &n);
	scanf("%s", s);
	int ans = 0;
	int i, j, k;
	for (i = 0; i < 10; i++)
		for (j = 0; j < 10; j++)
			for (k = 0; k < 10; k++)
				if (f(i, j, k) > 0)
				{
					ans++;
				}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
abcde = []
for _ in range(5):
    abcde.append(int(input()))
k = int(input())

def func():
    for i in range(4):
        for j in range(i,5):
            if abcde[j]-abcde[i] > k:
                return ":("
    return "Yay!"
  
print(func())

Measured memory_bytes: 38384
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

ll g(ll x) {
    //各桁に着目
    ll ans = 0;
    for (ll i = 0; i < 60; i++) {
        //考えやすいように最初0が続くところを除く
        ll length = x - ((1LL << i) - 1);
        if (length < 0) {
            break;
        }

        ll loop_width = (1LL << (i + 1));
        ll num = length / loop_width * loop_width / 2 + min(length % loop_width, loop_width / 2);
        ans |= (num % 2 << i);
    }
    return ans;
}

ll f(ll A, ll B) {
    return g(A - 1) ^ g(B);
}

int main() {
    ll A, B;
    cin >> A >> B;
    cout << f(A, B) << endl;
}

Measured memory_bytes: 256
# coding: utf-8

s = input()

ans0 = 0
ans1 = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "0":
            ans0 += 1
    else:
        if s[i] == "1":
            ans0 += 1

for i in range(len(s)):
    if i % 2 == 1:
        if s[i] == "0":
            ans1 += 1
    else:
        if s[i] == "1":
            ans1 += 1

print(min([ans0, ans1]))


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

using namespace std;

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

    vector<int> ans(n+1,0);

    int nn = sqrt(n);

    for(int x = 1; x <= nn; ++x){
        for(int y = 1; y <= nn; ++y){
            for(int z = 1; z <= nn; ++z){
                int f = x*x+y*y+z*z+x*y+y*z+z*x;
                if(f <= n){
                    ans[f]++;
                }
            }
        }
    }

    for(int i = 1; i <= n; ++i){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3772
/*
	problem: 
	
	
*/

#include<bits/stdc++.h>
/*
#pragma GCC optamize("O2")
#pragma G++ optamize("O2")
*/
using namespace std;
const long long maxn = 0x3f3f3f3f;
typedef long long LL;

LL N, K, C;
// string s;
LL ans[200100];
char s[200100];

int main() {
	
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	
	LL i, j, k;
    scanf("%lld%lld%lld", &N, &K, &C);
    scanf("%s", s);
    LL cnt = 0;
    for (i = 0; i < N; ++ i) {
        if (s[i] == 'o') {
            if (cnt < K) ++ ans[i];
            ++ cnt;
            i = i + C;
        }
    }
    if (cnt > K) return 0;
    LL cnt1 = 0;
    for (i = N - 1; i >= 0; -- i) {
        if (s[i] == 'o' && cnt1 < K) {
            ++ cnt1;
            ++ ans[i];
            i = i - C;
        }
        if (cnt1 >= K) break;
    }
    for (i = 0; i < N; ++ i) {
        if (ans[i] > 1) printf("%lld\n", i + 1);
    }
	
	return 0;
}
/*
11 3 2
ooxxxoxxxoo
5 2 3
ooxoo
16 4 3
ooxxoxoxxxoxoxxo
5 4 0
ooooo
*/ 


Measured memory_bytes: 5584
#include<bits/stdc++.h>
using namespace std ;
int main() {
    int a , b , c ;
  	cin >> a >> b >> c ;
  	if(a==b&&b==c&&a==c) {
  		cout << "No" << endl ; 
  		return 0 ;
	  }
  	if((a==b&&a!=c)||(a==c&&b!=c)||(b==c&&a!=c)) cout << "Yes" << endl;
  	else cout << "No" << endl ;
	return 0 ;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int xa,ya,xb,yb,xc,yc,wx,wy,r;

int crosscheck(int tx,int ty,int sx,int sy,int wx,int wy,int rr){

	int abx=sx-tx,aby=sy-ty;
	int awx=wx-tx,awy=wy-ty;
	int bwx=wx-sx,bwy=wy-sy;

	int rr2=rr*rr;
	int aw2=awx*awx+awy*awy;
	int bw2=bwx*bwx+bwy*bwy;
	int ab2=abx*abx+aby*aby;

	int tim=abx*awy-aby*awx;
	int abw=abx*awx+aby*awy;

	if(aw2<rr2 && bw2<rr2)return 0;
	if(aw2<rr2 || bw2<rr2)return 1;
	if( tim*tim/ab2 >= (double)rr2)return 0;
	if(abw<0)return 0;
	if(abw>ab2)return 0;
	return 1;
}

int touchcheck(int tx,int ty,int sx,int sy,int wx,int wy,int rr){

	int abx=sx-tx,aby=sy-ty;
	int awx=wx-tx,awy=wy-ty;
	int bwx=wx-sx,bwy=wy-sy;

	int rr2=rr*rr;
	int aw2=awx*awx+awy*awy;
	int bw2=bwx*bwx+bwy*bwy;
	int ab2=abx*abx+aby*aby;

	int tim=abx*awy-aby*awx;
	int abw=abx*awx+aby*awy;

	if(aw2<rr2 && bw2<rr2)return 0;
	if(aw2<rr2 || bw2<rr2)return 0;
	if( tim*tim/ab2 != (double)rr2)return 0;
	if(abw<0)return 0;
	if(abw>ab2)return 0;
	return 1;
}

int main(){
	if(crosscheck(10,3,10,9,10,10,1))printf("OK\n");

	while(scanf("%d %d",&xa,&ya)*xa){
		scanf("%d %d %d %d %d %d %d",&xb,&yb,&xc,&yc,&wx,&wy,&r);

		int ttt=0;

		int d1=(xa-wx)*(xa-wx)+(ya-wy)*(ya-wy)-r*r;
		int d2=(xb-wx)*(xb-wx)+(yb-wy)*(yb-wy)-r*r;
		int d3=(xc-wx)*(xc-wx)+(yc-wy)*(yc-wy)-r*r;
		int tim1=(wx-xa)*(yb-ya)-(wy-ya)*(xb-xa);
		int tim2=(wx-xb)*(yc-yb)-(wy-yb)*(xc-xb);
		int tim3=(wx-xc)*(ya-yc)-(wy-yc)*(xa-xc);

		if (tim1*tim2>0 && tim2*tim3>0) ttt=1;

		if(d1<=0 && d2<=0 && d3<=0){printf("b\n");continue;}
		if(d1==0 || d2==0 || d3==0){printf("c\n");continue;}

		if(crosscheck(xa,ya,xb,yb,wx,wy,r)){printf("c\n");continue;}
		else if(crosscheck(xb,yb,xc,yc,wx,wy,r)){printf("c\n");continue;}
		else if(crosscheck(xc,yc,xa,ya,wx,wy,r)){printf("c\n");continue;}

		if(ttt==1){printf("a\n");continue;}

		if(touchcheck(xa,ya,xb,yb,wx,wy,r)){printf("c\n");continue;}
		else if(touchcheck(xb,yb,xc,yc,wx,wy,r)){printf("c\n");continue;}
		else if(touchcheck(xc,yc,xa,ya,wx,wy,r)){printf("c\n");continue;}
		
		printf("d\n");

	}
	return 0;
}

Measured memory_bytes: 584
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("Yes\n")
#define ptn printf("No\n")
//==========================Code here==========================
LL n, a, b, c, d;
char s[200000 + 5];
int main() {
	cin >> n >> a >> b >> c >> d;
	scanf("%s", s + 1);
	s[++n] = '#';
	
	for (LL i = b; i < d; ++i) {
		if (s[i] == '#' && s[i + 1] == '#') return ptn, 0;
	} 
	for (LL i = a; i < c; ++i) {
		if (s[i] == '#' && s[i + 1] == '#') return ptn, 0;
	}
	
	if (c < d) return pty, 0;
	
	for (LL i = b - 1; i <= d - 1; ++i) {
		if (s[i] == s[i + 1] && s[i + 1] == s[i + 2] && s[i] == '.') return pty, 0;
	}
	if(s[b-1]=='.'&&s[b+1]=='.') return pty, 0;
	
	return ptn, 0;
	
	/*LL maxi = 0, cnt=0;
	for(int i=b;i<=d+1;i++)
	{
		if(s[i]=='.') cnt++;
		else cnt=0;
		maxi=max(maxi,cnt);
	}
	if(s[b-1]=='.'&&s[b+1]=='.') maxi=3;
	if(maxi<=2)
		printf("No");
	else printf("Yes");*/
	
	return 0;
}
/*
11 5 9 9 11
..##..#..#.

9 4 6 9 8 
.##...#..
*/

Measured memory_bytes: 384
#include<stdio.h>
 
int main(void){
    int i,n[6],s[6];
     
    for(i=0;i<6;i++){
        scanf("%d", &n[i]);
    }
    for(i=0;i<6;i++){
       scanf("%d",&s[i]);
    }
     
    if(n[0]==s[5]&&n[1]==s[1]&&n[2]==s[3]&&n[3]==s[2]&&n[4]==s[4]&&n[5]==s[0]){
    printf("Yes\n");
    }
    else if(n[0]==s[0]&&n[1]==s[1]&&n[2]==s[2]&&n[3]==s[3]&&n[4]==s[4]&&n[5]==s[5]){
    printf("Yes\n");
    }
    else if(n[0]==s[4]&&n[1]==s[0]&&n[2]==s[2]&&n[3]==s[3]&&n[4]==s[5]&&n[5]==s[1]){
    printf("Yes\n");
    }
    else if(n[0]==s[3]&&n[1]==s[4]&&n[2]==s[5]&&n[3]==s[0]&&n[4]==s[1]&&n[5]==s[2]){
    printf("Yes\n");
    }
    else if(n[0]==s[1]&&n[1]==s[0]&&n[2]==s[3]&&n[3]==s[2]&&n[4]==s[5]&&n[5]==s[4]){
    printf("Yes\n");
    }
    else if(n[0]==s[3]&&n[1]==s[5]&&n[2]==s[1]&&n[3]==s[4]&&n[4]==s[0]&&n[5]==s[2]){
    printf("Yes\n");
    }
    else if(n[0]==s[5]&&n[1]==s[3]&&n[2]==s[4]&&n[3]==s[1]&&n[4]==s[2]&&n[5]==s[0]){
    printf("Yes\n");
    }
    else if(n[0]==s[0]&&n[1]==s[3]&&n[2]==s[1]&&n[3]==s[4]&&n[4]==s[2]&&n[5]==s[5]){
    printf("Yes\n");
    }
    else if(n[0]==s[0]&&n[1]==s[4]&&n[2]==s[3]&&n[3]==s[2]&&n[4]==s[1]&&n[5]==s[5]){
    printf("Yes\n");
    }
    else if(n[0]==s[0]&&n[1]==s[2]&&n[2]==s[4]&&n[3]==s[1]&&n[4]==s[3]&&n[5]==s[5]){
    printf("Yes\n");
    }
    else if(n[0]==s[2]&&n[1]==s[1]&&n[2]==s[5]&&n[3]==s[0]&&n[4]==s[4]&&n[5]==s[3]){
    printf("Yes\n");
    }
    else if(n[0]==s[1]&&n[1]==s[3]&&n[2]==s[5]&&n[3]==s[0]&&n[4]==s[2]&&n[5]==s[4]){
    printf("Yes\n");
    }
    else if(n[0]==s[4]&&n[1]==s[2]&&n[2]==s[5]&&n[3]==s[0]&&n[4]==s[3]&&n[5]==s[1]){
    printf("Yes\n");
    }
    else if(n[0]==s[5]&&n[1]==s[4]&&n[2]==s[2]&&n[3]==s[3]&&n[4]==s[1]&&n[5]==s[0]){
    printf("Yes\n");
    }
    else if(n[0]==s[5]&&n[1]==s[2]&&n[2]==s[1]&&n[3]==s[4]&&n[4]==s[3]&&n[5]==s[0]){
    printf("Yes\n");
    }
    else if(n[0]==s[3]&&n[1]==s[1]&&n[2]==s[0]&&n[3]==s[5]&&n[4]==s[4]&&n[5]==s[2]){
    printf("Yes\n");
    }
    else if(n[0]==s[4]&&n[1]==s[3]&&n[2]==s[0]&&n[3]==s[5]&&n[4]==s[2]&&n[5]==s[1]){
    printf("Yes\n");
    }
    else if(n[0]==s[2]&&n[1]==s[4]&&n[2]==s[0]&&n[3]==s[5]&&n[4]==s[1]&&n[5]==s[3]){
    printf("Yes\n");
    }
    else if(n[0]==s[1]&&n[1]==s[2]&&n[2]==s[0]&&n[3]==s[5]&&n[4]==s[3]&&n[5]==s[4]){
    printf("Yes\n");
    }
    else if(n[0]==s[1]&&n[1]==s[5]&&n[2]==s[2]&&n[3]==s[3]&&n[4]==s[0]&&n[5]==s[4]){
    printf("Yes\n");
    }
    else if(n[0]==s[3]&&n[1]==s[5]&&n[2]==s[1]&&n[3]==s[4]&&n[4]==s[0]&&n[5]==s[2]){
    printf("Yes\n");
    }
    else if(n[0]==s[4]&&n[1]==s[5]&&n[2]==s[3]&&n[3]==s[2]&&n[4]==s[0]&&n[5]==s[1]){
    printf("Yes\n");
    }
    else if(n[0]==s[2]&&n[1]==s[5]&&n[2]==s[4]&&n[3]==s[1]&&n[4]==s[0]&&n[5]==s[3]){
    printf("Yes\n");
    }
    else if(n[0]==s[3]&&n[1]==s[0]&&n[2]==s[4]&&n[3]==s[1]&&n[4]==s[5]&&n[5]==s[2]){
    printf("Yes\n");
    }
    else if(n[0]==s[4]&&n[1]==s[0]&&n[2]==s[2]&&n[3]==s[3]&&n[4]==s[5]&&n[5]==s[1]){
    printf("Yes\n");
    }
    else if(n[0]==s[2]&&n[1]==s[0]&&n[2]==s[1]&&n[3]==s[4]&&n[4]==s[5]&&n[5]==s[3]){
    printf("Yes\n");
    }
    else{
    printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  if(N==1){
    cout << "Hello World" << endl;
    return 0;
  }
  int A,B;
  cin >> A >> B;
  cout << A+B << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())

l = []
for i in range(1, N+1):
  while i % 2 == 0:
    l.append(2)
    i //= 2
  f = 3
  while f * f <= i:
    if i % f == 0:
      l.append(f)
      i //= f
    else:
      f += 2
  if i != 1:
    l.append(i)

c = Counter(l)
m = c.most_common()
c_75, c_25, c_15, c_5, c_3 = 0, 0, 0, 0, 0
for a in m:
  if a[1] >= 74:
    c_75 += 1
  if a[1] >= 24:
    c_25 += 1
  if a[1] >= 14:
    c_15 += 1
  if a[1] >= 4:
    c_5 += 1
  if a[1] >= 2:
    c_3 += 1
    
ans = c_75
ans += c_25 * (c_3-1)
ans += c_15 * (c_5-1)
ans += (c_5*(c_5-1)//2) * (c_3-2)
print(ans)

Measured memory_bytes: 9344
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int w, h, n;
    sc(w) sc(h) sc(n)
    int x[n], y[n], a[n];
    REP (i, n){
        sc(x[i]) sc(y[i]) sc(a[i])
    }
    int ans1[w], ans2[h];
    fill(ans1, ans1 + w, 0);
    fill(ans2, ans2 + h, 0);
    REP(i, n){
        if (a[i] == 1){
            REP(j, x[i]) ans1[j] = -1;
        }else if (a[i] == 2){
            for (int j = x[i]; j < w; j++) ans1[j] = -1;
        }else if (a[i] == 3){
            REP(j, y[i]) ans2[j] = -1;
        }else{
            for (int j = y[i]; j < h; j++) ans2[j] = -1;
        }
    }
    int aw = 0, ah = 0;
    REP(i, w){
        if (ans1[i] == 0) aw += 1;
    }
    REP(i, h){
        if (ans2[i] == 0) ah += 1;
    }
    cout << aw * ah << endl;
    return 0;
}

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

#define N 2*123456

int main(int argc, char *argv[])
{
  int i, j;
  int isPrime[1+N];
  
  for(i = 2; i <= N; ++i){
    isPrime[i] = 1;
  }
  
  for(i = 2; i < N; ++i){
    if( isPrime[i] ){
      for(j = 2; i * j <= N; ++j){
        isPrime[i * j] = 0;
      }
    }
  }

  while(1){
    int x, n;
    int res = 0;

    scanf("%d", &n);
    if( n == 0 ) break;
    
    for(x = n+1; x <= 2*n; ++x){
      if( isPrime[ x ] ) ++res;
    }
    
    printf("%d\n", res);
  }
  return (EXIT_SUCCESS);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    cout << (N + 999) / 1000 * 1000 - N << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 3632
n,k = map(int, input().split())
if n==1:
  print(abs(int(input())))
  exit()
a = list(map(int, input().split()))
g = []
for i in range(n-k+1):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))

Measured memory_bytes: 86928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int dy[] = {0, -1, 0, 1};
const int dx[] = {1, 0, -1, 0};
int m, n;
int num[2000][2000];
int dp[2000][2000];
int flag[2000][2000];
pii pos[1000010];
int is_prime[1000010];

void sieve(int n) {
  fill_n((int*)is_prime, n, 1);
  is_prime[0] = is_prime[1] = 0;
  for (int i = 2; i < n; i++) {
    if (!is_prime[i]) continue;
    for (int j = 2 * i; j < n; j += i) {
      is_prime[j] = 0;
    }
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  sieve(1000010);
  int y = 1000, x = 1000, id = 1, w = 1, dir = 0;
  while (id <= 1000000) {
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < w && id <= 1000000; j++) {
        num[y][x] = id;
        pos[id++] = pii(y, x);
        y += dy[dir]; x += dx[dir];
      }
      dir = (dir + 1) % 4;
    }
    w++;
  }

  // for (int i = 995; i <= 1005; i++) {
  //   for (int j = 995; j <= 1005; j++) {
  //     cerr << setw(4) << num[i][j] << " \n"[j == 1005];
  //   }
  // }

  while (cin >> m >> n, m) {
    fill_n((int*)dp, 2000 * 2000, 0);
    fill_n((int*)flag, 2000 * 2000, 0);
    int y, x;
    tie(y, x) = pos[n];
    dp[y][x] = is_prime[n];
    flag[y][x] = 1;
    for (int i = 1; i < 2000; i++) {
      for (int j = 0; j < 2000; j++) {
        if (num[i][j] == 0 || num[i][j] > m) continue;
        // cout << i << " " << j << " " << num[i][j] << endl;
        if (j > 0 && flag[i - 1][j - 1] && num[i - 1][j - 1] <= m) {
          dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + is_prime[num[i][j]]);
          flag[i][j] = 1;
        }
        if (flag[i - 1][j] && num[i - 1][j] <= m) {
          dp[i][j] = max(dp[i][j], dp[i - 1][j] + is_prime[num[i][j]]);
          flag[i][j] = 1;
        }
        if (j + 1 < 2000 && flag[i - 1][j + 1] && num[i - 1][j + 1] <= m) {
          dp[i][j] = max(dp[i][j], dp[i - 1][j + 1] + is_prime[num[i][j]]);
          flag[i][j] = 1;
        }
      }
    }
    int p = 0, q = 0;
    for (int i = 1; i <= m; i++) {
      int y, x;
      tie(y, x) = pos[i];
      if (dp[y][x] >= p) {
        if (dp[y][x] == p) {
          if (is_prime[i]) {
            q = max(q, i);
          }
        } else {
          q = i;
        }
        p = dp[y][x];
      }
    }
    cout << p << " " << (p == 0 ? 0 : q) << endl;
  }

  return 0;
}


Measured memory_bytes: 53960
#include <bits/stdc++.h>
using namespace std;
 
int read() {
    int f = 1, x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    x *= f; return x;
}
 
/*============ Header Template ============*/

int R, C, n;
struct point {
	int x, num;
}p[200005];
int cnt;
bool isedge(int x, int y) {
	if (x == 0 || x == R || y == 0 || y == C) return 1;
	return 0;
}
bool isimport(int x, int y, int X, int Y) {
	return (isedge(x, y) & isedge(X, Y));
}
int get(int x, int y){
	if (y == 0) return x;
	if (x == R) return R + y;
	if (y == C) return R + C + R - x;
	if (x == 0) return R + C + R + C - y;
	return -1;
}
bool cmp(point a, point b) {
	return a.x < b.x;
}
void judge() {
	stack<int> sta;
	sort(p + 1, p + 1 + cnt, cmp);
	for (int i = 1; i <= cnt; i ++) {
		if (sta.empty()) sta.push(p[i].num);
		else if (sta.top() == p[i].num) sta.pop();
		else sta.push(p[i].num);
	}
	if (!sta.empty()) puts("NO");
	else puts("YES");
}
int main() {
	R = read(); C = read(); n = read();
	for (int i = 1; i <= n; i ++) {
		int x = read(), y = read(), X = read(), Y = read();
		if (isimport(x, y, X, Y)) {
			p[++ cnt].x = get(x, y); p[cnt].num = i;
			p[++ cnt].x = get(X, Y); p[cnt].num = i;
		}
	}
	judge();
	return 0;
}
/*
2 2 4
0 0 2 2
2 0 0 1
0 2 1 2
1 1 2 1
*/

Measured memory_bytes: 2176
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment (linker, "/stack:256000000")

#include <iostream>
#include <cstdio>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <cmath>
#include <cassert>
#include <ctime>
#include <memory.h>

using namespace std;

#define fo(a,b,c) for(int a=(b);a<(c);a++)
#define fd(a,b,c) for(int a=(b);a>=(c);a--)
#define fi(a) fo(i,0,(a))
#define fj(a) fo(j,0,(a))
#define fk(a) fo(k,0,(a))
#define _(a,b) memset((a),(b),sizeof(a))
#define __(a) memset((a),0,sizeof(a))
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#ifdef _DEBUG
#define dbg(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);}
#define dbgx(x) {cerr << #x << " = " << (x) << endl;}
#else
#define dbg(...) {}
#define dbgx(x) {}
#endif

typedef long long lint;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int INF = 1000000000;
const lint LINF = 4000000000000000000LL;
const double eps = 1e-9;

void prepare()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
}

const int maxn = 100100;
const lint mod = INF + 7;

int n, x[maxn];

void read()
{
	scanf("%d", &n);
	fi(n)
		scanf("%d", &x[i]);
}

lint get(int id, int cnt)
{
	if (id >= n)
	{
		lint res = 1;
		fi(cnt)
			(res *= i + 1) %= mod;
		return res;
	}
	x[id] = min(x[id], x[id - 1] + 2);
	if (x[id] - x[id - 1] < 2)
	{
		x[id] = x[id - 1];
		return (lint)(cnt + 1) * get(id + 1, cnt) % mod;
	}
	return get(id + 1, cnt + 1);
}

bool solve()
{
	lint res = 1, mod = INF + 7, cur = 1, cnt = 1;
	x[0] = 1;
	cout << get(1, 1) << endl;
	return false;
}

int main()
{
	prepare();
	read();
	while (solve());
	return 0;
}

Measured memory_bytes: 1408
def judger(s):
    '''
    input:
    s = 5 target characters
    output:
    Predict word from the first 5 characters 
    '''
    if s == 'maerd':
        return 'maerd'
    elif s == 'remae':
        return 'remaerd'
    elif s == 'esare':
        return 'esare'
    elif s == 'resar':
        return 'resare'
    else:
        raise ValueError
        
s = input()
sT = s[::-1]

flag = 'YES'
while sT:
    try:
        target = judger(sT[0:5])
        if target == sT[0: len(target)]:
            sT = sT[len(target):]
        else:
            flag = 'NO'
            break
    except ValueError:
        flag = 'NO'
        break

print(flag)

Measured memory_bytes: 3316
<?php
fscanf(STDIN, "%d %d", $n, $m);
for ($i = 0; $i < $m; $i++) {
	fscanf(STDIN, "%d %d", $a[$i], $b[$i]);
	$g[$a[$i]][$b[$i]] = $g[$b[$i]][$a[$i]] = 1;
}
$x = 0;
for ($i = 0; $i < $m; $i++) {
	$tmp = [$a[$i]];
	$f = [$a[$i] => 1];
	while ($tmp) {
		$p = array_shift($tmp);
		foreach ($g[$p] as $q => $r) {
			if ($p != $a[$i] && $q == $b[$i]) {
				$x++;
				break 2;
			} elseif ($q != $b[$i] && !isset($f[$q])) {
				$tmp[] = $q;
				$f[$q] = 1;
			}
		}
	}
}
echo $m - $x;

Measured memory_bytes: 4604
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int zikan = m * 1900 + (n - m) * 100;
        int result = zikan * (int)Math.pow(2,m);
        System.out.println(result);
        sc.close();
    }
}

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

int main(){
  int X, Y;;
  cin >> X >> Y;
  long ans = 0;
  if(X == 3) ans += 100000;
  else if(X == 2) ans += 200000;
  else if(X == 1) ans += 300000;
  
  if(Y == 3) ans += 100000;
  else if(Y == 2) ans += 200000;
  else if(Y == 1) ans += 300000;  
  
  if(X == 1 && Y == 1) ans += 400000;  
  cout << ans << endl;
}

Measured memory_bytes: 256
loop do
  line = gets.chomp.split
  a = line[0].to_i
  op = line[1]
  b = line[2].to_i

  case op
  when '+'
    puts a+b
  when '-'
    puts a-b
  when '*'
    puts a*b
  when '/'
    puts a/b
  when '?'
    break
  end
end

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

int main(){
    int n,m;
    cin >> n >> m;
    
    ll mod = 1e9+7;
    ll dp[n+1];
    rep(i,n+1)dp[i] = 0;
    dp[0] = dp[1] = 1;
    
    int a[m];
    map<int,int> mp;
    rep(i,m){
        cin >> a[i];
        mp[a[i]--]++;
    }
    
    dp[0] -= mp[0];
    dp[1] -= mp[1];
    
    for(int i = 2;i <= n;i++){
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= mod;
        
        if(mp[i] > 0)dp[i] = 0;
    }
    cout << dp[n] << endl;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    int q = 0;//総得票数
    double p0 = 1/double(m)/4;
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        q += a.at(i);
    }
    //cout << "sum=" << q << endl;
    int count=0;
    for(int i=0;i<n;i++){
        double p = double(a.at(i))/double(q);
        //cout << "p" << "(" << i << ")=" << p << endl;
        if(p>=p0){
            count++;
        }
    }
    if(count >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  string X;
  cin>>X;
  if(((X[0]==X[2])&&(X[0]==X[1]))||((X[1]==X[3])&&(X[2]==X[3]))) cout<<"Yes";
  else cout<<"No";

}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;
#define N 100009
#define mod 1000000007

int main(){
    ll n;
    cin>>n;
    ll a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    ll p=min(a,b);
    p=min(p,c);
    p=min(p,d);
    p=min(p,e);
    ll q;
    if (n%p!=0) q=n/p+1;
    else q=n/p;
    cout<<q+4<<endl;
}

Measured memory_bytes: 256
S,C=map(int,input().split())
if C<2*S:
  print(int(C/2))
else:
  if (C-2*S)%4==0:
    k=(C-2*S)/4
  else:
    k=int(1+(C-2*S)/4)
  print(int((C-2*k)/2))

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

int n;
int a[11];

int calc() {
	int pw[11];
	pw[1] = 1;
	for(int i=2;i<=n;i++) pw[i] = pw[i-1] * i;
	
	int res = 0;
	for(int i=1;i<=n;i++) {
		int cnt = 0;
		for(int j=i+1;j<=n;j++)
			if(a[j]<a[i]) cnt++;
		res += cnt * pw[n-i];
	}
	return res;
}

int main() {
	scanf("%d", &n);
	for(int i=1;i<=n;i++) scanf("%d", &a[i]);
	int x = calc();
	for(int i=1;i<=n;i++) scanf("%d", &a[i]);
	int y = calc();
	
	printf("%d\n", labs(x-y));
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
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; }

signed main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<set<int>> eng(26);
  rep(i,0,n){
    eng[s[i]-'a'].insert(i);
  }
  rep(i,0,q){
    int a;
    cin >> a;
    if(a == 1){
      int b;
      char c;
      cin >> b >> c;
      b--;
      eng[s[b]-'a'].erase(b);
      s[b] = c;
      eng[s[b]-'a'].insert(b);
    }
    else{
      int b,c;
      cin >> b >> c;
      b--;c--;
      int ans = 0;
      rep(j,0,26){
        auto it = eng[j].lower_bound(b);
        if(it != eng[j].end() && *it <= c){
          ans++;
        }
      }
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 24196
#n=int(input())
#A=list(map(int,input().split()))
#b=list(map(int,input().split()))
s=list(input())
n=len(s)
for i in range(n-1):
        tmp="".join(s[i:i+2])
        if tmp=="AC":
                print("Yes")
                exit()
print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n, a;
  cin >> n >> a;
  cout << n*n-a << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>

//using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

using ll =  long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}
}


int main() {

	int n, m;
	std::cin >> n >> m;

	if (n == m) std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;

	return 0;
}

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

using namespace std;
const int N=5e3+10;

int n, m, x;
int a[N], b[N], t[N], dp[N];

int main() {
	cin>>n>>m;
	for(int i=1; i<=m; i++) {
		cin>>a[i]>>b[i];
		for(int j=1; j<=b[i]; j++) {
			cin>>x;
			t[i]^=(1<<(x-1));
		}
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0]=0;
	for(int i=1; i<=m; i++) {
		for(int j=(1<<n)-1; j>=0; j--) {
			dp[j|t[i]]=min(dp[j|t[i]], dp[j]+a[i]);
		}
	}
	int ans=dp[(1<<n)-1];
	if (ans==0x3f3f3f3f) cout<<-1<<endl;
	else cout<<dp[(1<<n)-1]<<endl;
	return 0;
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a==7 && b==5 && c==5) cout << "YES" << endl;
    else if (a==5 && b==5 && c==7) cout << "YES" << endl;
    else if (a==5 && b==7 && c==5) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
string = input()
q = int(input())
for _ in range(q):
    operation = tuple(input().split())
    if operation[0] == 'print':
        print(string[int(operation[1]):int(operation[2]) + 1])
    elif operation[0] == 'reverse':
        if int(operation[1]) - 1 < 0:
            string = string =  string[:int(operation[1])] + string[int(operation[2])::-1] + string[int(operation[2]) + 1:]
        else:
            string =  string[:int(operation[1])] + string[int   (operation[2]):int(operation[1]) - 1:-1] + string  [int(operation[2]) + 1:]
    elif operation[0] == 'replace':
        string = string[:int(operation[1])] + operation[3] + string[int(operation[2]) + 1:]



Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[3];
	a[0]=n/1000;
	a[1]=n%1000/100;
	a[2]=n%1000%100/10;
	a[3]=n%1000%100%10;
	if (a[0]==a[1] && a[1]==a[2])
	cout<<"Yes";
	else if (a[1]==a[2] && a[2]==a[3])
	cout<<"Yes";
	else
	cout<<"No";
}


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

int main() {
    int A, B;
    char op;
    cin >> A >> op >> B;
    if (op == '+'){
        cout << A + B << endl;
    }
    else {
        cout << A - B << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M int (1e9+7)
int main() {
	int n, k;
	cin >> n >> k;
	long double ans = 0;
	int id = 1;
	long double res = 1.0 / n;
	for (int i = n; i >= 1; i--){
		int x = id;
		for (;i * id < k; id *= 2);
		for (; x < id; x *= 2)
			res *= 1.0 / 2;
		ans += res;
	}
	cout.precision(12);
	cout <<ans <<endl;
	return 0;
}


Measured memory_bytes: 256