akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int p, q;

bool outdiv(int a, int b) {
    int aout[9] = {0, 1, -1, 0, 0, p, -q, -p, q};
    int bout[9] = {0, 0, 0, 1, -1, q, p, -q, -p};
    for (int i = 0; i < 9; i++) {
        if (a == aout[i] && b == bout[i]) {
            return true;
        }
    }
    return false;
}

int sum[200][200];

int main() {
    for (int i = 0; i < 200; i++) {
        for (int j = 0; j < 200; j++) {
            sum[i][j] = i * i + j * j;
        }
    }
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> p >> q;
        int r = p * p + q * q;
        int d = max(abs(p), abs(q));
        bool ok = true;
        // for (int j = -abs(p); j <= abs(p); j++) {
        //     for (int k = -abs(q); k <= abs(q); k++) {
        for (int j = -d; j <= d; j++) {
            for (int k = -d; k <= d; k++) {
                //cout << j << " " << k << endl;
                if (j == 0 && k == 0) {
                    continue;
                }
                if (r % sum[abs(j)][abs(k)] != 0) {
                    continue;
                }
                if (!outdiv(j, k)) {
                    //cout << "b" << endl;
                    int gc = gcd(abs(j * p + k * q), abs(j * q - k * p));
                    //cout << gc << endl;
                    if (gc % sum[abs(j)][abs(k)] == 0) {
                        ok = false;
                        break;
                    }
                }
            }
            if (!ok) {
                break;
            }
        }
        if (ok) {
            cout << "P" << endl;
        } else {
            cout << "C" << endl;
        }
    }
}



Measured memory_bytes: 3244
l,r = map(int,input().split())
b = 0
if r-l>2019:
    print(0)
    b = 1
if b==0:
    l,r = l%2019,r%2019
    if r>l:
        m = 2019**2
        for i in range(l,r):
            for j in range(i+1,r+1):
                tmp = i*j%2019
                if tmp < m:
                    m = tmp
        print(m)
    else:
        print(0)


Measured memory_bytes: 3060
use proconio::input;

fn main() {
    input! {
        n: usize,
        q: usize,
        a: [u64; n],
    }

    let mut t = FenwickTree::from_vec(a);
    for _ in 0..q {
        input! { f: usize };
        if f == 1 {
            input! { l: usize, r: usize }
            println!("{}", t.sum(l, r));
        } else {
            input! { p: usize, x: u64 }
            t.add(p, x);
        }
    }
}

struct FenwickTree<T> {
    v: Vec<T>,
}

use std::ops::AddAssign;
use num::{Integer, zero};

impl<T: Copy + AddAssign + Integer> FenwickTree<T> {
    fn new(n: usize) -> Self {
        Self {
            v: vec![zero(); n],
        }
    }

    fn from_vec(v: Vec<T>) -> Self {
        let n = v.len();
        let mut t = Self::new(n);
        for i in 0..n {
            let v = t.v[i] + v[i];
            t.v[i] = v;
            let p = i + lsb(i + 1);
            if p < n {
                t.v[p] += v;
            }
        }
        t
    }

    fn add(&mut self, i: usize, v: T) {
        let mut i = i;
        while i < self.v.len() {
            self.v[i] += v;
            i += lsb(i + 1);
        }
    }

    fn sum(&self, l: usize, r: usize) -> T {
        self.get(r) - self.get(l)
    }

    fn get(&self, mut i: usize) -> T {
        let mut v = zero();
        while i > 0 {
            v += self.v[i - 1];
            i -= lsb(i);
        }
        v
    }
}

#[inline]
fn lsb(i: usize) -> usize {
    i & i.wrapping_neg()
}


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

#define int long long

const int N = 1e5 + 10;
int n, ar[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> ar[i];
	sort(ar, ar + n);
	
	int x = ar[n - 1], mn = abs(x / 2 - ar[0]), ans = ar[0];
	for (int i = 0; i < n - 1; i++)
		if (abs((x + 1) / 2 - ar[i]) < mn)
			mn = abs((x + 1) / 2 - ar[i]), ans = ar[i];
	cout << x << ' ' << ans << endl;
}

Measured memory_bytes: 1024
import itertools

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

index = []

for i, s in enumerate(itertools.permutations(range(1, n+1),n)):
    if s == p or s == q:
        index.append(i)


if len(index) == 2:
    print(abs(index[0]-index[1]))
