akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	private static readonly int MAXTIME = 200001;

	public static void Main()
	{
		int N = GetInt();
		int C = GetInt();

		int[] s = new int[N];
		int[] t = new int[N];
		int[] c = new int[N];
		for(int i = 0; i < N; i++)
		{
			s[i] = GetInt();
			t[i] = GetInt();
			c[i] = GetInt();
		}

		int[] numPrograms = new int[MAXTIME + 1];
		for(int channel = 1; channel <= 30; channel++)
		{
			int[] offset = new int[MAXTIME + 1];
			for(int i = 0; i < N; i++)
			{
				if(c[i] == channel)
				{
					offset[s[i] * 2 - 1]++;
					offset[t[i] * 2]--;
				}
			}
			
			int[] csum = new int[MAXTIME + 1];
			for(int i = 1; i <= MAXTIME; i++)
				csum[i] = csum[i-1] + offset[i];

			for(int i = 1; i <= MAXTIME; i++)
				if(csum[i] > 0)
					numPrograms[i]++;
		}

		Console.WriteLine(numPrograms.Max());
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 36052
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B;
  cin >> A >> B;
  if (B%A==0) cout << A+B << endl;
  else cout << B - A << endl;
  return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
    #define int long long
    #define D long double
    using namespace std;
    struct Vertex{int a; int b;};
    vector<Vertex> bor;
    Vertex create(){
        Vertex v = {-1, -1};
        return v;
    }
    int n, l, grundy;
    int add(int v, char num){
        if (num == '0'){
            if (bor[v].a != -1){
                return bor[v].a;
            }
            else{
                bor.push_back(create());
                bor[v].a = bor.size() - 1;
                return bor[v].a;
            }
        }
        else{
            if (bor[v].b != -1){
                return bor[v].b;
            }
            else{
                bor.push_back(create());
                bor[v].b = bor.size() - 1;
                return bor[v].b;
            }
        }
    }
    void change(int number){
        for (int i=0; i < 61; i++){
            int ba = (1LL << i) & number;
            if (ba != 0){
                grundy ^= (1LL<< (i+1));
                return;
            }
        }
    }
    void dfs(int vertex, int g){
        if (bor[vertex].a == -1 && bor[vertex].b == -1) return;
        if (bor[vertex].a != -1 && bor[vertex].b != -1){
            dfs(bor[vertex].a, g+1);
            dfs(bor[vertex].b, g+1);
            return;
        }
        change(l - g);
        if (bor[vertex].a != -1){
            dfs(bor[vertex].a, g+1);
        }
        else dfs(bor[vertex].b, g+1);
    }
    signed main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cin >> n >> l;
        grundy = 0;
        bor.push_back(create());
        for (int i=0; i < n; i++){
            string s;
            cin >> s;
            int now = 0;
            for (int j=0; j < s.size(); j++){
                now = add(now, s[j]);
            }
        }
        dfs(0, 0);
        if (grundy == 0) cout << "Bob" << endl;
        else cout << "Alice" << endl;
        return 0;
    }

Measured memory_bytes: 2548
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
//const long long INF = 1LL << 60;
 int INF = 500000;
 int MAX = 1e5+10;
 ll mod = 1e9+7;

