akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> ans(n, 0);
    for(int i = 1; i <= n; i++) {
        for(int j=i+1; j <= n; j++) {
            if (i <= x) {
                if (j <= x) {
                    ans[j-i] += 1;
                } else if (j >= y) {
                    ans[(x-i)+1+(j-y)] += 1;
                } else {
                    int dis = min(j-i, (x-i)+1+(y-j));
                    ans[dis] += 1;
                }
            } else if (i >= y) {
                ans[j-i] += 1;
            } else {
                int dis = min(j-i, (i-x)+1+abs(j-y));
                ans[dis] += 1;
            }
        }
    }
    for(int i = 1; i < n; i++)
        cout << ans[i] << endl;
    return 0;
}




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

ll MOD = 1e9+7;

ll m_pow(ll p, ll n){
	if(n==0) return 1;
  	else if(n%2){
    	ll now = m_pow(p,(n-1)/2);
      	return (now*now%MOD)*p%MOD;
    }
  	else{
		ll now = m_pow(p,n/2);
      	return now*now%MOD;
    }
}
  
ll m_comb(ll n, ll k){
	vector<ll> fact(k+1);
  	fact[0] = 1;
  	rep(i,k) fact[i+1] = fact[i]*(i+1)%MOD;
  	ll now = 1;
  	for(ll i=n; i>n-k; --i) now = now*i%MOD;
  	return now*m_pow(fact[k],MOD-2)%MOD;
}
  