else:
    print('0')




Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), k = 0;
        TreeSet<Integer> set = new TreeSet<>();
        for (int i = 1; i <= n; i++) {
            if(i*(i+1)/2<=n) set.add(i);
            else{
                k = i-1;
                break;
            }
        }
        if(k*(k+1)/2!=n){
            set.remove((k+1)*(k+2)/2-n);
            set.add(k+1);
        }
        StringBuilder sb = new StringBuilder();
        for(Integer x: set) sb.append(x).append("\n");
        out.print(sb);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 25172
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)
MOD = 10 ** 30 + 7

N, M = map(int, raw_input().split())
s = raw_input()

p27 = [1 for i in range(500000)]
for i in range(1, 500000):
    p27[i] = p27[i - 1] * 27
    p27[i] %= MOD

m = {}
P = (ord(s[0]) - ord('a') + 1)
l = 0
r = 0
for loop in range(M):
    S = raw_input()
    if S == 'L++':
        P -= (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
        l += 1
    elif S == 'L--':
        l -= 1
        P += (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
    elif S == 'R++':
        r += 1
        P *= 27
        P += (ord(s[r]) - ord('a') + 1)
        P %= MOD
    elif S == 'R--':
        P -= (ord(s[r]) - ord('a') + 1)
        P %= MOD
        for i in range(27):
            if (P + MOD * i) % 27 == 0:
                P = (P + MOD * i) / 27
                break
        r -= 1
    m[P] = 1
print len(m)


Measured memory_bytes: 73404
import java.util.*;
class Main {
    public static void main (String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) a[i] = sc.nextInt();
        for(int i = 0; i < n; i++) {
            if(i != 0) System.out.print(" ");
            System.out.print(a[n - i - 1]);
        }
        System.out.println();
    }
}


Measured memory_bytes: 26196
# coding: utf-8
N,K=map(int,input().split())
cnt=0
L=[]

for i in range(N):
    a,b=map(int,input().split())
    L.append([a,b])
    
#print(L)
L.sort(key=lambda x: x[0])
#print(L)

for i in range(N):
    cnt+=L[i][1]
    if cnt>=K:
        print(L[i][0])
        break

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

using namespace std;

int main() {
  vector<int> sides(3);
  for (int i = 0; i < 3; i++) cin >> sides[i];
  sort(begin(sides), end(sides));
  cout << sides[0] * sides[1] / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;
int N, M;
const int MAX_N = 50, MAX_M = 50;
int a[MAX_N], b[MAX_N], c[MAX_M], d[MAX_M];
int p[MAX_N];

void solve() {
	
	for (int i = 0; i < N; i++) {
		int minD = 10000000000000000;
		for (int j = 0; j < M; j++) {			
			if (minD > (abs(a[i] - c[j]) + abs(b[i] - d[j]))) {
				minD = (abs(a[i] - c[j]) + abs(b[i] - d[j]));
				p[i] = j + 1;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << p[i] << endl;
	}
	
}

int main()
{
	// 入力
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> c[i] >> d[i];
	}
	solve();
    return 0;
}

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N, M;
  cin >> N >> M;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++)  cin >> A.at(i) >> B.at(i);
  vector<int> ord(N);
  for (int i = 0; i < N; i++)  ord.at(i) = i;
  sort(ord.begin(), ord.end(),
       [&](int x, int y) { return A.at(x) < A.at(y); });
  priority_queue<int> que;
  int i = 0;
  int ans = 0;
  for (int d = 1; d <= M; d++) {
    while (i < N && A.at(ord.at(i)) <= d) {
      que.push(B.at(ord.at(i)));
      i++;
    }
    if (!que.empty()) {
      ans += que.top();
      que.pop();
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <queue>
#include <vector>

using namespace std;

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

#define next Aya

int n,m,head[50050],tail[50050],next[50050],r[50050],ecnt=1,s=1,t,d[50050],cur[50050],flow,a[105][105],b[105][105],ans,res[105],c[105][105];

inline void link(int u,int v,int w)
{
	next[++ecnt]=head[u];
	head[u]=ecnt;
	tail[ecnt]=v;
	r[ecnt]=w;
	next[++ecnt]=head[v];
	head[v]=ecnt;
	tail[ecnt]=u;
	r[ecnt]=0;
}

inline bool BFS()
{
	queue <int> q;
	q.push(t);
	memset(d,0,sizeof(d));
	d[t]=1;
	while (!q.empty())
	{
		int u=q.front();
		q.pop();
		for (int i=head[u];i;i=next[i])
		{
			int v=tail[i];
			if (d[v]==0 && r[i^1]>0)
			{
				d[v]=d[u]+1;
				q.push(v);
			}
		}
	}
	return d[s]>0;
}

inline int DFS(int u,int budget)
{
	if (u==t)
		return budget;
	int res=0;
	for (int &e=cur[u];e;e=next[e])
	{
		int v=tail[e];
		if (d[v]+1==d[u] && r[e]>0)
		{
			int delta=DFS(v,min(r[e],budget));
			if (delta)
			{
				r[e]-=delta;
				r[e^1]+=delta;
				flow+=delta;
				budget-=delta;
				res+=delta;
			}
		}
	}
	return res;
}
inline int Dinic()
{
	int ans=0;
	while (BFS())
	{
		for (int i=s;i<=t;i++)
			cur[i]=head[i];
		ans+=DFS(s,1145141919);
	}
	return ans;
}

vector <int> col[105][105];

inline int Get_Color(int u)
{
	return (u-1)/m+1;
}

inline bool cmp(int a,int b)
{
	return Get_Color(a)<Get_Color(b);
}

int main()
{
	n=read(),m=read();
	s=1;
	t=2*n+2;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			a[i][j]=read();
			col[i][Get_Color(a[i][j])].push_back(a[i][j]);
		}
	}
	for (int i=1;i<=m;i++)
	{
		for (int j=1;j<=n;j++)
		{
			for (int k=1;k<=n;k++)
			{
				if (col[j][k].size())
					link(j+1,k+n+1,1);
			}
			link(s,j+1,1);
			link(j+n+1,t,1);
		}
		ans+=Dinic();
		for (int j=1;j<=n;j++)
		{
			for (int k=head[j+1];k;k=next[k])
			{
				int v=tail[k]-n-1;
				if (v>=1 && v<=n && !r[k])
				{
					b[j][i]=*col[j][v].rbegin();
					col[j][v].pop_back();
				}
			}
		}
		for (int i=1;i<=ecnt+1;i++)
		{
			head[i]=0;
			next[i]=0;
			tail[i]=0;
			r[i]=0;
		}
		ecnt=1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
			cout << b[i][j] << " ";
		cout << endl;
	}
	for (int i=1;i<=m;i++)
	{
		for (int j=1;j<=n;j++)
			res[j]=b[j][i];
		sort(res+1,res+n+1,cmp);
		for (int j=1;j<=n;j++)
			c[j][i]=res[j];
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
			cout << c[i][j] << " ";
		cout << endl;
	}
	return 0;
}


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

using namespace std;
using ll=long long ;

void solve() {
    int n; cin >> n;
    ll sum = 0; int mi = 2e9;
    bool eq = true;
    for (int _ = 0; _ < n; _++) {
        int x,y;
        cin >> x >> y;
        sum += x;
        if (x > y)
            mi = min(mi, y);
        eq &= x==y;
    }
    if (eq) cout << 0;
    else {
        cout << (sum-mi);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

#define INF_LL (int64)1e18
//#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

class UnionFind{
private:
    ::std::vector<int_fast32_t> par, edge;
    size_t n;

public:
    UnionFind(){}
    UnionFind(size_t n):n(n){
        par.resize(n, -1);
        edge.resize(n, 0);
    }

    uint_fast32_t find(uint_fast32_t x){
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }

    size_t size(uint_fast32_t x){
        return -par[find(x)];
    }

    bool unite(uint_fast32_t x, uint_fast32_t y){
        x = find(x);
        y = find(y);
        edge[x] += 1;
        if(x == y) return false;
        if(size(x) < size(y)) std::swap(x, y);
        par[x] += par[y];
        edge[x] += edge[y];
        par[y] = x;
        return true;
    }

    bool same(uint_fast32_t x, uint_fast32_t y){
        return find(x) == find(y);
    }

    size_t esize(uint_fast32_t x) {
        return edge[find(x)];
    }
};

int main(void) {
    int64 M, K;
    cin >> M >> K;
    deque<int64> res;
    if (K >= (1 << M) || (K == 1 && M == 1)) {
        cout << -1 << endl;
        return 0;
    }
    int64 num = (K > 0 ? K : -1);
    if (num != -1) {
        res.push_back(num);
    }
    REP(i, 1 << M) {
        if (i != num) {
            res.push_back(i);
            res.push_front(i);
        }
    }
    if (num != -1)
        res.push_back(num);
    REP(i, res.size()) {
        cout << res[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 3968
/*input
3 2
1 0
2 1
1 0
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=505;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int n,m;
int a[maxn][maxn];

vector<pii> v;
vector<pair<pii,pii>> ans;
int main()
{
	IOS;
	cin>>n>>m;
	REP(i,n) REP(j,m) cin>>a[i][j];


	REP(i,n){
		if(i%2){
			REP(j,m){
				v.pb(MP(i,j));
			}
		}
		else{
			for(int j=m-1;j>=0;j--){
				v.pb(MP(i,j));
			}
		}
	}
	REP(i,SZ(v)-1){
		pii cur=v[i],nxt=v[i+1];
		if(a[cur.F][cur.S]%2){
			a[cur.F][cur.S]--;
			a[nxt.F][nxt.S]++;
			ans.pb(MP(cur,nxt));
		}
	}
	cout<<SZ(ans)<<'\n';
	REP(i,SZ(ans)){
		cout<<ans[i].F.F+1<<' '<<1+ans[i].F.S<<' '<<1+ans[i].S.F<<' '<<1+ans[i].S.S<<'\n';
	}

	return 0;
}


Measured memory_bytes: 7152
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep_3(i, initial, n) for (int i = (int)(initial); i < (int)(n); ++i)
#define repeat(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int i = (int)(n); i > 0; i--)
#define rep_r_3(i, initial, n) for (int i = (int)(initial); i > (int)(n); i--)
#define repeat_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define variable
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;
const double EPS = numeric_limits<double>::epsilon();
// 最大公約数
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; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
	vector< pair<ll, ll> > p;
	for(ll i = 2; i*i <= n; i++) {
		if ((n % i) != 0) continue;
		p.push_back(make_pair(i, 0));
		while((n % i) == 0) {
			n /= i;
			p[i].second += 1;
		}
		p.push_back(make_pair(n, 0));
	}

	if (n != 1) p.push_back(make_pair(n, 1));
	return p;
}

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	cout << C << endl;
	cout << A << endl;
	cout << B << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<ll> num(n);
  for(int i = 0;i <= n - 1;i++){
    cin >> num[i];
  }
  sort(num.begin(),num.end());
  ll x,y;
  x = 0;
  y = 0;
  ll count = 0;
  for(int i = n - 2;i >= 0;i--){
    if(num[i] == num[i + 1]){
      count++;
      if(x == 0){
        x = num[i];
      }
      else if(x != num[i] || count >= 3){
        y = num[i];
        i = -1;
      }
    }
    else{
      count = 0;
    }
  }
  cout << (long long)x * y << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

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

    int a;
    vector<int> A[N+1];
    for(int i=1; i<N+1; i++) {
        for(int j=0; j<N-1; j++) {
            cin >> a;
            A[i].emplace_back(a);
        }
    }

    int ans = 0, r = N * (N-1) / 2;
    bool flg, visited[N+1];
    while(r > 0) {
        for(int i=1; i<N+1; i++) visited[i] = false;
        flg = false;

        for(int i=1; i<N+1; i++) {
            if(visited[i]) continue;
            if(A[i].empty()) continue;
            if(i == A[A[i].front()].front()) {
                int p = A[i].front();
                if(visited[p]) continue;
                A[i].erase(A[i].begin());
                A[p].erase(A[p].begin());
                visited[i] = true;
                visited[p] = true;
                flg = true;
                r--;
            }
        }
        if(!flg) {
            ans = -1;
            break;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    int ans = 0;

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

    int p = 0;
    for(int i = 0; i < M; i++) {
        int x;
        cin >> x;
        p |= x << i;
    }

    
    for(int s = 0; s < (1 << N); s++) {
        int t = 0;
        for(int i = 0; i < N; i++) {
            if(s >> i & 1) {
                t ^= a[i];
            }
        }
        if(t == p) {
        ans++;
        }
    }

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
d, x = gets.chomp.split.map(&:to_i)
a = []

for i in 0..n-1
  num = 0
  num = gets.to_i
  a[i] = num
end

sum = 0

a.map do |z|
  sum = sum + (d-1)/z
end

puts sum  + n + x


Measured memory_bytes: 3836
N,M,X=map(int,input().split())
s=[list(map(int,input().split())) for i in range(N)]
t=[]
for i in range(1<<N):
  u=[0]*(M+1)
  for j in range(N):
    if ((i>>j)&1)==1:
      u=[u[k]+s[j][k] for k in range(M+1)] 
  for k in range(M):
    if u[k+1]<X:
      break
  else:
    t.append(u[0])
t.sort()
print(-1 if t==[] else t[0])

Measured memory_bytes: 9132
#

import sys
input=sys.stdin.readline

def main():
    ab="abcdefghijklmnopqrstuvwxyz"
    S=input()
    ans="None"
    for a in ab:
        if not a in S:
            ans=a
            break
    print(ans)
    
if __name__=="__main__":
    main()


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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a;
  for(int i=0, x; i<n; i++){
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end(), greater<int>()) ;
  int alice = 0, bob = 0;
  for(int i=0; i<a.size(); i++){
    if((i+1) % 2) alice+=a[i];
    else bob+=a[i];
  }
  cout << alice - bob << endl;
  return 0;
}


Measured memory_bytes: 256
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let s = buf.trim();
    let mut is_a = false;
    let mut is_b = false;
    for c in s.chars() {
        if c == 'A' {
            is_a = true;
        }
        if c == 'B' {
            is_b = true;
        }
    }
    println!("{}", if is_a && is_b { "Yes" } else { "No" })
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
int ans = 0;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int main() {
	cin >> H >> W;
	vector<vector<char>>a(H + 1, vector<char>(W + 1));
	vector<vector<int>>b(H + 1, vector<int>(W + 1, 0));
	vector<pair<int, int>>init;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#')init.push_back(make_pair(i, j));
		}
	}
	N = init.size();
	auto c = [&b](pair<int, int> l, pair<int, int> r) {return b[l.first][l.second] > b[r.first][r.second]; };
	priority_queue<pair<int, int>,vector<pair<int,int>>,decltype(c)>q(c);
	vector<int>len(N, 0);
	for (int i = 0; i < N; i++) {
		b[init[i].first][init[i].second] = -1;
		q.push(init[i]);
	}
	bool flag = 1;
	while (!q.empty()) {
		pair<int, int> tmp = q.top();
		q.pop();
		//cout << b[tmp.first][tmp.second] << endl;
		for (int j = 0; j < 4; j++) {
			int x = tmp.first + dx[j];
			int y = tmp.second + dy[j];
			//cout << tmp.first << tmp.second << endl;
			if (x > 0 && x < H + 1 && y>0 && y < W + 1 && b[x][y] == 0) {
				if (b[tmp.first][tmp.second] == -1)b[x][y] = 1;
				else b[x][y] = b[tmp.first][tmp.second] + 1;

				q.push(make_pair(x, y));
			}
		}
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			ans = max(ans, b[i][j]);
			//cout << b[i][j] << endl;
		}
	}
	if (ans == -1)ans = 0;
	cout << ans << endl;
}


Measured memory_bytes: 29672
import sys
input = sys.stdin.readline
from collections import *

def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct

N = int(input())
fct = factorize(N)
ans = 0

for _, c in fct:
    sub = 1
    
    while c-sub>=0:
        ans += 1
        c -= sub
        sub += 1

print(ans)

Measured memory_bytes: 66272
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int N, C, X, D[30][39], t[3][30]={0};
	cin >> N >> C;
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++){
			cin >> D[i][j];
		}
	}
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cin >> X;
			t[(i+j)%3][X-1]++;
		}
	}
	int res=1<<30;
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++){
			if(i!=j){
				for(int k=0; k<C; k++){
					if(i!=k && j!=k){
						int tt=0;
						for(int l=0; l<C; l++){
							tt+=D[l][i]*t[0][l];
						}
						for(int l=0; l<C; l++){
							tt+=D[l][j]*t[1][l];
						}
						for(int l=0; l<C; l++){
							tt+=D[l][k]*t[2][l];
						}
						if(tt<res){
							res=tt;
						}
					}
				}
			}
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define MAX(a,b) ((a)>b?(a):b)
int n,m;
bool a[20];
inline bool check(int x)
{
	while(x)
	{
		if(a[x%10])
			return 0;
		x/=10;
	}
	return 1;
}
signed main()
{
	scanf("%d%d",&n,&m);int t,sx(MAX((n<<1)+(n<<3),1e4));
	while(m--)
		scanf("%d",&t),a[t]=1;
	for(register int i(n);i<=sx;i++)
		if(check(i))
			return !printf("%d\n",i);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);

#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SORT(v) sort(ALL(v));
#define RSORT(v) sort(RALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}
template<typename T> T lcm(T a,T b){return a*b/gcd(a, b);}


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
int main() {
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    a--;
    COUT(b-a-(b/c-a/c+b/d-a/d-(b/lcm(c, d)-a/lcm(c, d))));
}


Measured memory_bytes: 3512
#include <bits/stdc++.h>
#include <limits>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i,n) for( ll i=0 ; i<n ; i++ )
#define f(i, a, b) for( ll i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
#define MOD 1000000007

ll digits(ll n)
{
    return floor(log10(double(n))) + 1;
}
vector<ll> SieveOfEratosthenes(ll n,ll a)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    vector<ll>v;
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {

            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (ll p= a; p<=n; p++)
       if (prime[p])
          v.push_back(p);
    return v;
}
void permute(string a, int l, int r)
{
    // permutes string
    if (l == r)
    {
        cout<<a<<endl;
    }
    else
    {
        for (int i = l; i <= r; i++)
        {
            swap(a[l], a[i]);
            permute(a, l+1, r);
        }
    }
}
int main()
{
    int n;
    cin>>n;
    bool temp = false;
    int arr[n][2];
    for(int i =0;i<n;i++)
    {
        cin>>arr[i][0];
        cin>>arr[i][1];
    }
    int i=0;
    while(i<n)
    {
        if(arr[i][0]==arr[i][1] && arr[i + 1][0]==arr[i + 1][1] && arr[i + 2][0]==arr[i + 2][1] && (i + 2)<n)
        {
            temp = true;
            break;
        }
        else
            i++;
    }
    if(temp)
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{

// }}}


signed main()
{
    int N; cin >> N;

    vector<int> a(N+1);
    vector<i64> d;
    for (int i = 1; i <= N; ++i) {
        cin >> a[i];
        d.push_back(a[i] - i);
    }

    sort(ALL(d));
    int b;
    int mid = d.size() / 2;
    if (d.size() % 2 == 0) {
        b = (d[mid] + d[mid-1]) / 2;
    } else {
        b = d[mid];
    }

    i64 ans = 0;
    for (int i = 1; i <= N; ++i){
        ans += abs(a[i] - (b + i));
    }

    cout << (ans) << endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    std::vector<int> p(N);
    for(int i=0;i<N;i++){
        cin >> p.at(i);
    }
    int count = 1;
    int tmp;
    tmp = p.at(0);
    for(int i=1;i<N;i++){
        if(tmp>=p.at(i)){
            tmp = p.at(i);
            count++;
        }       
    }
    cout << count<< endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;

vector<int> graph[200000];
ll val[200000];

void dfs(int pos, int cnt, ll sum)
{
    val[cnt] += sum;
    for (auto& v : graph[cnt]) {
        if (v != pos) {
            dfs(cnt, v, val[cnt]);
        }
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, Q;
    cin >> N >> Q;
    vector<int> pos(Q), x(Q);
    rep(i, N - 1)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<ll> ans(N);
    rep(i, Q)
    {
        int pos, x;
        cin >> pos >> x;
        val[--pos] += x;
    }
    dfs(-1, 0, 0);
    rep(i, N)
    {
        if (i) {
            cout << " ";
        }
        cout << val[i];
    }
    cout << endl;
    return 0;
}

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


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

    if(x<a) cout<<0<<endl;
    else cout<<10<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
string a, b;
int memo[3100][3100];
int la, lb;
void lcs(){
	for(int y = 1;y<=la;y++){
		for(int x = 1;x<=lb;x++){
			if(a[y-1] == b[x-1]){
				memo[y][x] = memo[y-1][x-1] + 1; // how can?
			}else{
				memo[y][x] = max(memo[y-1][x], memo[y][x-1]);
			}
		}
	}
	
	string ret = "";
	// backtrack
	int cy = la, cx = lb;
	while(memo[cy][cx] != 0){
//		cout<<cy<<" "<<cx<<"\n";
		if(a[cy-1] == b[cx-1]){
			ret+=a[cy-1];
			cy--;cx--;
		}else{
			if(memo[cy-1][cx] > memo[cy][cx-1]){
				cy--;
			}else{
				// kalo sama, terserah mau kemana
				cx--;
			}
		}
		
	}
	int lr = ret.length();
	for(int i  = lr-1;i>=0;i--) cout<<ret[i];cout<<"\n";
//	cout<<memo[la][lb]<<"\n";
}

int main(){
	cin>>a>>b;
	la = a.length(), lb = b.length();
	
	lcs();
	
//	for(int i = 0;i<=la;i++){
//		for(int j = 0;j<=lb;j++){
//			printf("%2d ",memo[i][j]);
//		}cout<<"\n";
//	}
	return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (A == B && B== C && C == A ) {
    cout << "No" << endl;
   
  }
  else if (A == B || B == C || C == A ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
 
 }

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
using P = pair<double,int>;


int main(){
  ll a;
  long double b;
  cin >> a >> b;
  ll res = a*b;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include<string>
#include<cmath>


using namespace std;
int main(void){
  int N,K;
  int R,S,P;
  string T;
  cin>>N>>K;
  cin>>R>>S>>P;
  cin>>T;
  int ans=0;
  string takahasi="";
  for(int i=0;i<K;i++){
      if(T[i]=='r'){
          takahasi+="p";
          ans+=P;
      }
      else if(T[i]=='s'){
          takahasi+="r";
          ans+=R;
      }
      else if(T[i]=='p'){
          takahasi+="s";
          ans+=S;
      }
  }
  int j=0;
  for(int i=K;i<N;i++){
      if(i+K<N){
      if(T[i]=='r'){
          if(takahasi[j]!='p'){
          takahasi+="p";
          ans+=P;
          }else {
              if(T[i+K]=='p')takahasi+="r";
              else if(T[i+K]=='r')takahasi+="s";
              else takahasi+="p";
          }
      }
      else if(T[i]=='s'){
          if(takahasi[j]!='r'){
          takahasi+="r";
          ans+=R;
          }else{
              if(T[i+K]=='r')takahasi+="s";
              else if(T[i+K]=='s')takahasi+="p";
              else takahasi+="r";
          }
      }
      else if(T[i]=='p'){
          if(takahasi[j]!='s'){
          takahasi+="s";
          ans+=S;
          }
          else {
              if(T[i+K]=='r')takahasi+="s";
              else if(T[i+K]=='s')takahasi+="p";
              else takahasi+="r";
          }
      }
      }
      else {
      if(T[i]=='r'){
          if(takahasi[j]!='p'){
          takahasi+="p";
          ans+=P;
          }
      }
      else if(T[i]=='s'){
          if(takahasi[j]!='r'){
          takahasi+="r";
          ans+=R;
          }
      }
      else if(T[i]=='p'){
          if(takahasi[j]!='s'){
          takahasi+="s";
          ans+=S;
          }
      }
      }
      j++;
  }
  cout<<ans<<endl;
  return 0;
  }


Measured memory_bytes: 640
/*
 * main.c
 *
 *  Created on: 2019/03/09
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef unsigned long long int uint64_t;

uint64_t xor(uint64_t in)
{
	uint64_t out = (in + 1) / 2;
	out = out % 2;
	if((in % 2) == 0) {
		out ^= in;
	}
	return out;
}
int main()
{
	unsigned long long int A, B;
	unsigned long long int toA = 0;
	unsigned long long int toB = 0;
	scanf("%llu %llu", &A, &B);
	toB = xor(B);
	toA = xor(A-1);
	printf("%llu\n", toA^toB);

	return 0;
}


Measured memory_bytes: 128
import math

N = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
l = [0] * (N + 1)

flag = 0
s = sum(a)
if s == 0:
    print("0")
    exit()

for i in range(N, 0, -1):
    i_max = math.floor(N / i)

    if i_max == 1:
        l[i] = a[i]
    else:
        tmp = 0
        for j in range(i_max, 1, -1):
            tmp += l[i * j]


        if tmp % 2 == a[i]:
            l[i] = 0
        else:
            l[i] = 1

print(sum(l))
for i in range(1, N + 1):
    if l[i] == 1:
        print(i, " ")

Measured memory_bytes: 7760
//#define _USE_MATH_DEFINES
#include <iostream>
//#include <stdio.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>

using namespace std;

#define N_MAX 1000000

int kouho[N_MAX / 2];

int main(){

	vector <int> sosuu;
	int check;
	//int kouho[N_MAX / 2];
	int n;
	int cnt;

	for (int i = 0; i < N_MAX / 2; i++){
		kouho[i] = i * 2 + 1;
	}
	kouho[0] = 0;

	sosuu.push_back(2);
	check = 3;

	while (check < 1000){
		sosuu.push_back(check);
		for (int i = check/2; i < N_MAX / 2; i++){
			if ((kouho[i] % check) == 0){
				kouho[i] = 0;
			}
		}
		for (int i = check/2; i < N_MAX / 2; i++){
			if (kouho[i] != 0){
				check = kouho[i];
				break;
			}
		}
	}
	
	
	while (cin >> n){
		cnt = 0;
		if (n <= 1000){
			for (int i = 0; i < sosuu.size(); i++){
				if (sosuu[i] <= n)cnt++;
				else break;
			}
		}
		else{
			cnt += sosuu.size();
			for (int i = 0; i < N_MAX /2; i++){
				if (kouho[i] > n){
					break;
				}
				else{
					if (kouho[i] != 0)cnt++;
				}
			}
		}
		cout << cnt << endl;
	}

	

	return 0;
}

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

int main(void){
	int sx,sy,tx,ty,x,y,i;
	
	scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
	x=tx-sx,y=ty-sy;
	
		for(i=1;i<=x;i++){
			putchar('R');
		}	
			for(i=1;i<=y;i++){
			putchar('U');
		}	
			for(i=1;i<=x;i++){
			putchar('L');
		}	
			for(i=1;i<=y;i++){
			putchar('D');
		}	
	putchar('D');
			for(i=1;i<=x+1;i++){
			putchar('R');
		}	
	for(i=1;i<=y+1;i++){
			putchar('U');
		}	
	putchar('L');
	putchar('U');
			for(i=1;i<=x+1;i++){
			putchar('L');
		}	
			for(i=1;i<=y+1;i++){
			putchar('D');
		}	
	putchar('R');
	//putchar('\n');
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
lli lcm(lli num1, lli num2){
    return num1 / gcd(num1, num2) * num2;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> A >> B;
  if(A<=B)Out("unsafe");
  else Out("safe");
}

Measured memory_bytes: 3648
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
using namespace std;

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

char t[101][101];
int dx[256],dy[256];
int dp[1<<12];

int main(void){
	dx['R'] = 1;
	dx['L'] = -1;
	dy['U'] = -1;
	dy['D'] = 1;

	int hpInit,hpMax;

	while(cin>>hpInit>>hpMax && (hpInit||hpMax)){
		int H,W;
		cin>>H>>W;
		rep(i,H) cin>>t[i];

		int T;
		cin>>T;
		map<char,int> d;
		rep(i,T){
			int damage;
			char ch;
			cin>>ch>>damage;
			d[ch] = damage;
		}

		int S;
		cin>>S;
		vector<int> v;
		v.push_back(0);
		int x=0,y=0;

		rep(i,S){
			char ch;
			int n;
			cin>>ch>>n;
			rep(j,n){
				int nx = x + dx[ch];
				int ny = y + dy[ch];

				v.push_back(d[t[ny][nx]]);
				x = nx;
				y = ny;
			}
		}

		int P;
		cin>>P;
		int p[P];
		rep(i,P) cin>>p[i];

		memset(dp,-1,sizeof(dp));
		dp[0] = hpInit;

		rep(i,v.size()){
			rep(j,1<<P) if(dp[j] > 0){
				rep(k,P) if((j & (1<<k)) == 0){
					int idx = (j | (1<<k));
					dp[idx] = max(dp[idx],min(hpMax,dp[j]+p[k]));
				}
			}

			rep(j,1<<P) dp[j] -= v[i];
		}

		bool ans = false;
		rep(i,1<<P) if(dp[i] > 0){
			ans = true;
			break;
		}

		cout<<(ans?"YES":"NO")<<endl;
	}

	return 0;
}

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

const int mod = 1000000007;
struct mint {
    ll x; //typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        //tが0なら1を返す
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    //逆元を求める、mod-2乗
    mint inv() const {
        return pow(mod-2);
    }
    //逆元をかける
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

mint f(int n) {
    if (n == 0)  return 1;
    mint x = f(n/2);
    x *= x;
    if (n%2 == 1) x *= 2;
    return x;
}

mint choose(int n, int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    mint ans = f(n);
    ans -= 1;
    ans -= choose(n,a);
    ans -= choose(n,b);
    cout << ans.x << "\n";
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var w, h, x, y, r int
	fmt.Scan(&w, &h, &x, &y, &r)

	if x-r >= 0 &&
		y-r >= 0 &&
		x+r <= w &&
		y+r <= h {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1156
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N = int(input())
    A = input_nums()
    B = input_nums()
    C = input_nums()
    total = 0
    before = -2
    for a in A:
        total += B[a-1]
        if before + 1 == a - 1:
            total += C[a-2]
        before = (a - 1)
    print(total)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
import sys

n,m = map(int, input().split())
a = [0]
for i in range(m):
    a.append(int(input()))
a.append(n)
    
mod = 1000000007
ans = 1

for i in range(1,len(a)-2):
    if a[i+1]-a[i]==1:
        print(0)
        sys,exit()

b = []
for i in range(1,len(a)):
    if i == 1:
        b.append(a[1]-1-a[0])
    elif i == len(a)-1:
        b.append(a[i]-(a[i-1]+1))
    else:
        b.append(a[i]-1-(a[i-1]+1))

dp = []
for i in range(10**6):
    if i == 0:
        dp.append(1)
        continue
    if i == 1:
        dp.append(1)
        continue
    if i == 2:
        dp.append(2)
        continue
    dp.append((dp[i-1]+dp[i-2])%mod)

if m == 0:
  print(dp[n])
  sys.exit()
    
for i in range(len(b)):
    l = b[i]
    ans = (ans*dp[l])%mod
    
print(ans)

Measured memory_bytes: 46136