akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * fh;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

typedef long long ll;
typedef pair<ll, ll> pll;
#define fir first
#define sec second
#define mp make_pair
const ll Mod = 1e9 + 7;
const int N = 201000;

ll ans = 0;
ll fpm(ll x, ll power) {
	ll res = 1;
	for (; power; power >>= 1, (x *= x) %= Mod)
		if (power & 1) (res *= x) %= Mod;
	return res;
}

int fa[N], n, tot[N];
vector<int> G[N];

int id[N], num = 0, d[N];
vector<pll> dp[N];

ll All[N], Zero[N], One[N];

void Dfs(int u) {
	int son = n + 1;
	for (int v : G[u]) { Dfs(v); if (d[v] > d[son]) son = v;}
	if (son != n + 1) id[u] = id[son], d[u] = d[son] + 1;
	else id[u] = ++num;
	dp[id[u]].push_back(mp(1, 1));

	if ((int)G[u].size() == 1) return ;

	For (i, 0, d[u] - 1)
		All[i] = 1, Zero[i] = 1, One[i] = 0;

	int nowdep;
	for (int v : G[u])
		For (i, 0, d[v]) {
			nowdep = (d[son] - d[v]) + i;
			pll sta = dp[id[v]][i];
			(All[nowdep] *= (sta.fir + sta.sec)) %= Mod;
			(Zero[nowdep] *= sta.fir) %= Mod;
		}

	for (int v : G[u])
		For (i, 0, d[v]) {
			nowdep = (d[son] - d[v]) + i;
			pll sta = dp[id[v]][i];
			(One[nowdep] += Zero[nowdep] * fpm(sta.fir, Mod - 2) % Mod * sta.sec % Mod) %= Mod;
		}

	For (i, 0, d[u] - 1) {
		dp[id[u]][i].fir = (All[i] - One[i] + Mod) % Mod;
		dp[id[u]][i].sec = One[i];
	}
}

int dep[N];