int main(){
  int n,m;
 cin >> n >> m;
 //n：偶数
 //m:奇数
 int even = n*(n-1)/2; 
 int odd = m*(m-1)/2;
 int ans = even + odd;
 cout << ans <<endl; 
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    int d;cin>>d;
    string s;
    if(d==25) s = "Christmas";
    else if(d==24) s = "Christmas Eve";
    else if(d==23) s = "Christmas Eve Eve";
    else s ="Christmas Eve Eve Eve";
    cout<<s<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll dp[2200][2200];
int main(){
    ll n;cin>>n;
    vector<l_l> a(n);
    rep(i,n){
        cin>>a[i].fi;
        a[i].se=i;
    }
    sort(a.rbegin(),a.rend());
    rep(i,2200){
        rep(j,2200){
            dp[i][j]=-LINF;
        }
    }
    dp[0][0]=0;
    rep(t,n){
        ll now=a[t].fi;
        ll p=a[t].se;
        rep(l,t+1){
            if(dp[t][l]>=0){
                chmax(dp[t+1][l+1],dp[t][l]+now*abs(p-l));
                chmax(dp[t+1][l],dp[t][l]+now*abs(n-1-(t-l)-p));
            }
        }
    }
    ll mx=-LINF;
    rep(i,n+1)chmax(mx,dp[n][i]);
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 41472
a, b, c, x, y = map(int, input().split())

ans = 5000 * 2 * (10**10)
for i in range((10 ** 5) + 1):
    check = 2*c*i + max(x-i,0)*a + max(y-i,0)*b
    if(ans > check):
        ans = check
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;
static const int MAX_M = 100000;

int dat[MAX_M*3],lazy[MAX_M*3];

class LazySegmentTree{
public:

    int n;
    LazySegmentTree(vector<int> v){
        n=1;
        while(n<v.size())n*=2;
        for(int i=0;i<v.size();++i)dat[n+i-1]=v[i];
        for(int i=0;i<2*n-1;++i)lazy[i]=0;
        for(int i=n-2;i>=0;--i)dat[i]=dat[2*i+1]+dat[2*i+2];
    }

    void eval(int k,int l,int r){
        if(lazy[k]!=0){
            dat[k]+=lazy[k];
            if(r-l>1){
                lazy[2*k+1]+=lazy[k]/2;
                lazy[2*k+2]+=lazy[k]/2;
            }
            lazy[k]=0;
        }
    }

    void add(int a,int b,int x,int k,int l,int r){
        eval(k,l,r);
        if(b<=l||r<=a)return;
        if(a<=l&&r<=b){
            lazy[k]+=(r-l)*x;
            eval(k,l,r);
        }
        else{
            add(a,b,x,2*k+1,l,(l+r)/2);
            add(a,b,x,2*k+2,(l+r)/2,r);
            dat[k]=dat[2*k+1]+dat[2*k+2];
        }
    }

    int query(int a,int b,int k,int l,int r){
        eval(k,l,r);
        if(b<=l||r<=a)return 0;
        if(a<=l&&r<=b)return dat[k];
        int vl = query(a,b,2*k+1,l,(l+r)/2);
        int vr = query(a,b,2*k+2,(l+r)/2,r);
        return vl+vr;
    }
};

int N,M;
int L[MAX_M*3],R[MAX_M*3];
vector<P1> len[MAX_M*3];
vector<int> init(MAX_M,0);
LazySegmentTree seg(init);
int pre;

void solve(int d){
    int res=N-(pre+len[d].size());
    pre+=len[d].size();
    for(auto v : len[d]){
        int l = v.first,r = v.second;
        seg.add(l,r+1,1,0,0,seg.n);
    }
    int x=0,t=1;
    while(1){
        if(x>M)break;
        res+=seg.query(x,x+1,0,0,seg.n);
        x=d*t;
        t++;
    }
    cout<<res<<endl;
}


signed main(){
    cin>>N>>M;
    for(int i=0;i<N;++i){
        cin>>L[i]>>R[i];
        len[R[i]-L[i]+1].PB(P1(L[i],R[i]));
    }
    for(int i=1;i<=M;++i){
        solve(i);
    }
}


Measured memory_bytes: 25200
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Combination{
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r] % atcoder_mod) % atcoder_mod;
	}

};
ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

ll BallBoxCombination3(ll n,ll k){
	ll sum = 0;
	Combination comb(k);
	for(ll i=1;i<=k;i++){
		ll C = comb.Caluclation(k,i)%atcoder_mod;
		ll P = powermod(i,n,atcoder_mod)%atcoder_mod;
		ll V = (C*P)%atcoder_mod;
		if((k-i)%2){
			sum = (sum-V+atcoder_mod)%atcoder_mod;
		}
		else sum = (sum+V)%atcoder_mod;
	}
	return sum;
}

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

	ll N=in<ll>(),K=in<ll>();
	
	ll ans = BallBoxCombination3(N,K);
	out(ans);
	return 0;
}



Measured memory_bytes: 3204
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a < b){
		printf("a < b\n");
	}
	if(a > b){
		printf("a > b\n");
	}
	if(a == b){
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) cout<<"Case #"<<i<<": "
using namespace std;
typedef long long int ll;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main() {
string s; cin>>s;
ll ans=0,cnt=0;
rep(i,0,s.size()){
if(s[i]=='W') ans+=cnt;
else cnt++;
}
cout<<ans<<endl;
	return 0;
}


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

#define int long long
#define ld long double

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>b;i--)

#define pb push_back
#define mp make_pair
#define all(A) A.begin(),A.end()
#define allr(A) A.rbegin(),A.rend()
#define precise(i) fixed << setprecision(i)
#define fi first
#define se second

#define err() cout<<"\n==================================\n";
#define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n";
#define err1(a) cout<<#a<<" "<<a<<"\n";
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n";
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n";

const int logN = 20;
const int M = 1000000007;
const int INF = 1e12;
#define PI 3.14159265;
const int N = 200005;

#define Pii pair<int,int>
#define Vi vector<int>
#define Vpii vector<Pii>

void solve()
{
       int a;
       cin>>a;
       cout<<(a+a*a+a*a*a);
}