int main(){
  	ll n, a, b;
  	cin >> n >> a >> b;
  	ll ans = 2*MOD + m_pow(2,n)-1-m_comb(n,a)-m_comb(n,b);
    ans %= MOD;
    cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 5156
# include "iostream"
# include "cstdio"
# include "cmath"

using namespace std;

const int maxm=1e5+10;

int A[maxm],K;

int main(){
	register int i,j,Max=0;
	for(i=1;i<=5;i++) scanf("%d",A+i);
	scanf("%d",&K);
	for(i=1;i<=5;i++){
		for(j=1;j<=5;j++){
			if(i==j) continue;
			Max=max(Max,A[i]-A[j]);
		}
	}
	puts(Max<=K?"Yay!":":(");
	return 0;
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n,d,x;
  scanf("%d%d%d",&n,&d,&x);
  int a[100];
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int cnt=0;
  for(i=0;i<n;i++){
    int t=1;
    while(t<=d){
      cnt++;
      t+=a[i];
    }
  }
  printf("%d\n",cnt+x);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <map>
#include <cstdlib>
#include <string>

using namespace std;
 
int main(void){
  set<int> n;
  map<int,int> m;
  string in;

  while(getline(cin, in)){
    if(in.size()==0) break;
    m[atoi(in.c_str())]++;
  }

  while(getline(cin, in)){
    int num=atoi(in.c_str());
    if(m[num]>0){
      n.insert(num);
      m[num]++;
    }
  }

  for(set<int>::iterator it=n.begin(); it!=n.end(); it++)
    cout << *it << " " << m[*it] << endl;
   
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#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 pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int n, dp[100010];
vector<int> g[100010];

int solve(int p){
	if(dp[p]) return dp[p];
	
	vector<int> vec;
	for(auto e:g[p]) vec.push_back(solve(e));
	sort(vec.rbegin(), vec.rend());
	
	int ma = 0;
	REP(i,0,vec.size()) ma = max(ma, vec[i] + i);
	return dp[p] = ma + 1;
}

int main(){
	cin >> n;
	REP(i,1,n){
		int a; cin >> a; a--;
		g[a].push_back(i);
	}
	
	solve(0);
	//REP(i,0,n) cout << dp[i] << " "; cout << endl;
 	cout << dp[0] - 1 << endl;
	return 0;
}


Measured memory_bytes: 17024
#include <iomanip>
#include <utility>
#include <algorithm>
#include <type_traits>
#include <set>
#include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <memory>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <forward_list>
#include <iomanip>
#include <functional>
#include <stdio.h>
#include <string.h>

using namespace std;
#define MFOR(i,end) for(size_t i = 0, end_i = (end); i < end_i; ++ i)

char N[20];
uint64_t sum = 0;
void f(int i, uint64_t temp_sum, uint64_t last)
{
	if (N[i] == '\0') { sum += temp_sum + last; return; }
	f(i + 1, temp_sum + last, N[i] - '0');
	f(i + 1, temp_sum, last * 10 + N[i] - '0');
}

int main()
{
	cin >> N;
	f(1, 0, N[0] - '0');
	cout << sum << std::endl;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> a(N + 1, 0);

    for (int i = 1; i < 105; i++) {
        for (int j = 1; j < 105; j++) {
            for (int k = 1; k < 105; k++) {
                int count = i*i + j*j + k*k + i*j + j*k + k*i;
                if (count <= N) a.at(count)++;
            }
        }
    }
    for (int i = 1; i <= N; i++) cout << a[i] << endl;

}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
#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 pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
ll n,m;

int main(){
	cin >> n;
	
	set<int> st;
	REP(i,2,n+1){
		bool f=true;
		for(auto s:st) if(!(i%s)) f=false;
		if(f) st.insert(i);
	}
	
	vector<int> vec;
	for(auto s:st){
		int pos=s,c=0;
		while(n/pos) c+=n/pos,pos*=s;
		if(c) vec.push_back(c);
	}
	
	ll ans=1;
	REP(i,0,vec.size()) (ans*=vec[i]+1)%=MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
import java.util.ArrayList;
import java.util.List;
//List<Integer> list = new ArrayList<>();

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int k = stdIn.nextInt();
		/*int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = stdIn.nextInt();*/
		/*String s = "NO";
		if (n <= k) 
			s = "NO";
		else {
			if (n % 2 == 0) {
				if (k <= n / 2)
					s = "YES";
			}
			else
				if (k <= (n+1) / 2)
					s = "YES";
		}*/

		String s = (n >= 2 * (k - 1) + 1) ? "YES" : "NO";

		System.out.println(s);
	}
}

Measured memory_bytes: 21588
#include<stdio.h>

int main(void){
	int N,H,W,sum=0;
	scanf("%d %d %d",&N,&H,&W);
	int Ai[N],Bi[N];
	for(int i=0;i<N;i++){
		scanf("%d %d",&Ai[i],&Bi[i]);
		if(Ai[i]>=H&&Bi[i]>=W) sum++;
		//printf("%d %d",Ai[i],Bi[i]);
	}
	printf("%d",sum);
	return 0;
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n), b(n), c(n - 1);
  std::cin >> a >> b >> c;

  int64_t s = b[a[0] - 1];

  for (int64_t i = 1; i < n; i++) {
    s += b[a[i] - 1];
    if (a[i - 1] + 1 == a[i]) {
      s += c[a[i] - 2];
    }
  }

  std::cout << s << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-11;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using Pint = pair<int, int>;

int N, L, Q;
vector<int> x;
vector<Pint> q;

int main()
{
    cin >> N;
    x.resize(N);
    for (auto &val : x) cin >> val;
    x.push_back(x[N-1]+1);
    cin >> L >> Q;
    q.resize(Q);
    for (int i=0; i<Q; i++)
    {
        int t1, t2;
        cin >> t1 >> t2;
        
        if (t1>t2) swap(t1, t2);
        q[i] = Pint(t1-1, t2-1);
    }
    int lgN = 1;
    {
        int tmp = N;
        while (tmp)
        {
            lgN++;
            tmp /= 2;
        }
    }
    vector<vector<int> > next(lgN+1, vector<int>(N+1));
    for (int i=0; i<=N; i++)
    {
        next[1][i] = min((int)distance(x.begin(), lower_bound(x.begin(), x.end(), x[i]+L+1)) - 1, N);
    }

    for (int n=2; n<=lgN; n++)
    {
        for (int i=0; i<=N; i++)
        {
            next[n][i] = next[n-1][next[n-1][i]];
        }
    }
    // for (auto vec : next)
    // {
    //     for (auto val : vec) cout << val << " ";
    //     cout << endl;
    // }

    for (auto query : q)
    {
        int ans = 0;
        int now = query.first;
        for (int n = lgN; n>0; n--)
        {
            if (next[n][now] < query.second)
            {
                ans += 1 << (n - 1);
                now = next[n][now];
            }
        }
        cout << ans + 1 << endl;
    }
}


Measured memory_bytes: 11256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

type UnionFind struct {
	par []int
}

func newUnionFind(n int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, n)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}

func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

func (u UnionFind) unite(x, y int) {
	rx := u.root(x)
	ry := u.root(y)
	if rx != ry {
		u.par[ry] += u.par[rx]
		u.par[rx] = ry
	}
}

func (u UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

func (u UnionFind) size(x int) int {
	return -u.par[u.root(x)]
}

func main() {
	n, m := scanInt(), scanInt()

	u := newUnionFind(n)

	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		u.unite(a-1, b-1)
	}

	var ans int
	for i := 0; i < n; i++ {
		ans = max(ans, u.size(i))
	}

	fmt.Println(ans)
}

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


Measured memory_bytes: 33056
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, y;
	cin >> x >> y;
	ll ans = 0;
	while(x <= y){
		x *= 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <queue>

using namespace std;

struct Info{
	Info(){s = t = -1;}
	Info(int tmp_s,int tmp_t){
		s = tmp_s;
		t = tmp_t;
	}
	int s;
	int t;
};

class Relation{
public:
	Relation(int tmp_n,int tmp_m){
		n = tmp_n;
		m = tmp_m;
		global = new Info[m];
		each = new int*[n];
		each_index = new int[n];
		num_of_each = new int[n];
		group = new int[n];
		for(int i=0;i<n;i++){
			each_index[i] = 0;
			num_of_each[i] = 0;
			group[i] = 0;
		}
		global_index = 0;
		group_number = 1;
	}

	void push(int s,int t){
		global[global_index++] = Info(s,t);
		num_of_each[s]++;
		num_of_each[t]++;
	}

	void allocate(){
		for(int i=0;i<n;i++){
			if(num_of_each[i] > 0){
				each[i] = new int[num_of_each[i]];
			}
		}
		Info tmp;
		for(int i=0;i<m;i++){
			tmp = global[i];
			each[tmp.s][each_index[tmp.s]++] = tmp.t;
			each[tmp.t][each_index[tmp.t]++] = tmp.s;
		}
	}

	void makeGroup(){
		int node,i;
		queue<int> Q;
		Q.push(0);
		group[0] = 1;
		while(true){
			while(!Q.empty()){
				node = Q.front();
				Q.pop();
				if(num_of_each[node] > 0){
					for(int k=0; k < num_of_each[node];k++){
						if(group[each[node][k]] == 0){
							group[each[node][k]] = group[node];
							Q.push(each[node][k]);
						}
					}
				}
			}
			group_number++;

			for(i=0;i<n;i++){
				if(group[i] == 0){
					group[i] = group_number;
					Q.push(i);
					break;
				}
			}
			if(i == n) break;
		}
	}

	bool canAccsess(int s,int t){
		return group[s] == group[t];
	}

private:
	Info* global;
	int** each;
	int* each_index;
	int* num_of_each;
	int* group;
	int group_number;
	int global_index,n,m;
};

int main(){
	int n,m,s,t,q;
	scanf("%d %d",&n,&m);

	Relation relation(n,m);
	for(int i=0;i<m;i++){
		scanf("%d %d",&s,&t);
		relation.push(s,t);
	}
	relation.allocate();
	relation.makeGroup();
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d %d",&s,&t);
		if(relation.canAccsess(s,t)){
			printf("yes\n");
		}else{
			printf("no\n");
		}
	}
    return 0;
}

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

using namespace std;

int odp = 0, n, m, q;

void rec(vector<int> x, int nr, int co, vector<int>& a, vector<int>& b, vector<int>& c, vector<int>& d)
{
    x[nr] = co;
    if (nr == n - 1)
    {
        int wyn = 0;
        for (int i = 0; i < q; ++i)
            if (x[b[i]] - x[a[i]] == c[i])
                wyn += d[i];
        odp = max(odp, wyn);
        return;
    }
    for (int i = co; i <= m; ++i)
        rec(x, nr + 1, i, a, b, c, d);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> q;
    vector<int> a(q), b(q), c(q), d(q);
    for (int i = 0; i < q; ++i)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i];
        --b[i];
    }
    vector<int> x(n);
    for (int i = 1; i <= m; ++i)
        rec(x, 0, i, a, b, c, d);
    cout << odp;
    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	vector<int>first;
	vector<bool>last(n+1,false);
	for(int i=0;i<m;++i){
		int a,b; cin>>a>>b;
		if(a==1)first.emplace_back(b);
		if(a==n)last.at(a)=true;
		else if(b==n)last.at(a)=true;
	}
	bool yes=false;
	for(auto&i:first){
		if(i==n||last.at(i))yes=true;
	}
	cout<<(yes?"POSSIBLE"s:"IMPOSSIBLE"s)<<"\n"s;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <limits>