int main () {
	File();
	n = read();
	For (i, 1, n) {
		fa[i] = read();
		G[fa[i]].push_back(i);
		dep[i] = dep[fa[i]] + 1;
		++ tot[dep[i]];
	}
	++ tot[0];
	d[n + 1] = -1;

	Dfs(0);

	For (i, 0, d[0]) {
		pll sta = dp[id[0]][i];
		(ans += sta.sec * fpm(2, n + 1 - tot[d[0] - i]) % Mod) %= Mod;
	}
	printf ("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 53364
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	if ((A + B) % 2 == 0) {
		cout << (B - A) / 2 << endl;
	}
	else {
		cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
	}
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;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();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	long long n,ans=0;
	scanf("%lld",&n);
	if(n&1)puts("0");
	else
	{
		n/=2;
		while(n)n/=5,ans+=n;
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int a[7][7], b[7][7], c[7][7];
bool ers[7][7];
int s[6];
int ans;
int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1, 0};

void calc(){
	memcpy(b, a, sizeof a);
	bool update = true;
	int sum = 0;
	int bns = 1;
	while(update){
		update = false;
		memset(ers, 0, sizeof ers);

		for(int i = 1; i <= 5; ++i)
		for(int j = 1; j <= 5; ++j){
			int t = b[i][j];
			if(t == 0){ continue; }

			if(b[i+1][j] == t && b[i+2][j] == t){
				ers[i][j] = ers[i+1][j] = ers[i+2][j] = true;
				update = true;
			}
			if(b[i][j+1] == t && b[i][j+2] == t){
				ers[i][j] = ers[i][j+1] = ers[i][j+2] = true;
				update = true;
			}
		}

		for(int i = 1; i <= 5; ++i)
		for(int j = 1; j <= 5; ++j){
			if(ers[i][j]){
				sum += s[b[i][j]] * bns;
				c[i][j] = 0;
			}
			else{
				c[i][j] = b[i][j];
			}
		}

		memset(b, 0, sizeof b);
		for(int x = 1; x <= 5; ++x){
			int t = 5;
			for(int y = 5; y >= 1; --y){
				while(t > 0 && c[t][x] == 0){ --t; }
				b[y][x] = c[t][x];
				t = max(t - 1, 0);
			}
		}
		++bns;
	}
	
	ans = max(ans, sum);
}

void dfs(int n, int y, int x){
	calc();
	if(n > 0){
		for(int i = 0; i < 4; ++i){
			int ny = y + dy[i], nx = x + dx[i];
			if(a[ny][nx] != 0){
				swap(a[y][x], a[ny][nx]);
				dfs(n - 1, ny, nx);
				swap(a[y][x], a[ny][nx]);
			}
		}
	}
}

int main(){
	int n;
	while(scanf("%d", &n), n >= 0){
		for(int i = 1; i <= 5; ++i)
		for(int j = 1; j <= 5; ++j){
			scanf("%d", &a[i][j]);
		}
		for(int i = 1; i <= 5; ++i){
			scanf("%d", &s[i]);
		}

		ans = 0;
		for(int i = 1; i <= 5; ++i)
		for(int j = 1; j <= 5; ++j){
			dfs(n, i, j);
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1028
N = int(input())
A = list(map(int, input().split()))
INF = 10**20

DP = [[0 for _ in range(2)] for _ in range(N)]
DP[0][1] = -INF

for i in range(1,N): 
  DP[i][0] = max(DP[i-1][0] + A[i-1], DP[i-1][1] - A[i-1])
  DP[i][1] = max(DP[i-1][1] + A[i-1], DP[i-1][0] - A[i-1])
  #print(i,DP[i])
  
print(max(DP[N-1][0]+A[N-1], DP[N-1][1]-A[N-1]))

Measured memory_bytes: 93056
#include<bits/stdc++.h>
using namespace std;
double ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto &a : A) {
        cin >> a;
        ans += 1.0/a;
    }
    ans = 1.0/ans;
    printf("%lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
#include <numeric>
#include <stack>
#include <map>
using namespace std;
#define DEBUG 0
#define lli long long int

const lli Q_MAX = 100001;
lli N, K, Q;
lli A; //[Q_MAX];
lli B[Q_MAX];
lli ans = 0;

int main() {
	cin >> N >> K >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> A;
		B[A - 1] += 1;
	}
	for (int i = 0; i < N; i++) {
		if (B[i] + K - Q > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

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

int n, t, a;
int ans;
double tmp = 1e18;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> t >> a;
	for(int i=0; i<n; ++i){
		int h;
		cin >> h;
		if(abs(a-tmp)>abs(a-t+h*0.006)){
			tmp = t-h*0.006;
			ans = i+1;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	long long n,k;
	cin>>n>>k;
	long double ch[200010];
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	long double ans=0;
	for(ll i=0;i<k;i++){
		long double now=ch[i];
		now=(ch[i]+1)/2;
		ans+=now;
	}
	//printf("%.10Lf\n",ans);	
	long double cnt=ans;
	for(ll i=0;i+k<n;i++){
		cnt+=-(ch[i]+1)/2+(ch[i+k]+1)/2;
		ans=max(ans,cnt);
	}
	printf("%.10Lf",ans);
	// your code goes here
	return 0;
}

Measured memory_bytes: 6836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 10;
int c[maxn];
ll fac[maxn], inv[maxn], facinv[maxn], bin[maxn];
void pre()
{
	fac[0] = 1; for(int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[1] = 1; for(int i = 2; i < maxn; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	facinv[0] = 1; for(int i = 1; i < maxn; ++i) facinv[i] = facinv[i - 1] * inv[i] % mod;
	bin[0] = 1; for(int i = 1; i < maxn; ++i) bin[i] = bin[i - 1] * 2 % mod;
}
ll C(int n, int m) { return n < m ? 0 : fac[n] * facinv[m] % mod * facinv[n - m] % mod;}
ll get(int n)
{
	return n == 0 ? 1 : bin[n - 1] * (n + 2) % mod;
}
int main()
{
	pre();
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%lld", &c[i]);
	sort(c + 1, c + n + 1, greater<ll>());
	ll ret = 0;
	for(int i = 1; i <= n; ++i) ret += bin[n - i] * get(i - 1) % mod * c[i] % mod, ret %= mod;
	ret = ret * bin[n] % mod;
	printf("%lld\n", ret);
	return 0;
}
		
	

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

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<pair<int,int>,null_type, less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=1e5+10, mod=1e9+7;
ll dp[N][110];

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m,i,j;
	cin>>n>>m;
	vector<vector<char>> a(n+1,vector<char>(m+1));
	long double dp[n][n+1]; // taking fist i coins, with j heads
	
	for(i=0;i<n;i++){
		double p;
		cin>>p;
		if( i==0 ){
			dp[0][0]=1.0-p; dp[0][1]=p;
			for(j=2;j<=n;j++) dp[0][j]=0;
		}else{
			dp[i][0]=(long double)dp[i-1][0]*(1.0-p);
			for(j=1;j<=n;j++){
				dp[i][j]= (long double) dp[i-1][j]*(1.0-p)+dp[i-1][j-1]*p;
			}
		}
	}
	long double res=0;
	for(i=n/2+1;i<=n;i++) res+=dp[n-1][i];
	cout<<setprecision(15)<<res;
}
// check for any potential overflow before submitting


Measured memory_bytes: 141056
def f(v, K):
    global cnt
    v += str(K)
    if len(v) == len_ and int(v) <= N:
        if len(set(v)) == 3:
            cnt += 1
        return
    elif len(v) == len_:
        return
    f(v, 7)
    f(v, 5)
    f(v, 3)

N = int(input())
total = [0, 0]
for i in range(3, 10):
    temp = 3**i - (2**i*3 - 3)
    total.append(temp)
len_ = len(str(N))
ans = sum(total[:len_-1])
cnt = 0
f('','')
ans += cnt
print(ans)

Measured memory_bytes: 9132
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.000000001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	ll i, n, x = -1, y = -1;
	cin >> n;
	vector<ll> a(n);
	for (i = 0; i < n; i++) cin >> a[i];
	sort(full(a), greater<ll>());
	for (i = 0; i + 1 < n; i++){
		if (a[i] == a[i + 1]){
			if (x == -1){
				x = a[i];
				i++;
			}
			else{
				y = a[i];
				break;
			}
		}
	}
	if (i + 1 == n) cout << 0 << endl;
	else cout << x*y << endl;
	return 0;
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll x, ll y){
    while(x % y){
        x %= y;
        swap(x, y);
    }
    return y;
}

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

    int T;
    cin >> T;
    while(T--){
        ll A, B, C, D;
        cin >> A >> B >> C >> D;
        if(A < B){ // run out first turn
            cout << "No\n";
            continue;
        }

        if(D < B){ //cannot resupply fast enough
            cout << "No\n";
            continue;
        }

        if(C >= B){
            cout << "Yes\n";
            continue;
        }

        ll G = gcd(B, D);
        C++;
        if(A > C){
            ll diff = A - C;
            diff %= G;
            A = C + diff;
        }

        if(A >= B){
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 5e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
int M,N;
int a[MAXN];

void work(){
    scanf("%d%d",&N,&M);
    int tot=0;
    for(int i=1;i<=N;i++){
        scanf("%d",&a[i]);
        tot+=a[i];
    }
    int mi=(tot-1)/(M*4)+1;
    int cnt=0;
    for(int i=1;i<=N;i++)if(a[i]>=mi) cnt++;
    if(cnt>=M) printf("Yes\n");
    else printf("No\n");
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}





Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int M = sc.nextInt();

            int[] lList = new int[M];
            int[] rList = new int[M];
            for (int i = 0; i < M; i++) {
                lList[i] = sc.nextInt();
                rList[i] = sc.nextInt();
            }

            Arrays.sort(lList);
            Arrays.sort(rList);

            int result = 0;

            for (int i = lList[lList.length - 1]; i <= rList[0]; i++) {
                result++;
            }

            System.out.println(result);
        }
    }

}

Measured memory_bytes: 84048
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        int A = cin.nextint;
        int B = cin.nextint;
        if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
        {
            WriteLine("Possible");
        }
        else
        {
            WriteLine("Impossible");
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13264
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	s := sc.Text()
	sc.Scan()
	t := sc.Text()

	Rs := []rune(s)
	Rt := []rune(t)
	n := len(Rs)
	for i := 0; i < n; i++ {
		Rs = append([]rune{Rs[n-1]}, Rs[0:n-1]...)
		if reflect.DeepEqual(Rs, Rt) {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 9223372036854775807
#define mini 9223372036854775807
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};
ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	ll c=power(a,b/2);
	if(b%2==0)
		return ((c%mod)*(c%mod))%mod;
	else
		return ((((c%mod)*(c%mod))%mod)*a)%mod;
}
int main()
{
	boost
	ll n;
	cin>>n;
	ll a[n+1];
	ll b[n+1];
	ll c[n];
	for(ll i=1; i<=n; i++)
		cin>>a[i];
	for(ll i=1; i<=n; i++)
		cin>>b[i];
	for(ll i=1; i<=n-1; i++)
		cin>>c[i];
	ll ans=b[a[1]];
	for(ll i=2; i<=n; i++)
	{
		ans+=b[a[i]];
		if(a[i-1]+1==a[i])
			ans+=c[a[i-1]];
	}
	cout<<ans<<endl;
	return 0;
}

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

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll x ;
ll dp[MAX] ;

ll sol( ll x ){
    if( !x )
        return 1 ;
    ll &ans = dp[x] ;
    if(ans != -1 )
        return ans ;
    ans = 0 ;
    for(int i=3;i<=x;i++){
        ans += sol(x-i) ;
        if( ans >= MOD )
            ans %= MOD;
    }
    return ans ;
}

void sol( ){
    cin >> x ;
    mem(dp,-1) ;
    cout << sol( x ) << nl ;
}

signed main( ){
  timesaver ;
//  int t = 1 ; cin >> t ; while(t--)
  {
      sol( );
  }
}

Measured memory_bytes: 3688
#include <iostream>

using namespace std;

int main()
{
    double xA, yA, xB, yB, xC, yC, xD, yD;

    while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD) {
        if (-0.0000000001 < (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB) &&
                (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB) < 0.0000000001) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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


int main() {

  int m[3];
  m[0] = 10;
  m[1] = 5;
  m[2] = 1;

  int N,Y;
  cin >> N >> Y;
  Y/= 1000;
  rep(i,N + 1){
    rep(j,N + 1 - i){
      int k = (N - i - j);
      int y = i * m[0] + j * m[1] + m[2] * k;
      if(y == Y ) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      } 
    }
  }

  cout << -1 << " " << -1 << " " << -1 << endl;

	return 0;
}



Measured memory_bytes: 3632
import math
import itertools
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for lst in itertools.combinations_with_replacement([i + 1 for i in range(K)], 3):
    ans += int(6 / math.factorial(4 - len(set(lst)))) * gcd(list(lst))

print(ans)

Measured memory_bytes: 69796
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int a, b = 100000;
	scanf("%d", &a);
	for (int i = 0; i<a; i++) {
		b *= 1.05;
		if (b % 1000 != 0)b = (b/1000+1)*1000;
	}
	printf("%d\n", b);
}

Measured memory_bytes: 2572
import java.math.BigDecimal;
import java.util.*;

class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.close();
        double result = 0.0;
        for(int i=1;i<=N;i++){
            double tmp = 1.0/(double)N;
            int now = i;
            while(now < K){
                tmp *= 0.5;
                now *= 2;
            }
            result += tmp;
        }
        System.out.println(String.format("%.10f", result));
    }
}

Measured memory_bytes: 20948
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int d;
		//f(x) = x*x
		while (in.hasNext()) {
			d = in.nextInt();
			System.out.println(calcAreaXX(d));
		}
		in.close();
	}

	static int calcAreaXX(int d) {
		int area = 0;
		int rect;
		for (int i = d; i < 600; i += d) {
			rect = d * i * i;
			area += rect;
		}
		return area;
	}
}

Measured memory_bytes: 25796
#include<stdio.h>
int nxpt(int *s){
  int i,l=4,max=0,f[260]={0};
  for(l--;l+1&&max<=s[l];l--)f[max=s[l]]++;
  if(l<0)return 0;
  f[s[l]]++;
  for(i=s[l]+1;f[i]==0;i++);
  f[s[l]=i]--;
  for(i=0;s[++l];f[s[l]=i]--){
    while(f[i]==0)i++;
  }
  return 1;
}
int f(int a,int c,int b){
  if(c==0)return a+b;
  if(c==1)return a-b;
  if(c==2)return a*b;
}
int main(){
  int i,d[5]={0};
  int s[5],o[3];
  char c[]={"+-*"};
  while(1){
    for(i=0;i<4;i++)s[i]=i+1;
    s[4]=0;
    for(i=0;i<4;i++)scanf("%d",&d[i+1]);
    if(d[1]==0)return 0;
    do{
      for(i=0;i<27;i++){
	o[0]=i%3;
	o[1]=(i/3)%3;
	o[2]=i/9;
	if(f(f(f(d[s[0]],o[0],d[s[1]]),o[1],d[s[2]]),o[2],d[s[3]])==10){
	  printf("((%d%c%d)%c%d)%c%d\n",d[s[0]],c[o[0]],d[s[1]],c[o[1]],d[s[2]],c[o[2]],d[s[3]]);
	  goto END;
	}
	if(f(f(d[s[0]],o[0],d[s[1]]),o[1],f(d[s[2]],o[2],d[s[3]]))==10){
	  printf("(%d%c%d)%c(%d%c%d)\n",d[s[0]],c[o[0]],d[s[1]],c[o[1]],d[s[2]],c[o[2]],d[s[3]]);
	  goto END;
	}
      }
    }while(nxpt(s));
    printf("0\n");
  END:;
  }
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
using namespace std;

int main() {
    long long n,m;
    cin >> n >> m;
    vector<long long> a(n);
    long long x=0;
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        x += a.at(i);
    }
    vector<long long> q;
    for (int i = 0; i < n; i++) {
        while (a.at(i) > 0) {
            q.push_back((a.at(i) + 1) / 2);
            a.at(i) /= 2;
        }
    }
    sort(q.begin(),q.end());
    reverse(q.begin(), q.end());
    long long ht = q.size();
    for (int i = 0; i < min(m,ht); i++) {
        x -= q.at(i);
    }
    long long h = 0;
    cout << max(x,h) << endl;
}

Measured memory_bytes: 35300
#include <iostream>

using namespace std;

short l, r, d, cnt;

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> l >> r >> d;
  for (int i = l; i <= r; i ++)
    if (i % d == 0)
      cnt ++;
  cout << cnt;
  return 0;
}


Measured memory_bytes: 3560
#include<stdio.h>
#include<string.h>
int main()
{
	char s[100005];
	scanf("%s", s);
	int i, n = strlen(s);
	int a[100005];
	a[0] = 0;
	for (i = 1; i < n; i++)
	{
		if (s[i] == s[i - 1])
			a[i] = a[i - 1];
		else
			a[i] = i;
	}
	int ans = 1;
	for (i = 0; i < n; i++)
	{
		if (n - a[i] >= i + 1 && ans < i + 1)
			ans = i + 1;
	}
	a[n - 1] = n - 1;
	for (i = n - 2; i >= 0; i--)
	{
		if (s[i] == s[i + 1])
			a[i] = a[i + 1];
		else
			a[i] = i;
	}
	for (i = 0; i < n; i++)
	{
		if (a[i] + 1 >= n - i && ans < n - i)
			ans = n - i;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

#define MAX_V 1000010
#define INF 1000000000

struct edge{int to, cost;};
typedef pair<int,int> P;

vector<edge> G[MAX_V];
int mn[MAX_V];

void ae(int from, int to, int cost){
  edge e = {to,cost};
  G[from].push_back(e);
}

void dijk(int start, int V){
  priority_queue<P, vector<P>, greater<P> > que;
  for(int i = 0; i < V; i++)mn[i] = INF;
  mn[start] = 0;
  que.push(P(0,start));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second;
    if(mn[v]<p.first)continue;
    for(int i = 0; i < G[v].size(); i++){
      edge e = G[v][i];
      if(mn[e.to] > mn[v]+e.cost){
        mn[e.to] = mn[v]+e.cost;
        que.push(P(mn[e.to],e.to));
      }
    }
  }
}

int main(){
  ll h,w;
  cin>>h>>w;
  ll cy,cx;
  cin>>cy>>cx;
  cy--;cx--;
  ll dx,dy;
  cin>>dy>>dx;
  dx--;dy--;
  vector<string> vs;
  rep(i,0,h){
    string s;
    cin>>s;
    vs.pb(s);
  }
  rep(y,0,h){
    rep(x,0,w){
      rep(i,-2,3){
        rep(j,-2,3){
          if(i==0&&-1<=j&&j<=1)continue;
          if(j==0&&-1<=i&&i<=1)continue;
          ll y1 = y+i;
          ll x1 = x+j;
          if(y1<0||x1<0||y1>=h||x1>=w)continue;
          if(vs[y][x]=='.'&&vs[y1][x1]=='.'){
            ae(y*w+x,y1*w+x1,1);
          }
        }
      }
    }
  }
  ll qy[4] = {-1,0,0,1};
  ll qx[4] = {0,-1,1,0};
  rep(y,0,h){
    rep(x,0,w){
      rep(i,0,4){
        ll y1 = y+qy[i];
        ll x1 = x+qx[i];
        if(y1<0||x1<0||y1>=h||x1>=w)continue;
        if(vs[y][x]=='.'&&vs[y1][x1]=='.'){
          ae(y*w+x,y1*w+x1,0);
        }
      }
    }
  }
  dijk(cy*w+cx,h*w);
  if(mn[dy*w+dx]==INF){
    cout << -1 << endl;
    return 0;
  }
  cout << mn[dy*w+dx] << endl;
  return 0;
}

Measured memory_bytes: 105684
def read_int():
    return int(input())

def read_int_map():
    return map(int,input().split(' '))

def read_int_list():
    return list(map(int,input().split(' ')))

def read_s_list_loop(n):
    return [input() for _ in range(n)]


H1,M1,H2,M2,K = read_int_map()

h = H2 - H1
m = M2 - M1

amount = h*60 + m
print(amount-K)

Measured memory_bytes: 61800
s=input()
t=input()
s_len=(len(s))
t_len=(len(t))

for i in range(s_len-t_len,-1,-1):
    for j in range(t_len):
        if s[i+j]!=t[j] and s[i+j]!="?":
            break
    else:
        print((s[:i]+t+s[i+t_len:]).replace("?","a"))
        exit()

print("UNRESTORABLE")



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x, y;
  bool operator < (const P &a )const{
    //if(x!=a.x)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
long long o[5101][5010];
int l[1];
int j[1];

long long x,y,z,mod=1000000007;
//string r;
char r[223111];

P u[1];
priority_queue<int> q;
stack<int> s;
//set<P> s;
map<int,int> p;

vector<int> v;

bool as(P a,P b)
{
  //if(a.x!=b.x)
  //return a.x<b.x;
  return a.x<b.x;
}

long long f(int n,int m)
{
  if(m<0) return 0;
  if(n>a)
  {
    if(n==a+1&&m==b) return 1;
    return 0;
  }
  if(o[n][m]>=0) return o[n][m];
  //if(n+2==a+1) o[n][m]=(f(n+2,m)*2+f(n+1,m+1))%mod;
  //else
  if(m) o[n][m]=(f(n+1,m+1)+f(n+1,m-1)*2)%mod;
  else o[n][m]=(f(n+1,m+1)+f(n+1,0))%mod;
  return o[n][m];
}

int main()
{
  memset(o,-1,sizeof(o));
  memset(l,-1,sizeof(l));
  scanf("%d %s",&a,r);
  b=strlen(r);
  //for(int t=1;t<=a;t++) x+=f(t,0),y+=g(t,0,0),x%=mod,y%=mod;
  //printf("%lld",f(1,0));
  printf("%lld",f(1,0));
}
//0
//16



Measured memory_bytes: 200192
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

const int maxn=2e5+10;
int n,a[maxn],b[maxn];

int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;++i)
		if(a[i]<=b[n/2])
			cout<<b[n/2+1]<<endl;
		else
			cout<<b[n/2]<<endl;
	return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, Q, p[202020], x[202020], a[202020], b[202020];
vector<int> v[202020];
int cnt[202020];
void solve(){
	cin >> n >> Q;
	for(int i = 0; i < n-1; i++){
		cin >> a[i] >> b[i];
		v[a[i]].push_back(b[i]);
		v[b[i]].push_back(a[i]);
	}
	for(int i = 0; i < Q; i++){
		cin >> p[i] >> x[i];
		cnt[p[i]] += x[i];
	}
	
	queue<int> q;
	q.push(1);
	bool used[202020] = {0};
	while(!q.empty()){
		int now = q.front(); q.pop();
		used[now] = 1;
		for(int i = 0; i < v[now].size(); i++){
			if(used[v[now][i]]) continue;
			q.push(v[now][i]);
			cnt[v[now][i]] += cnt[now];
		}
	}
	
	for(int i = 1; i <= n; i++){
		cout << cnt[i] << " ";
	}
	cout << endl;
}

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

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

#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a=(a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    for(ll i = 2;i < MAX; i++)
    {
        if(prime[i-1])
        {
            for(ll j = i*i; j < MAX; j += i)
                prime[j-1] = false;
        }
    }
}

void getfact(vector<ll>&fact, vector<ll>&factinv)
{
    fact[0] = 1;
    factinv[0] = 1;
    
    for(ll i = 1; i < MAX; i++)
        fact[i] = (fact[i-1] * i)%MOD;
    
    for(ll i = 1; i < MAX; i++)
        factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll res=0;
    ll mx=min(a,k);
    res+=mx;
    k-=mx;
    mx=min(b,k);
    k-=mx;
    mx=min(c,k);
    k-=mx;
    res-=mx;
    cout<<res;
    


    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn= new Scanner(System.in);
        int people= scn.nextInt();
        int day = scn.nextInt();
        int x = scn.nextInt();
        int total = 0;
        for(int i=0;i<people;i++){
            int buf = scn.nextInt();
            for(int j=1;j<=day;){
                total++;
                j+=buf;
            }
        }
        System.out.println(total+x);
    }
}

Measured memory_bytes: 23124
Q = int(input())

for i in range(Q):
    A, B = map(int, input().split())
    C = int((A*B) ** 0.5)
    if C*(C+1) < A*B:
        print(2*C - 1)
    elif A*B == C*C and A != B:
        print(2*C - 3)
    else: 
        print(2*C - 2)

Measured memory_bytes: 3060
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int len = s.length();
	bool ans = true;
	for (int i = 0; i < len; ++i) {
		if (i & 1) {
			if (s[i] == 'R') {
				ans = false;
			}
		} else {
			if (s[i] == 'L') {
				ans = false;
			}
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
<?php 
  $ans = 0;

  fscanf(STDIN,"%d %d %d",$n,$m,$q);
  for($i=0; $i<$q; $i++){
    fscanf(STDIN,"%d %d %d %d",$a[],$b[],$c[],$d[]);
  }



  function dfs($A){
    global $n,$m,$q,$a,$b,$c,$d,$ans;
    if(count($A) == $n+1){
      $now = 0;
      for($i=0; $i<$q; $i++){
        if($A[$b[$i]] - $A[$a[$i]] == $c[$i]){
          $now += $d[$i];
        }
      }
      $ans = max($ans,$now);
      return 0;
    }
    
    $A[] = end($A);
    while( end($A) <= $m){
      dfs($A);
      $A[count($A)-1]++;
    }
    
  }
  

  function main(){
    global $ans;
    $A = [1];
    dfs($A);
    echo $ans."\n";
  }

  main();

Measured memory_bytes: 16192
#include <bits/stdc++.h>
using namespace std;
const int64_t MAXN = 10010;
vector<vector<int64_t>> Graph(MAXN);
vector<int64_t> Num(MAXN, 0);

int main()
{
  int64_t N, a, b, c, ans = 0;
  cin >> N;
  for (int i = 0; i < N - 1; i++)
  {
    cin >> a >> b;
    a--, b--;
    Graph.at(a).push_back(b);
    Graph.at(b).push_back(a);
  }
  priority_queue<int64_t> pq;
  for (int i = 0; i < N; i++)
  {
    cin >> c;
    pq.push(c);
  }
  queue<int64_t> Q;
  Q.push(0);
  Num.at(0) = pq.top();
  pq.pop();
  while (Q.size())
  {
    auto cur = Q.front();
    Q.pop();
    for (auto next : Graph.at(cur))
    {
      if (Num.at(next))
        continue;
      Num.at(next) = pq.top();
      pq.pop();
      ans += Num.at(next);
      Q.push(next);
    }
  }
  cout << ans << endl;
  for (int i = 0; i < N; i++)
  {
    cout << Num.at(i);
    if (i == N - 1)
      cout << endl;
    else
      cout << ' ';
  }
}


Measured memory_bytes: 4328
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    a,b,n = map(int , input().split())
    if n < b - 1:
        print((a * n) // b - a * (n // b))
    else:
        print((a * (b - 1)) // b)
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
//#define ss second
#define se set<ll>
#define vec vector<ll>
#define inf 10000000000000000
bool mark[100005];
vec adj[100005];
ll counter;
vec cnt;
vector<string> forsubs;




int main()
{    
 

	#ifdef APNA_IO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 

    ll n,k;
    cin>>n>>k;
   
   string s;
   cin>>s;

    ll k1 =(int)s[k-1];
    k1+=32;

    s[k-1]=(char)k1;

    for(ll i=0;i<n;i++)
    {
    	cout<<s[i];
    }


	
}
	




Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long ll;
#define endl '\n'

void solve() {
    ll x;
    cin >> x;

    ll a = 0, b = 0;
    bool done = false;
    for (int i = -1000; i <= 1000; ++i) {
        for (int j = -1000; j <= 1000; ++j) {
            ll v1 = pow(i, 5);
            ll v2 = pow(j, 5);
            if (v1 - v2 == x) {
                a = i;
                b = j;
                done = true;
                break;
            }
        }
        if (done) {
            break;
        }
    }
    cout << a << " " << b << endl;
}

int main() {
    FAST_IO;

    int t;
    // cin >> t;
    t = 1;

    while (t--) {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3944
#include<iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int a[m];
    int sum = 0;
    for(int i = 0; i < m; i++) {
        cin >> a[i];
        sum += a[i];
    }
    cout << ((sum>n)? -1 : n - sum )<< endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
  ll l;
  cin >> l;

  double l1 = (double)l / 3.0;
  double s = (double)(l * l * l) / 27.0;
  printf("%.12lf\n", s); 

}


Measured memory_bytes: 256
S = raw_input()

is_easy = True

for i in range(len(S)/2):
    if S[2*i] == "L":
        is_easy = False
    if S[2*i+1] == "R":
        is_easy = False

if len(S) == 1:
    if S[0] == "L":
        is_easy = False


if is_easy == False:
    print "No"
else:
    print "Yes"


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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
int x[110], y[110];
double t[110];
pair<double, pint> txy[110];
signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) { cin >> x[i] >> y[i], txy[i] = make_pair(atan2(y[i], x[i]), pint(x[i], y[i])); }
    sort(txy, txy + N);
    for (int i = 0; i < N; i++) { t[i] = txy[i].first; }
    double ans = 0;
    // [l, r)
    int l = 0, r = 0, xsum = 0, ysum = 0;
    for (; l < N && txy[l].first < PI; l++) {
        while (t[r] <= txy[l].first + PI) {
            xsum += txy[r].second.first, ysum += txy[r].second.second, t[r] += 2 * PI, (r += 1) %= N;
        }
        chmax(ans, sqrt(xsum * xsum + ysum * ysum));
        xsum -= txy[r - 1].second.first, ysum -= txy[r - 1].second.second;
        chmax(ans, sqrt(xsum * xsum + ysum * ysum));
        xsum -= txy[l].second.first, ysum -= txy[l].second.second;
        chmax(ans, sqrt(xsum * xsum + ysum * ysum));
        xsum += txy[r - 1].second.first, ysum += txy[r - 1].second.second;
        chmax(ans, sqrt(xsum * xsum + ysum * ysum));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
typedef long long ll;
struct edge{int to;ll cost;};
typedef pair<ll,int> P;
#define dist first
#define idx second
priority_queue<P,vector<P>,greater<P>> qu;

int a,b,c;
int nextv(int v){ return (a*v+b)%c;}

int main(void){
	int n,m,v0;
	cin>>n>>m;
	vector<int> x(m),y(m);
	vector<ll> t(m);
	rep(i,m) cin>>x[i]>>y[i]>>t[i];
	cin>>v0>>a>>b>>c;
	vector<edge> G[(n+1)*2*c];
	ll dp[(n+1)*2*c];
	rep(i,m)rep(v,c){
		G[x[i]*c+v].push_back({y[i]*c+nextv(v),t[i]*v});
		G[y[i]*c+v].push_back({x[i]*c+nextv(v),t[i]*v});
		G[(n+x[i])*c+v].push_back({(n+y[i])*c+nextv(v),t[i]*v});
		G[(n+y[i])*c+v].push_back({(n+x[i])*c+nextv(v),t[i]*v});
	}
	rep(v,c) G[n*c+v].push_back({n*2*c+v,0});

	rep1(i,n*2)rep(v,c) dp[i*c+v]=LLONG_MAX;
	dp[c+v0]=0;
	qu.push({0,c+v0});
	while(qu.size()){
		P u=qu.top(); qu.pop();
		if(u.idx/c==n+1){
			cout<<dp[u.idx]<<endl;
			return 0;
		}
		if(dp[u.idx] < u.dist)continue;
		for(auto e:G[u.idx]){
			if(dp[e.to] > dp[u.idx] + e.cost){
				dp[e.to] = dp[u.idx] + e.cost;
				qu.push({dp[e.to],e.to});
			}
		}
	}
}

Measured memory_bytes: 28456
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int a[5];
int main()
{
    int i=0;
    while(cin>>a[++i]);
    sort(a+1,a+4);
    int x=0,ans=0;
    for(int i=2;i<=3;++i)
    ans+=a[i]-a[i-1];
    for(int i=2;i>=1;--i)
    x+=a[i+1]-a[i];
    cout<<min(ans,x);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {
	
	void Solve() {
		UL n; cin >> n;
		string s; cin >> s;
		UL ans = 0;
		for (UL i = 2; i < n; i++) {
			if (s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C')
				ans++;
		}
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int N, K, Q;
  std::cin >> N >> K >> Q;
  std::vector<int> A(Q);
  for (int i = 0; i < Q; i++) std::cin >> A[i];

  std::vector<int> C(N);
  for (auto a : A) C[a - 1]++;
  for (int i = 0; i < N; i++) {
    if (K - Q + C[i] > 0)
      std::cout << "Yes" << std::endl;
    else
      std::cout << "No" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 1408
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    lower.extend(reversed(upper))
    return lower


def main():
    N, *A = map(int, read().split())

    B = [False] * (N + 1)
    C = [0] * (N + 1)

    for i in range(N, 0, -1):
        if A[i-1] == C[i]:
            continue
        B[i] = True
        divs = divisors(i)
        for d in divs:
            C[d] ^= 1

    ans = [i for i in range(1, N + 1) if B[i]]
    print(len(ans))
    if len(ans) > 0:
        print(' '.join(map(str, ans)))

    return


if __name__ == '__main__':
    main()


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

int main() {
	string s;
	cin >> s;
	int count = 0;
	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] != s[s.size() - 1 - i])count++;
	}
	cout << count << endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define show(x) cerr << #x << " " << x << endl

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = 1000000000 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  　　┓　　　┏
//  　＊┗┓　┏┛
//  　　　┫　┣　＊
//  　┏┳┻━┻┳┓
//  　┗┫　　　┣┛
//  ＊　┣　　━┃　＊        Merry Christmas!!
//  　┏┛　　〃┃
//  　┃●　　　┣━┳┓
//  　┗┻┳━━┛　┣┛
//  　＊　┃┏┓┣┓┃
//WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

int n;
char a[301][301];
char b[301][301];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1 = freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt", "r", stdin);
    //stream2 = freopen("out.txt", "w", stdout);
    if (stream1 == nullptr) return 0;
    //if (stream2 == NULL) return 0;
#endif
    // テキトー考察
    //
    // a + 1, b + 1を確認することはa, bを確認することと同値
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool ok = true;
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                if (a[j][k] != a[k][j]) ok = false;
            }
        }
        if (ok) ans += n;
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                b[(j + 1) % n][k] = a[j][k];
            }
        }
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                a[j][k] = b[j][k];
            }
        }
    }
    cout << ans << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s;
    std::deque<int> deq(26,0);
    for (int i=0;i<n;i++) {
        cin>>s;
        std::map<char, int> num;
        for (int j=0;j<s.size();j++) {
            if (i==0) {
                deq[s[j]-97]++;
            } else {
                if (num[s[j]]==0) {
                    num.emplace(s[j],0);
                    num[s[j]]++;
                } else {
                    num.at(s[j])++;
                }
            }
        }
        if (i!=0) {
            for (int j=0;j<26;j++) {
                char cc=j+97;
                if (deq[j]>0) {
                    if (num[cc]==0) {
                        deq[j]=0;
                    } else {
                        if (deq[j]>num[cc]) {
                            deq[j]=num[cc];
                        }
                    }
                }
            }
        }
    }
    for (int i=0;i<26;i++) {
        for (int j=0;j<deq[i];j++) {
            char c=i+97;
            cout<<c;
        }
    }
    cout<<endl;
}

Measured memory_bytes: 256