int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)
    {
           solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
using namespace std;
using ld = long double;

int main(){
    int a, b, x;
    cin >> a >> b >> x;
    if(x >= (a*a*b)/2.0){
        ld p;
        ld k = a*a*a;
        ld h = (2*a*a*b-2*x)/(k);
        p = std::atan(h);
        ld deg = p*180.0/M_PI;
        cout << std::setprecision(10) << deg;
    }
    else{
        double k = x;
        ld p;
        ld h = a*b*b/(2.0*k);
        p = std::atan(h);
        ld deg = p*180.0/M_PI;
        cout << std::setprecision(10) << deg;
    }
}

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

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

void WF(ll N,  vector<vector<ll>> &g) {
	repn(k, N) {
		repn(i, N) {
			repn(j, N) {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}
}


int main() {

    ll N;
    cin >>N;
    vector<ll> A(N+1);
    repn(i,N) cin >>A[i];

    sort(++A.begin(),A.end(),greater<ll>());

    vector<ll> h;

    repn(i,N-1){
        if(A[i]==A[i+1]){h.push_back(A[i]);i++;}
    }

    if(h.size()<2){cout <<0;}
    else{cout <<h[0]*h[1];}


 
	

}


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

int main() {

 int n;
 cin >> n;
 
 vector<tuple<string,int,int>> a;
 
 for(int i = 1; i <= n; i++) {
  string s;
   int p;
   cin >> s >> p;
   p = -p;
   a.push_back(tie(s,p,i));
  }
  
 sort(a.begin(), a.end());
 for(int i = 0; i <= n - 1; i++) {
  cout << get<2>(a[i]) << endl;
  }
}

Measured memory_bytes: 3592
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

x = INT()
ans = x // 11 * 2
tmp = x % 11
if 0 < tmp <= 6:
    ans += 1
elif 6 < tmp < 11:
    ans += 2
print(ans)

Measured memory_bytes: 60012
using System;

class Plogram
{
    static void Main()
    {
        DateTime date = DateTime.Parse(Console.ReadLine());
        int y = date.Year;
        int m = date.Month;
        int d = date.Day;
        int ymd = y * 10000 + m * 100 + d;

        string str = "Heisei";
        if (ymd>20190430)
        {
            str = "TBD";
        }
        Console.WriteLine(str);
    }
}

Measured memory_bytes: 15200
#include<iostream>
using namespace std;
const int N = 110;
int cnt[N];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		int d;
		cin>>d;
		for(int j=1;j<=d;j++){
			int a;
			cin>>a;
			cnt[a]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(!cnt[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#define FAST ios::sync_with_stdio(false)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = (int)2e5 + 5;
const int mod = (int)1e9 + 9;
using namespace std;

struct biu{
	int x, y;
}a[maxn];

int num[maxn], l[maxn], r[maxn];

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		a[i].x = x, a[i].y = y;
		num[x]++, num[y]--;
		r[x+1]++, l[y]++;
	}
	int Max = 0, sum = 0;
	for(int i = 1; i <= 100000; i++){
		sum += num[i];
		Max = max(Max, sum);
	}
	for(int i = 2; i <= 100000; i++){
		l[i] += l[i-1], r[i] += r[i-1];
	}
	int ans = 0;
	for(int i = 1; i <= n; i++){
		ans = max(ans, r[a[i].y] - l[a[i].x]);
	}
	printf("%d %d\n", ans, Max);
	return 0;
}


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

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

long long ngcd(vector<long long> a) {
  long long res = a[0];
  for(int i=1; i<a.size() && res!=1; i++) res = gcd(a[i], res);
  return res;
}
long long nlcm(vector<long long> a){
  long long res = a[0];
  for(int i=1; i<a.size(); i++) res = lcm(a[i], res);
  return res;
}
bool is_prime(long long n) {
  if(n < 2) return false;
  for (long long i = 2; i * i <= n; i++) if (n % i == 0) return false;
  return true;
}
int digsum(int n) {
  int res=0;
  while(n) res += n%10, n /= 10;
  return res;
}
int digcnt(int n){
  int res=0;
  while(n) res++, n /= 10;
  return res;
}
vector<int> divisor(int n) {
  vector<int> res;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n+1);
  reps(i,n) cin>>a[i];
  
  vll cnt(n+1);
  vector<bool> flgs(n+1);
  rreps(i,n){
    if(cnt[i]%2!=a[i]){
      // if(cnt[i]%2==1){
      //   cout<<-1<<endl;
      //   return 0;
      // }
      cnt[i]+=1;
      flgs[i]=true;
      auto div=divisor(i);
      for(auto e: div){
        if(e==i) continue;
        cnt[e]++;
      }
    }
  }
  // reps(i,n){
  //   cout<<cnt[i]<<" ";
  // }
  // cout<<endl;
  vll ans;
  reps(i,n){
    if(flgs[i]) ans.push_back(i);
  }
  cout<<ans.size()<<endl;
  rep(i,ans.size()){
    if(i) cout<<" ";
    cout<<ans[i];
  }
  if(ans.size()) cout<<endl;
  
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
#define PI 3.141592653589793
#define MOD 1000000007
//#define MOD 998244353
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const ll INF = 1LL << 60;

//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main() {
    ll n,ans=0;
    cin >> n;
    set<ll> s;
    for (ll i=0;i<n;i++){
        ll a;
        cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;



map<string,int>h;
string s[105];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        h[s[i]]++;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>s[n];
        h[s[n]]--;
    }
    int max=0;
    for(int i=0;i<n;i++)
    if(h[s[i]]>max)
    max=h[s[i]];
    cout<<max;
   // system("pause");
    return 0;
}   
    

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <set>
#include <cstdio>
using namespace std;

typedef long long ll;
typedef pair<ll,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
int main() {
	ll n,s;
	cin>>n>>s;
	if(n<s){
		cout<<"-1"<<endl;
		return 0;
	}
	if(n==s){
		cout<<n+1<<endl;
		return 0;
	}
	ll b;
	for(b=2;b*b<=n;++b){
		ll k=n;
		ll s2=0;
		while(k>0){
			s2+=k%b;
			k/=b;
		}
		if(s2==s){
			cout<<b<<endl;
			return 0;
		}
	}
	for(ll a=(n-s)/(b-1)+1;a>0;--a){
		if((n-s)%a==0){
			b=(n-s)/a+1;
			ll k=n;
			ll s2=0;
			while(k>0){
				s2+=k%b;
				k/=b;
			}
			if(s2==s){
				cout<<b<<endl;
				return 0;
			}
		}
	}
	cout<<"-1"<<endl;
	return 0;
}


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

using namespace std;

const int MAX = 200005;
int N;

int X[MAX];
int Y[MAX];

typedef long long ll;

void slove() {
    for (int i = 0; i < N; ++i) {
        Y[X[i]] = i;
    }

    ll ans = 0;

    int l;
    int r;

    set<int> S;
    S.insert(-1);
    S.insert(N);

    for (int i = 1; i <= N; ++i) {
        int p = Y[i];

        //auto il = S.lower_bound(p);
        auto iu = S.upper_bound(p); // ok
        auto il = iu;
        il--;

        //cout << i << " " << p << endl;
        //cout << "il: " << *il << endl;
        //cout << "iu: " << *iu << endl;

        l = p - *il;
        r = *iu - p;

        //cout << l << endl;
        //cout << r << endl;
        //cout << "---" << endl;

        S.insert(p);

        ans += ((ll) l) * ((ll) r) * ((ll) i);
    }

    cout << ans << endl;
}

int main(int argc, char* argv[]) {
    cin >> N;

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

    slove();

    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
	string s,t;
	cin>>s>>t;
	int n = s.size(), m = t.size();
	int dp[n+1][m+1];
	for(int i = 0; i<n+1; i++)
	for(int j = 0; j<m+1; j++)
	dp[i][j] = 0;
	for(int i = 0; i<n+1; i++){
		for(int j = 0; j<m+1; j++){
			if(i == 0|| j == 0){
				dp[i][j] = 0;
				continue;
			}
			if(s[i-1] == t[j-1]){
				dp[i][j] = 1 + dp[i-1][j-1];
			}
			else{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	string str;
	int i = n, j = m;
	while(i>0 && j>0){
			if(dp[i][j] == dp[i-1][j]){
				i = i-1;
			}
			else if(dp[i][j] == dp[i][j-1]){
				j = j-1;
			}
			else{
				i = i-1, j = j-1;
				if(s[i]!= 0)
				str += s[i];
			}
	}
	for(int k = str.length()-1; k>= 0; k--)
	cout<<str[k];
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ff first
#define ss second
#define sfi(a) scanf("%d",&a)
#define sfi2(a,b) scanf("%d %d",&a,&b)
#define sfi3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(a) scanf("%lld",&a)
#define all(a) a.begin(),a.end()
#define keepu(a) a.erase(unique(all(a)),a.end())
#define inf 1e7
#define m_p make_pair
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define mem(x,val) memset(x,val,sizeof(x))
#define read freopen("output.txt","r",stdin)
#define write freopen("input.txt","w",stdout)
#define FAST  ios_base::sync_with_stdio(0);cout.tie(0)
#define sqr(x) ((x)*(x))

typedef long long ll;
const ll mod = 1e9+7;
const int sz = 500;


int main(){

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

    int cnt = 1;

    for(int i=1;i<n;i++){
        if(arr[i]<=mn){
            cnt++;
        }
        mn = min(mn,arr[i]);
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1024
N = int(input())
W_ = list(int(x) for x in input().split())

S = sum(W_)

s = 0
counter = 0
for num in W_:
    s += num
    counter += 1
    if s > S / 2:
        kouho1 = abs(sum(W_[0:counter - 1]) - sum(W_[counter - 1:N]))
        kouho2 = abs(sum(W_[0:counter]) - sum(W_[counter:N]))

        if kouho1 > kouho2:
            print(kouho2)
        else:
            print(kouho1)

        exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pi pair<int,int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
const int MAXN = 1e6 + 5;

void cp()
{
	int n,m;
	cin>>n>>m;
	int l = 1, r = n;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		l = max(l, a);
		r = min(r, b);
	}
	cout<<max(0, r-l+1);
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 3644
import std.stdio, std.typecons, std.algorithm;

alias Tuple!(int, "top", int, "bottom") Bundle;

const int INF = (1 << 24);

void main() {
  int times; scanf("%d", &times);
  int[][] dp = new int[][](times, times);
  Bundle[] cards;
  foreach(i; 0..times) {
    int top, bottom; scanf("%d %d", &top, &bottom);
    cards ~= Bundle(top, bottom);
    dp[i][] = INF;
    dp[i][i] = 0;
  }
  
  // dp[i][j] -> i 番目 から j 番目を計算する時の最適コスト
  for(int len = 1; len < times; len++) {
    for(int s = 0; s + len < times; s++) {
      int f = s + len;
      for(int i = s; i < f; i++) {
        int cost =
          (cards[s].top * cards[i].bottom) * (cards[i + 1].top * cards[f].bottom);
        cost += dp[s][i] + dp[i + 1][f];
        if (cost < dp[s][f]) dp[s][f] = cost;
      }
    }
  }
  writeln(dp[0][times - 1]);
}

Measured memory_bytes: 1048
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //Compute c1 = new Compute();//calc

        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();

        //input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        for (int i=0;i<n;++i) a[i]=sc.nextLong();
        long b[] = new long[n];
        for (int i=0;i<n;++i) b[i]=sc.nextLong();
        long c[] = new long[n-1];
        for (int i=0;i<n-1;++i) c[i]=sc.nextLong();

        long ans=0;
        int bb=0;
        for (int i=0;i<n;++i)
        {
            int aa=(int)a[i];
            //System.out.println("aa="+aa);
            ans+=b[aa-1];
            if (i==0)
            {
                //System.out.println("bb="+bb);
                bb=aa;
            }
            else
            {
                //System.out.println("bb="+bb);
                if (bb==aa-1)
                {
                    if (aa-2>=0)ans+=c[bb-1];
                }
                bb=aa;
            }
            //System.out.println(ans);
        }
        //System.out.println(String.format("%.0f",answer));
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
sx,sy,tx,ty = map(int,input().split())
y = abs(ty-sy)
x = abs(tx-sx)
ans = ""

for i in range(y):
    ans += "U"
for i in range(x):
    ans += "R"
for i in range(y):
    ans += "D"
for i in range(x+1):
    ans += "L"
for i in range(y+1):
    ans += "U"
for i in range(x+1):
    ans += "R"
ans += "DR"
for i in range(y+1):
    ans += "D"
for i in range(x+1):
    ans += "L"
ans += "U"

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int N,M;
vector<int> D(200009),T(200009);
map<int,int> mpd,mpt;
 
int main(){
  cin >> N;
  for(int i=0;i<N;i++)cin >> D[i];
  cin >> M;
  for(int i=0;i<M;i++)cin >> T[i];
  for(int i=0;i<N;i++)mpd[D[i]]++;
  for(int i=0;i<M;i++)mpt[T[i]]++;
  for(int i=0;i<M;i++){
    if(mpd[T[i]]<mpt[T[i]]){cout << "NO" << endl; return 0;}
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    s.erase(s.size()-1);
    while (s.size() > 0)
    {
        if(s.size() % 2 == 0) {
            string l = s.substr(0, s.size() / 2);
            string r = s.substr((s.size() + 1) / 2);
            if (l == r) {
                cout << s.size() << endl;
                return 0;
            }
        }
        s.erase(s.size()-1);
    }

    return 0;
}

Measured memory_bytes: 256
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const kitaiti = (arr) => {
  let r=0
  for(const a of arr){
    r+=a*(a+1)/2/a
  }
  return r
}
const main = () => {
  const o = new AtCoder()
  let [n,m]=o.nn(2),arr=o.nn(n),max=0,max_i,arr2=[0]
  for(let i=0;i<n;i++){
    arr2.push(arr[i]+arr2[i])
  }
  for(let i=0;i<n-m+1;i++){
    let sum=arr2[i+m]-arr2[i]
    if(max<sum){
      max = sum
      max_i = i
    }
  }
  o.o(kitaiti(arr.slice(max_i,max_i+m)))
}
main();

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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define endl '\n'

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

const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;

ll x;


bool chk(int x) {
	if(x == 0) return 0;
	while(x) {
		if(x % 10 != 1) return 0;
		x /= 10;
	}
	return 1;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> x;
	int cnt = 0;
	ll tmp = 0;
	if(x % 7 == 0) x /= 7;
	if(x == 1) {
		cout << 1;
		return 0;
	}
	while(1) {
		int y = ((11 - tmp % 10) % 10);

		if(chk(tmp)) {
			while(tmp) tmp /= 10, cnt++;
			cout << cnt;
			return 0;
		}

		bool pos = 0;
		for(int i=0; i<10; i++) if(i * x % 10 == y) {
			tmp += x * i;
			tmp /= 10;
			pos = 1;
			break;
		}
		if(pos) cnt++;
		else {
			cout << -1;
			return 0;
		}
	}
}


Measured memory_bytes: 3664
N,A,B=map(int,input().split())

if (B-A)%2==0:
    print((B-A)//2)
else:
    if A+B-1>=2*N-A-B+1:
        print((2*N-A-B+1)//2)
    else:
        print((A+B-1)//2)


Measured memory_bytes: 2940
N = int(input())

t = [0]
x = [0]
y = [0]

for i in range(N):
    a,b,c = map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)

isCan = True

for i in range(N):
    dt = t[i+1] - t[0]
    dx = x[i+1] - x[0]
    dy = y[i+1] - y[0]
    dgrid = abs(dx) + abs(dy)
    test = dt - dgrid
    if test < 0:
        isCan = False
        break
    elif test % 2 == 0:
        isCan = True
    else:
        isCan = False
        break

if isCan:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 11784
n,m = map(int,input().split())
h = list(map(int,input().split()))

# 隣接リスト
graph = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)  # 有向グラフなら消す

def dfs(x):
    if len(graph[x]) == 0:
        return True
    for i in range(len(graph[x])):
        if h[graph[x][i]] >= h[x]:
            return False
    return True

ans = 0
for i in range(n):
    if dfs(i):
        ans += 1
print(ans)

Measured memory_bytes: 94656
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V< pair<LL,LL> >v;
map<LL,LL>u;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    string a;
    cin>>n>>m;
    for(i=0,k=0; i<n; i++)
    {
        cin>>p>>q;
        v.PSB({p,q});
    }
    sort(v.B,v.E);
    for(i=0,k=0; i<n; i++)
    {
       k+=v[i].SE;
       if(k>=m)
       {
           cout<<v[i].FI<<endl;
           break;
       }

    }
    return 0;

}


Measured memory_bytes: 2420
l = []

str = input()
while True:
    txt = input()
    if txt == 'END_OF_TEXT':
        break
    x = txt.lower()
    X = x.split() #空白で区切ってリスト化
    l += X #リストlにリストXを結合していく
#print(l)
print(l.count(str))
#    p = ' '.join(l)
#print(p.count(str))



Measured memory_bytes: 5552
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int x;
    cin >> x;
    long long int dq = x / 11;
    x %= 11;
    if(x == 0)
    {
        cout << dq * 2;
    }
    else if(x <= 6)
    {
        cout << dq * 2 + 1;
    }
    else
    {
        cout << dq * 2 + 2;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[345678], aa[345678][2];
signed main() {
	int n, m, cnt = 0, ans = 0; string s, t; 
	cin >> n;
	printf("%f\n", n * 2 * 3.141592);
	return 0;
}

Measured memory_bytes: 3784
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n, m = rli()
    print(n*(n-1)//2+m*(m-1)//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
N, K = map(int, input().split())
As = list(map(int, input().split()))
ans2=0
for n in range(K+1, N+1):
    ans1 = As[n-K-1]
    ans2 = As[n-1]
    if ans1 < ans2:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 31748
from typing import Set, List


def linear_search_v1(S: List[int], key: int) -> int:
    for num in S:
        if num == key:
            return 1
    return 0


def linear_search_v2(S: List[int], key: int) -> int:
    i: int = 0
    S.append(key)

    while S[i] != key:
        i += 1

    if i != len(S) - 1:
        return 1
    else:
        return 0


def main_v1():
    _ = input()
    S: List[int] = list(map(int, input().split()))
    _ = input()
    T: List[int] = list(map(int, input().split()))
    count: int = 0

    for num in T:
        # count += linear_search_v1(S, num)
        count += linear_search_v2(S[:], num)

    print(count)


def main_v2():
    _ = input()
    S: Set[int] = set(map(int, input().split()))
    _ = input()
    T: List[int] = list(map(int, input().split()))
    count: int = 0

    for num in T:
        if num in S:
            count += 1

    print(count)


if __name__ == "__main__":
    main_v2()



Measured memory_bytes: 7764
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))


def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)


ans = 1
for i in range(N):
    ans *= T[i] // gcd(ans, T[i])
print(ans)


Measured memory_bytes: 3060
# https://atcoder.jp/contests/abc129/tasks/abc129_b


N = gets.to_i
Ws = gets.split.map(&:to_i)
ttl = Ws.reduce(&:+)
ans = 100000
sum1 = 0
(N - 1).times do |i|
  sum1 += Ws[i]
  sum2 = ttl - sum1
  ans = [ans, (sum1 - sum2).abs].min
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    vector< double > x, y;

    for ( long long int i = 0; i < n; i++ ) {

      double in_x, in_y;
      cin >> in_x >> in_y;
      x.push_back( in_x );
      y.push_back( in_y );

    }

    long long int ans = 1;

    for ( long long int i = 0; i < n; i++ ) {

      vector< pair< double, long long int > > v;

      for ( long long int j = 0; j < n; j++ ) {

	if ( i == j ) continue;

	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	double ang = atan2( dy, dx );
	double d = sqrt( dx * dx + dy * dy );
	if ( d > 2.0 ) continue;
	double a = acos( d / 2 );

	v.push_back( make_pair( ang - a, 0 ) );
	v.push_back( make_pair( ang + a, 1 ) );
	v.push_back( make_pair( ang - a - M_PI * 2, 0 ) );
	v.push_back( make_pair( ang + a - M_PI * 2, 1 ) );
	v.push_back( make_pair( ang - a + M_PI * 2, 0 ) );
	v.push_back( make_pair( ang + a + M_PI * 2, 1 ) );

      }

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

      long long int cnt = 1;

      for ( long long int j = 0; j < v.size(); j++ ) {

	if ( v[j].second == 0 ) {
	  cnt++;
	  ans = max( ans, cnt );
	}else {
	  cnt--;
	}
      }

    }

    cout << ans << endl;

  }

  return 0;

}

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

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int[] w = new int[n + 1];
		int[] r = new int[n + 1];
		Arrays.fill(w , -1);
		Arrays.fill(r , -1);
		int wcount = 0;
		int rcount = 0;
		for(int i = 0 ; i < n ; i++) {
			if(s.charAt(i) == 'W') {
				w[wcount] = i;
              wcount++;
			}
			if(s.charAt(n - i - 1) == 'R') {
				r[rcount] = n - i - 1;
              rcount++;
			}
		}
		int ans = 0;
		for(int i = 0 ; i < wcount && i < rcount ; i++) {
			if(w[i] < r[i])
				ans++;
			else
				break;

		}



		sc.close();
		System.out.println(ans);

	}
}



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

int main(){
    int N; cin>>N;
    vector<int> h(N+1,0);
    rep(i,N){
        int x;
        cin >> x;
        h[i+1] = x;
    }

    vector<int> dp(N+2,1e9);

    dp[1]=0;

    for(int i=1; i<N; i++){
        dp[i+1] = min(dp[i] + abs(h[i+1] - h[i]), dp[i+1]);
        dp[i+2] = abs(h[i+2]-h[i]) + dp[i];
    }

    cout << dp[N] << endl;
}


Measured memory_bytes: 4036
N, X = [int(i) for i in input().split()]
x_ls = [int(i) for i in input().split()]
x_ls = [abs(x - X) for x in x_ls]
while True:
    min_x = min(x_ls)
    x_ls = [x % min_x for x in x_ls]
    if not any(x_ls):
        break
    x_ls = [x for x in x_ls if x != 0]
print(min_x)

Measured memory_bytes: 14252
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int N,M,s,k,c;
	for(;~scanf("%d%d",&N,&M)&&N&&M;){
		vector<pair<int,int> >ma(N),mi(N);
		for(int i=0;i<N;i++)ma[i].second=mi[i].second=i;
		for(int i=0;i<M;i++){
			scanf("%d%d",&s,&k);
			for(int j=0;j<k;j++){
				scanf("%d",&c),c--;
				if(k==1)mi[c].first+=s;
				ma[c].first+=s;
			}
		}
		sort(ma.begin(),ma.end());
		sort(mi.begin(),mi.end());
		int r=0;
		for(int i=N-2;i<N;i++)for(int j=0;j<2;j++){
			if(ma[i].second!=mi[j].second)r=max(r,ma[i].first-mi[j].first);
		}
		printf("%d\n",r+1);
	}
}

Measured memory_bytes: 2796
#include <iostream>

using namespace std;

void chmax(int *a, int b){
  if( *a < b ) *a = b;
}

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

  int max = -9999999;
  chmax(&max, a+b);
  chmax(&max, a*b);
  chmax(&max, a-b);
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
s = 0
for i in range(1, n + 2):
    s += abs(a[i] - a[i - 1])
for i in range(1, n + 1):
    print(s - (abs(a[i] - a[i - 1]) + abs(a[i] - a[i + 1])) + abs(a[i - 1] - a[i + 1]))

Measured memory_bytes: 14176
#include<bits/stdc++.h>
using namespace std;
int minCost(int, int height[]);
#define inf 1e9
int main(){
    int n;
    cin>>n;
    int height[n];
    for(int i=0; i<n; i++){
        cin>>height[i];
    }
    cout<<minCost(n,height);
    return 0;
}
int minCost(int n , int height[]){
    int dp[n+1];
    dp[0] = 0;
    dp[1] = 0;
    for(int i = 2 ; i <= n; i++){
        dp[i] = min(abs(height[i-1] - height[i-2]) + dp[i-1] ,(i==2)?INT_MAX: abs(height[i-1] - height[i-3]) + dp[i-2]);
    }
    return dp[n];
}

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

int N;
vector<int> A, B;

int main(){
    cin >> N;
    A.resize(N);
    B.resize(N-1);
    for(int i = 0; i < N-1; ++i) cin >> B[i];
    for(int i = 0; i < N; ++i){
        if(i == 0) A[i] = B[i];
        else if(i == N-1) A[i] = B[i-1];
        else{
            A[i] = min(B[i-1], B[i]);
        }
    }
    int ans = 0;
    for(int i = 0; i < A.size(); ++i){
        ans += A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3544
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # 視点を変えて、num[i] := i人目が何問正解するか
    n,k,q = readInts()
    num = [0] * n
    for i in range(q):
        a = int(input()) - 1 # 0-based index
        num[a] += 1
    for i in range(n):
        points = k - (q - num[i]) # Q問中 num[i]問 正解なら、ポイント減少分はQ - num[i]
        if points <= 0:
            print('No')
        else:
            print('Yes')
if __name__ == '__main__':
  main()


Measured memory_bytes: 4680
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	auto n = read.to!int;
	auto as = readln.chomp.split.map!(to!long).array;
	
	as.sort!("a > b")();
	
	long ans;
	for(int i = 0; i < n; i ++){
		ans += as[2 * i + 1];
		}
	
	ans.writeln;
	}



string read(){
	static string[] ss;
	while(!ss.length) ss = readln.chomp.split;
	string res = ss[0];
	ss.popFront;
	return res;
	} 


Measured memory_bytes: 15000
n,m=list(map(int,input().split()))
a=1
b=n
for i in range(m):
    l,r=list(map(int,input().split()))
    if a<l:
        a=l
    if b>r:
        b=r
if b-a+1>0:
    print(b-a+1)
else:
    print(0)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
    int n = 0;
    char s[5];
    scanf("%s", s);
    for(int i = 0; i < 4; i++){
        if(s[i] == '+'){n += 1;}
        else if(s[i] == '-'){n -= 1;}
    }
    printf("%d\n", n);
    return 0; 
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
bool num[1000000]={true,true};
int main(){
  for(int i=2; i<1000; i++)
    if(!num[i])
      for(int j=i*i; j<1000000; j+=i)
	num[j] = true;
  int n;
  while(cin >>n){
    int ans = 0;
    for(int i=2; i<=n; i++)
      if(!num[i]) ans++;
    cout <<ans<<endl;
  }
  return 0;
}

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

using namespace std;
vector<int> v;

int main() {
    int n;
    cin >> n;
    for (int i = 0; i != n; i++) {
        int j;
        cin >> j;
        v.push_back(-j);
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i != n / 2; i++)ans += v[i];
    for (int i = 0; i != (n - 1) / 2; i++)ans += v[i + 1];
    cout << -ans;
    return 0;
}

Measured memory_bytes: 4260
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int A;
    double B;
    cin >> A >> B;
    int b = round(B * 100);

    int a = A % 100;
    int remain = floor(B * a);
    cout << b * (A/100) + remain << endl;

    return 0;
}

Measured memory_bytes: 3796