#include <map>
#define MOD 1000000007
#include <algorithm>
#include <math.h>
#include <set>
#include <utility>

using namespace std;
    long long int dp[305][305][305];

int main(){
    int n,loopc;
    cin >> n;
    loopc = 1 << n;
    vector<int> a(loopc);
    multiset<int> rest;
    for(int i = 0; loopc > i; i++){
        cin >> a[i];
        rest.insert(a[i]);
    }

    vector<int> cur;
    cur.reserve(loopc);
    cur.push_back(*(--rest.end()));
    rest.erase(--rest.end());

    while(rest.size()){
        vector<int> ad;
        ad.reserve(cur.size() * 2);
        for(auto c : cur){
            auto itr = rest.lower_bound(c);
            if(itr == rest.begin()) {
                cout << "No" << endl;
                return 0;
            }
            
            itr--;
            ad.push_back(*itr);
            rest.erase(itr);
        }

        for(auto c : ad) cur.push_back(c);
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 15156
#include <iostream>

using namespace std;

int main(void){
  long long A, B, K;
  cin >> A >> B >> K;

  //Kより高橋君のクッキーが多ければ自分のクッキーのみK枚食べる
  if(K <= A)
    cout << A-K << " " << B << endl;
  //高橋くんのクッキーよりKの方が大きい前提で
  //つまり，青木君のクッキーも食べる
  //自分のクッキーをA枚食べた後，青木君のクッキーをK-A枚食べる
  else if(K < A+B)
    cout << "0 " << B-(K-A) << endl;
  //K>A+B つまり，食べられる回数がクッキーの持ち数の和より大きい
  else
    cout << "0 0" << endl;
  
  return 0;
}


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

using namespace std;

const int N = 1e5 + 10;

long long a[N];
long long dp[N];

int main() {

    int n , k ;
    cin >> n >> k;
    for(int i = 1 ; i <= n ; i++)
        cin >> a[i];

    
    for(int i = 2 ; i <= n ; i++) {
        dp[i] = INT_MAX;
        for(int j = max(i - k,1) ; j < i ; j++) {
            dp[i] = min(dp[i],dp[j] + abs(a[i] - a[j]));
        }
    }

    cout << dp[n] << '\n';

    return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////


int main(){fastio
    /*ll n;cin>>n;
    string s;cin>>s;
    ll cr=0;
    rep(i,0,n-1){
        if(s[i]=='R')cr++;
    }*/
    ll x;cin>>x;
    if(x>=30){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3608
let dx, dy = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> c - a, d - b
let f n c = print_string @@ String.make n c
let _ = f dy 'U'; f dx 'R'; f dy 'D'; f dx 'L';
  f 1 'L'; f (dy + 1) 'U'; f (dx + 1) 'R'; f 1 'D'; f 1 'R'; f (dy + 1) 'D'; f (dx + 1) 'L'; f 1 'U'

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

////////////////////////////////
#define P 998244353
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}
void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pp(ll a, ll b){return (a * b)%P;}
ll pm(ll a, ll b){return (a>b?a-b:(a-b+P)%P);}
//////////////////////////////////////
int main(int argc, char const *argv[]) {
  ll N, M, ans = 0;
  std::cin >> N >> M;
  init();
  for(int i=0;i<=min(M, N);i++){
    if((3*M-i)%2==1) continue;
    ll tmp = pp(comb(N, i), comb((3*M-i)/2+N-1, N-1));
    ll tmp2 = pp(pp(comb(N, i), i), comb((M-i)/2+N-1, N-1));
    ll tmp3 = (i==M?0:pp(pp(comb(N, i), N-i), comb((M-i-2)/2+N-1, N-1)));
    //std::cout << "now" << i << " " <<  tmp << " " << tmp2 << " " << tmp3<< '\n';
    ans = (ans+pm(pm(tmp, tmp2), tmp3))%P;
  }
  std::cout << ans << '\n';
  return 0;
}


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

#define ld long double
#define int long long
#define pb push_back 
#define Z(c) (int)(c).size()
#define L(c) c[Z(c)-1]
#define F first
#define S second
#define nl "\n"
#define mii map<int,int> 
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,iv,n) for(int (i)=(iv);(i)<(n);++(i))
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<nl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<nl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<nl
#define tr(it,ct) for(auto &(it) : (ct))
#define pi acos(-1)
#define prt(ct) for(auto &(it) : (ct)) cerr<<it<<" "; cerr<<nl

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
typedef vector< pii > vp;
void swap(int &a,int &b)
{ auto tm=a; a=b; b=tm; }
 
  //Take care of duplicates

  const int mod=1000000007;
  const int mod2=998244353;
  const int INF=(1LL<<50)-1;
  const int N=2e5+25;
  const int M=123456;
 

 void bheja_fry()
 { int n; cin>>n;
   string s,t; cin>>s>>t;
   string ans;
   
   int i=0,j=0,k=1;

   while(i<n||j<n)
   {
     if(k)
     {
       ans.pb(s[i]);
       i++;
     }
     else
     {
       ans.pb(t[j]);
       j++;
     }
     k=1-k;
   }

   cout<<ans;

 }
                                                         
signed main()
{ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
 
   int t=1;                         
 //  cin>>t;
  rep(i,1,t+1)
  { // cout<<"Case #"<<i<<": ";
   bheja_fry();
   if(i<t)
   cout<<nl;
  }
  
 
 return 0; 
}

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

int main()
{
    char s[101], p[101], a[201];

    cin >> s >> p;

    strcpy(a, s);
    strcat(a, s);

    if (strstr(a, p) == NULL)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int G[10][10];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  int n,m; cin>>n>>m;
  rep(i,m){
    int a,b; cin>>a>>b; a--,b--;
    G[a][b]=G[b][a]=1;
  }
  vi g;
  for(int i=1; i<n; i++) g.push_back(i);
  int ans=0;
  do{
    bool ok=true;
    if(G[0][g[0]]==0) ok=false;
    rep(i,n-2) if(G[g[i]][g[i+1]]==0) ok=false;
    if(ok) ans++;
  }while(next_permutation(all(g)));
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char S[202] = { 0 }, s[101], t[101]; int N, i, j;
	scanf("%d%s%s", &N, s, t);
	for (i = 0; i < N; i++) {
		for (j = 0; j < N - i; j++) {
			if (s[i + j] != t[j])break;
		}
		if (j == N - i) {
			printf("%d\n", N + i);
			return 0;
		}
	}
	printf("%d\n", 2 * N);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

#define MOD_BY 1000000007

int add(int a, int b) {
	return a + b - MOD_BY * (a + b >= MOD_BY);
}

int mul(int a, int b) {
	int r = 0;
	while (b > 0) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int N;
int A[212345];

int morigutihiroko[212345];

int main(void) {
	int i;
	int kotae = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	morigutihiroko[N] = 0;
	for (i = N - 1; i >= 0; i--) {
		morigutihiroko[i] = add(morigutihiroko[i + 1], A[i]);
	}
	for (i = 0; i < N; i++) {
		kotae = add(kotae, mul(A[i], morigutihiroko[i + 1]));
	}
	printf("%d\n", kotae);
	return 0;
}


Measured memory_bytes: 3296
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) int __VA_ARGS__; in(__VA_ARGS__)
//オーバーフロー対策
#define INL(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

char a[305][305];
int b[305][305];
bool ex[305];

void solve()
{
    IN(h, w, k);
    int init = -1;
    rep(i, h)
    {
        rep(j, w)
        {
            cin >> a[i][j];
            if (a[i][j] == '#') ex[i] = true;
        }
        if (init == -1 && ex[i]) init = i;
    }
    int n = 0;
    rep(i, h)
    {
        if (!ex[i]) continue;
        b[i][0] = a[i][0] == '#';
        reps(j, 1, w)
        {
            b[i][j] = b[i][j-1] + (a[i][j] == '#');
        }
        int count = b[i][w-1];
        rep(j, w)
        {
            if (b[i][j] == 0) b[i][j] = n+1;
            else b[i][j] += n;
        }
        n += count;
    }
    rep(i, init)
    {
        rep(j, w)
        {
            cout << b[init][j] << " ";
        }
        cout << endl;
    }
    int i = init;
    while (i < h)
    {
        rep(j, w)
        {
            cout << b[i][j] << " ";
        }
        cout << endl;
        int ik = i+1;
        reps(jjj, i+1, h)
        {
            if (ex[ik])
            {
                i = ik;
                break;
            }
            rep(j, w)
            {
                cout << b[i][j] << " ";
            }
            cout << endl;
            ik++;
        }
        if (ik >= h) break;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 1280
h,w=map(int,input().split())
A=[]
for i in range(h):
    A.append(input())

#print(A)

H=[0 for i in range(h)]
W=[0 for i in range(w)]

for i in range(h):
    if A[i]=="."*w :
        H[i]=1
for i in range(w):
    co=0
    for j in range(h):
        if A[j][i]=="." :
            co+=1
    if co==h :
        W[i]=1


B=[]

for i in range(h):
    st=""
    if H[i]==0 :
        for j in range(w):
            if W[j]==0:
                st+=A[i][j]
        print(st)


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

using namespace std;
#define int long long
signed main(){
	int n,m;
	cin>>n>>m;
	int a[n+10];
	int x=0;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		if(t>=m)
			x++;
	}
	cout<<x;
	return 0;
} 

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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

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


int main()
{
    int n,m;
    cin >> n >> m;
    int g[n][n];
    rep(i,n) rep(j,n) g[i][j] = -1;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        g[a][b] = 1;
        g[b][a] = 1;
    }
    vector<int> node;
    rep(i,n) node.push_back(i);
    int ans = 0;
    do{
        if(node[0] != 0) break;
        bool path = true;
        rep(i,n-1){
            if(g[node[i+1]][node[i]] == -1) path = false;
        }
        if(path) ans++;
    }while(next_permutation(node.begin(),node.end()));

    cout << ans << endl;
}


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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N,M;cin >> N >> M;
    vector<ll> A(N);
    vector<pair<ll,ll>> Q(M);
    ll card = 0;
    for(int i = 0;i < N;i++)cin >> A[i];
    for(int i = 0;i < M;i++){
      cin >> Q[i].second >> Q[i].first;
      card += Q[i].first;
    }
    sort(A.begin(),A.end());
    sort(Q.begin(),Q.end());
    reverse(Q.begin(),Q.end());
    ll n = Q[0].second,m = 0;
    for(int i = 0;i < min(N,card);i++){
      if(n == 0){
        m++;
        n = Q[m].second;
      }
      ll a = Q[m].first;
      if(A[i] < Q[m].first){
        swap(A[i],a);
        n--;
      }else{
        break;
      }
    }
    ll ans = 0;
    for(int i = 0;i < N;i++){
      ans += A[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>

using namespace std;

int main() {
  string r, a;
  while (true) {
    int hit = 0;
    int blow = 0;
    cin >> r >> a;
    if (r == "0") {
      return 0;
    }
    for (int i = 0; i < 4; ++i) {
      for (int j = 0; j < 4; ++j) {
        if (r[i] == a[j]) {
          if (i == j) {
            ++hit;
          } else {
            ++blow;
          }
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
}

Measured memory_bytes: 1184
#include <stdio.h>

int main() {

int al[30] = {0};
char b[2000]= {0};
int i,j,n;

i=0;

while( scanf("%c",&b[i]) != EOF) {

if (b[i] >= 'A' && 'Z' >= b[i] ) {
n = b[i] - 'A';
al[n] += 1;

} else if(b[i] >=  'a' && b[i] <= 'z' ) {
n = b[i] - 'a';
al[n] += 1;
}
i=i+1;
}

for(j=97; j<=122; j++) {
n = j - 'a';
printf("%c : %d\n",j,al[n]);
}

return 0;

}

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

int main(){
	int N,W,n,w,res = 0;
	cin >> n >> w;
	int t[n+1][w+1];
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= w;j++){
				t[i][j] = 0;
		}
	}
	for(int i = 1;i <= n;i++){
			cin >> N >> W;
		for(int j = 1;j <= w;j++){
			if(j - W < 0){
				t[i][j] = t[i-1][j];
				continue;
			}
			t[i][j] = max(t[i-1][j-W]+N,t[i-1][j]);
			res = max(res,t[i][j]);
			//cout <<t[i][j] << " ";
		}
		//cout <<endl;
	}
	cout << res <<endl;
	return 0;
}

Measured memory_bytes: 5104
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b - 1][f - 1][r - 1] += v

for b in range(4):
    if b:
        print("####################")
    for f in range(3):
        for r in range(10):
            print(" {}".format(house[b][f][r]), end='')
        print()



Measured memory_bytes: 5624
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	long long int a[100000], n, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	sort(a, a + n);
	
	int c = 1;
	for(int i = 0; i < n - 1; i++){
		if(a[i] == a[i+1])
			c++;
		else{
			ans += c % 2;
			c = 1;
		}
	}
	ans += c % 2;
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll MOD = 1000000007;
ll INF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

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

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, x, t;
  cin >> n >> x >> t;

  cout << (n + x -1)/x * t <<endl;
    
    
  return 0;
}



Measured memory_bytes: 3648
package main

import (
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
	h, _ := scanInt(), scanInt()
	c := make([]string, h)
	for i := range c {
		c[i] = scanString()
	}

	var wr = bufio.NewWriter(os.Stdout)
	for _, v := range c {
		wr.WriteString(v + "\n")
		wr.WriteString(v + "\n")
	}
	wr.Flush()
}


Measured memory_bytes: 640
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# MOD = 10 ** 9 + 7
# メモ化再起
from functools import lru_cache
import sys

sys.setrecursionlimit(100000000)

N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]



@lru_cache(maxsize=1000000)
def f(n):
    maxval = -float('inf')
    for a in A:
        tmp = n - match[a]
        if tmp == 0:
            maxval = max(maxval, a)
        elif tmp > 0:
            # maxval = max(maxval, f2(f(n - match[a]) * 10 + a))
            maxval = max(maxval, f(n - match[a]) * 10 + a)
    return maxval

@lru_cache(maxsize=1000000)
def f2(n):
    if n < 0:
        return 0
    n = list(str(n))
    n.sort(reverse=True)
    return int("".join(n))

ans = f(N)
print(f2(ans))


Measured memory_bytes: 25440
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
    int x=0;char ch=getchar();
    while(ch<'0' || '9'<ch)ch=getchar();
    while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
    return x;
}

const int M=1e5+9;

int m;
int a[M],b[M],top;

int main()
{
    int n=read(),m=read();
    int odd1=-1,odd2=-1;
    for(int i=1;i<=m;i++)
    {
        a[i]=read();
        if(a[i]&1)
        {
            if(odd1==-1)
                odd1=i;
            else if(odd2==-1)
                odd2=i;
            else
            {
                puts("Impossible");
                return 0;
            }
        }
    }

    if(m==1)
    {
        if(a[1]==1)
            printf("1\n1\n1\n");
        else
            printf("%d\n2\n1 %d\n",a[1],a[1]-1);
        return 0;
    }

    if(odd1!=-1)
        swap(a[1],a[odd1]);
    if(odd2!=-1)
        swap(a[m],a[odd2]);

    for(int i=1;i<=m;i++)
        printf("%d%c",a[i]," \n"[i==m]);

    if(a[m]==1)
    {
        printf("%d\n",m-1);
        printf("%d ",a[1]+1);
        for(int i=2;i<m;++i)
            printf("%d ",a[i]);
        puts("");
        return 0;
    }

    b[1]=a[1]+1;
    for(int i=2;i<m;i++)
        b[i]=a[i];
    b[m]=a[m]-1;

    printf("%d\n",m);
    for(int i=1;i<=m;i++)
        printf("%d%c",b[i]," \n"[i==m]);

    return 0;
}

Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int M;
    long[] a;
    long[] b;
    long[] c;
    long[] d;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.M = sc.nextInt();
        this.a = new long[N];
        this.b = new long[N];
        this.c = new long[M];
        this.d = new long[M];
        for (int i = 0; i < N; i++) {
        	this.a[i] = sc.nextLong();
        	this.b[i] = sc.nextLong();
        }
        for (int i = 0; i < M; i++) {
        	this.c[i] = sc.nextLong();
        	this.d[i] = sc.nextLong();
        }
    }
    
    //解答処理
    private long[] solve() {
        long[] answer = new long[N];
        long distance = 0;
        
        for (int i = 0; i < N; i++) {
        	long min = Long.MAX_VALUE;
        	for (int j = 0; j < M; j++) {
        		long x = Math.abs(a[i] - c[j]);
        		long y = Math.abs(b[i] - d[j]);
        		distance = x + y;
        		if (distance < min) {
        			min = distance;
        			answer[i] = j+1;
        		}
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(long[] answer) {
    	for (int i = 0; i < answer.length; i++) {
    		System.out.println(answer[i]);   		
    	}
    }

}


Measured memory_bytes: 35864
S = list(input())

s = S + ['\n']

sl = len(s)

count = 0
limit = sl // 2 + 1
for i in range(1, sl):
    if s[i-1] == s[i]:
        count += 1
        if s[i-1] == '0':
            s[i] = '1'
        else:
            s[i] = '0'
    if count > limit:
        break

if count > limit:
    count = 0
    s = ['\n'] + S
    for i in range(1, sl):
        ind = -1 * (i+1)
        if s[-1 * i] == s[ind]:
            count += 1
            if s[ind] == '0':
                s[ind] = '1'
            else:
                s[ind] = '0'

print(count)

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

int main(void) {
	int n, buf, dig, ans = 0;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		buf = i;
		dig = 0;
		while (buf > 0)buf /= 10, dig++;
		if (dig % 2 == 1)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a[100010];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	a[n] = 1e9 + 1;
	ll cnt = 1, ans = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] == a[i - 1])cnt++;
		else {
			if (cnt % 2)ans++;
			cnt = 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int num[4][3][10]={};
    for(int i=0;i<n;i++){
        int b,f,r,v;
        cin>>b>>f>>r>>v;
        num[b-1][f-1][r-1]+=v;
    }
    for(int i=0;i<4;i++){
        if(i) cout<<"####################"<<endl;
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                cout<<" "<<num[i][j][k];
            }
            cout<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3088
H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]

ans = "Yes"
for h in range(H):
  for w in range(W):
    if S[h][w] == "#":
      flag = 0
      
      if h == 0:
        h1 = [1]
      elif h == H-1:
        h1 = [H-2]
      else:
        h1 = [h-1,h+1]
      
      if w == 0:
        w1 = [1]
      elif w == W-1:
        w1 = [W-2]
      else:
        w1 = [w-1,w+1]
        
      for h0 in h1:
        if S[h0][w] =="#":
          flag = 1
          
      for w0 in w1:
        if S[h][w0] == "#":
          flag = 1
       
      if flag == 0:
        ans = "No"
        break
print(ans)

Measured memory_bytes: 9216
#include <iostream>
#include <sstream>
#include <vector>

int main()
{
  std::string a_line;
  std::getline(std::cin, a_line);
  std::getline(std::cin, a_line);

  std::stringstream a_ss(a_line);
  std::string a;
  std::vector<int> as;
  as.push_back(0);

  while (std::getline(a_ss, a, ' '))
    as.push_back( atoi(a.c_str()) );

  int num = 0;
  for (int i=1; i <= as.size(); i++)
    if (i%2 == 1 && as[i]%2 == 1) num++;

  std::cout << num << std::endl;
}

Measured memory_bytes: 3116
get_string(String) :-
  current_input(Input),
  read_string(Input, ' \n', '', _, String).
 
get_number(Number) :-
  get_string(String),
  number_string(Number, String).
 
solve(Now,X,0) :- Now >= X, !.
solve(Now,X,Ans) :- N is Now * 101, Next is N//100, solve(Next,X,A), Ans is A + 1.

main :-
  get_number(X),
  solve(100,X,Ans),
  writeln(Ans).
  

Measured memory_bytes: 8656
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int same(char a, char b, char c){
	if(a == b && b == c)return 3;
	if(a == b || b == c || c == a)return 2;
	return 0;
}
int main(){

	int N;
	string A, B, C;
	cin >> N >> A >> B >> C;
	int ans = 0;
	for(int i = 0; i < N; i ++){
		switch(same(A[i], B[i], C[i])){
			case 2:
			ans += 1;
			break;
			case 0:
			ans += 2;
			break;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

rad_h = (h + m / 60) / 12
rad_m = m / 60
# print(rad_h, rad_m)

if rad_h >= rad_m:
	rad = rad_h - rad_m
else:
	rad = rad_m - rad_h
if rad >= 0.5:
	rad = 1 - rad
rad *= math.pi * 2

# print(rad)
print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)))

Measured memory_bytes: 9408
X,K,D = map(int, input().split())

if abs(X) >= abs(D * K):
    if X > 0:
        print(X - D*K)
    else:
        print(abs(X + D*K))
else:
    if (K - (X // D) ) % 2 == 0:

        print(abs(X%D))
    else:
        print(abs(X%D-D))

Measured memory_bytes: 61564
#include<iostream>
#include<string>

using namespace std;

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

    int ans;

    if(S == "SUN") {
        ans = 7;
    }

    if(S == "MON") {
        ans = 6;
    }

    if(S == "TUE") {
        ans = 5;
    }

    if(S == "WED") {
        ans = 4;
    }

    if(S == "THU") {
        ans = 3;
    }

    if(S == "FRI") {
        ans = 2;
    }

    if(S == "SAT") {
        ans = 1;
    }

    cout << ans << endl;

    return 0;
}

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

#define ms(a,v)        memset(a,v,sizeof a)
#define lll            long long
#define FOR(i,a,b)     for(int i=a;i<=b;i++)
#define fast           ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Read           freopen("READ.txt", "r", stdin)
#define Write          freopen("OUTPUT.txt", "w", stdout)
#define INF            -999999999
#define Co(x)          cout<<x<<endl;
#define Cos(x)         cout<<x<<" ";

typedef vector<long long>vii;
typedef pair<long long,long long>Pair;
typedef map<long long,long long>Map;

int dr[]={1,0,-1, 0 };
int dc[]={0,1, 0,-1 };

//int dr[]={1,1,0,-1,-1,-1, 0, 1};
//int dc[]={0,1,1, 1, 0,-1,-1,-1};

/*while(1) {
    if(!getline(cin,s)||s.empty()) break;
}*/

const int RT = 10000000;
vector<int>prime;
bitset<10000003> status;

void sieve()
{
    int rt = sqrt(RT);
    //for(int i = 4; i <= rt; i+=2) status[i]=true;
    for(int i = 3; i <= rt; i+=2)
        if(!status[i])
            for(int j = i*i; j < RT; j+=(i<<1))
                status[j] = true;
    prime.push_back(2);
    for(int i = 3; i <= RT; i+=2)
        if(!status[i])
            prime.push_back(i);
}

void Binary_Con(int n)
{
    int binaryNum[70];
    int i = 0;
    while (n > 0) {
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }
    // printing binary array in reverse order
    for (int j = i - 1; j >= 0; j--)
        cout << binaryNum[j];
}


void solve()
{
   int n,ans1=0,ans2=0; cin>>n;
   int cnt1[100005]={0},x;
   int cnt2[100005]={0};
   set<int>SET1,SET2;
   FOR(i,1,n)
   {
       cin>>x;
       if(i%2!=0) { cnt1[x]++; SET1.insert(x); }
       else { SET2.insert(x);  cnt2[x]++; }
   }
   vector<int>v1(SET1.begin(),SET1.end());
   vector<int>v2(SET2.begin(),SET2.end());
   int Max=10000000,id=-1;
   int limit=n/2;
   for(int i=0;i<v1.size();i++)
   {
      if(abs(limit-cnt1[v1[i]])<Max)
      {
          Max=abs(limit-cnt1[v1[i]]);
          id=v1[i];
      }
   }
   //cout<<Max<<" "<<id<<endl;
   ans1+=Max;
   Max=10000000;
   for(int i=0;i<v2.size();i++)
   {
      if(abs(limit-cnt2[v2[i]])<Max&&v2[i]!=id)
      {
          Max=abs(limit-cnt2[v2[i]]);
      }
   }
   //cout<<Max<<" "<<id<<endl;
   ans1+=min(Max,limit);
   //cout<<ans<<endl;
   ///////////
   ///////////
   Max=10000000,id=-1;
   for(int i=0;i<v2.size();i++)
   {
      if(abs(limit-cnt2[v2[i]])<Max)
      {
          Max=abs(limit-cnt2[v2[i]]);
          id=v2[i];
      }
   }
   //cout<<Max<<" "<<id<<endl;
   ans2+=Max;
   Max=10000000;
   for(int i=0;i<v1.size();i++)
   {
      if(abs(limit-cnt1[v1[i]])<Max&&v1[i]!=id)
      {
          Max=abs(limit-cnt1[v1[i]]);
      }
   }
   //cout<<Max<<" "<<id<<endl;
   ans2+=min(Max,limit);
   cout<<min(ans1,ans2)<<endl;

}

void kick_ass()
{
    fast
    #ifndef ONLINE_JUDGE
    //Read;
   // Write;
    #endif
    //int t; cin>>t; while(t--) solve();
    solve();
}

int main()
{
   kick_ass();
}


Measured memory_bytes: 8964
main :: IO ()
main = do 
  line <- getLine
  let (a:b:[]) = map read $ words line :: [Int]
  putStrLn $ show (area' a b) ++ " " ++ show (length' a b)


area' :: Int -> Int -> Int
area' x y = x * y

length' :: Int -> Int -> Int
length' x y =  (x + y) * 2

Measured memory_bytes: 3596
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($n, $x, $y) = split / /, <STDIN>);
my @ans;
for my $i (1..$n) {
  for my $j ($i+1..$n) {
    my $d = $j - $i;
    my $s = abs($i - $x) + 1 + abs($j - $y);
    $ans[min($d, $s)]++;
  }
}
for my $i (1..$n-1) {
  say $ans[$i] + 0;
}

Measured memory_bytes: 896