akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    cout<<fixed<<setprecision(20);
    cout<<2*in()*M_PI<<endl;
}


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

int main()
{
	int n;
	int *b1, *a;
	scanf("%d", &n);
	
	a = new int[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

	b1 = new int[n];
	int Head = 0, End = n-1,flag=1;
	for (int i = 0; i < n; i++)
	{
		if (flag)
		{
			b1[Head] = a[i];
			Head++;
			flag = 0;
		}
		else
		{
			b1[End] = a[i];
			End--;
			flag = 1;
		}
	}
	if (flag)
	{
		for (int i = 0; i < n; i++)
			printf("%d ", b1[(Head+ i) % n]);
	}
	else
	{
		for (int i = 0; i < n; i++)
			printf("%d ", b1[(End - i + n) % n]);
	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>

using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
static const int INF = 1000010000;
static const ll MOD = 998244353;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

template< typename Monoid >
struct SegmentTree
{
  using F = function< Monoid(Monoid, Monoid) >;
 
  int sz;
  vector< Monoid > seg;
 
  const F f;
  const Monoid M1;
 
  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1)
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }
 
  void set(int k, const Monoid &x)
  {
    seg[k + sz] = x;
  }
 
  void build()
  {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  void update(int k, const Monoid &x)
  {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  Monoid query(int a, int b)
  {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }
 
  Monoid operator[](const int &k) const
  {
    return seg[k + sz];
  }
};

int main(){
    string s;
    int w;
    cin >> s >> w;
    REP(i, s.length()){
        if(i % w == 0) cout << s[i];
    }
    cout << endl;
}

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

int main()
{
    int x, t;  cin >> x >> t;
    
    if (t >= x)  cout << 0 << endl;
    else  cout << x - t << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}

}


Measured memory_bytes: 3624
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
max_a = 0 
for a, b in ab:
  max_a = max(max_a, a)
# i番目まで見たときに、モンスターの体力をj減らした時の、トキの消耗した魔力の最小値
dp = [[float('inf')]*(h+max_a+1) for _ in range(n+1)]
for i in range(n+1):
  dp[i][0] = 0
for i in range(n):
  a, b = ab[i]
  for j in range(h+max_a+1):
    if j-a >= 0:
      dp[i+1][j] = min(dp[i][j], dp[i+1][j-a]+b)
    else:
      dp[i+1][j] = dp[i][j]


ans = float('inf')
for i in range(h, h+max_a+1):
  ans = min(ans, dp[n][i])
print(ans)



Measured memory_bytes: 412692
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

struct UnionFind {
  vector<int> par; // 親を指すvector,-par[親]は木のサイズ
  UnionFind(int n):par(n, -1) {} // uniteで親を埋め込んでいく必要あり
  int root(int x) { // 親をたどる&データの整理
    if(par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  bool unite(int x, int y) { // データの結合
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  bool same(int x, int y) {return root(x) == root(y);} // 所属判定
  int size(int x) {return -par[root(x)];} // 木のサイズ
};

const int N = 1e5+10;

//head

int n, m;
int a[N];
vi G[N];
ll ans;
UnionFind uft(N);
PQG<int> pq;

void dfs(int i, int j, vi &u) {
  u.emplace_back(a[i]);
  for(int ne:G[i]) if(ne != j) {
    dfs(ne, i, u);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  rep(i, n) cin >> a[i];
  rep(i, m) {
    int u, v;
    cin >> u >> v;
    uft.unite(u, v);
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  if(n-m-2 > m) {
    cout << "Impossible" << endl;
    return 0;
  }
  if(m == n-1) {
    cout << 0 << endl;
    return 0;
  }

  vi lst;
  rep(i, n) if(uft.root(i) == i) {
    lst.clear();
    dfs(i, -1, lst);
    sort(all(lst));
    ans += lst[0];
    for(int j = 1; j < lst.size(); j++) {
      pq.emplace(lst[j]);
    }
  }

  rep(i, n-m-2) {
    ans += pq.top();
    pq.pop();
  }

  cout << ans << endl;
}

Measured memory_bytes: 10580
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	ull a, b, x;
	cin >> a >> b >> x;
	cout << (b / x) - (a / x) + (a % x == 0) << endl;

	return 0;
}


Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll get(ll x,ll a,ll b){return x-(x/a+x/b)+x/lcm(a,b);}
int main()
{
	ll a,b,c,d;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	printf("%lld\n",get(b,c,d)-get(a-1,c,d));
	return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


class Combination(object):

    def __init__(self, N, mod=10**9+7):
        fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1)
        fac[:2] = 1, 1
        finv[:2] = 1, 1
        inv[1] = 1
        for i in range(2, N+1):
            fac[i] = fac[i-1]*i % mod
            inv[i] = -inv[mod % i]*(mod//i) % mod
            finv[i] = finv[i-1]*inv[i] % mod
        self.N = N
        self.MOD = mod
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def __call__(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (self.finv[k]*self.finv[n-k] % self.MOD) % self.MOD


def solve(r: "List[int]", c: "List[int]"):

    cmb = Combination(r[1]+c[1]+2, mod=MOD)

    def g(x, y):
        return cmb(x+y+2, y+1)-1

    ans = g(r[1], c[1])-g(r[0]-1, c[1])-g(r[1], c[0]-1)+g(r[0]-1, c[0]-1)
    print(ans % MOD)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = [int()] * (2)  # type: "List[int]"
    c = [int()] * (2)  # type: "List[int]"
    for i in range(2):
        r[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(r, c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 85488
#include <bits/stdc++.h>
using namespace std;
  
// #define int long long
#define pb push_back
#define print(Target) cout << Target << '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

struct COL{
  double n;
  string name;
};

const int c[8][3] = {{0, 0, 0}, {0, 0, 0xff}, {0, 0xff, 0}, {0, 0xff, 0xff}, {0xff, 0, 0}, {0xff, 0, 0xff}, {0xff, 0xff, 0}, {0xff, 0xff, 0xff}};

const string s[] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};

bool cmp(COL lhs, COL rhs)
{
  return (lhs.n < rhs.n);
}

signed main()
{
  //ios::sync_with_stdio(false);
  char sr[2], sg[2], sb[2];
  char sh;
    
  while (scanf("%1s", &sh), sh != '0'){
    COL col[8];
    scanf("%2s%2s%2s", sr, sg, sb);
    int r = strtol(sr, NULL, 16),
        g = strtol(sg, NULL, 16),
        b = strtol(sb, NULL, 16);

    REP(i, 8){
      col[i].n = sqrt((c[i][0] - r) * (c[i][0] - r) + (c[i][1] - g) * (c[i][1] - g) + (c[i][2] - b) * (c[i][2] - b));
      col[i].name = s[i];
    }

    sort(col, col + 8, cmp);
    print(col[0].name);
  }

  return (0);
}

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

long double func(long long n,long long x){
  if(n == 1){return x;}
  else{return func(n-1,x*n);}
}
            
int main(){
  long long n;
  cin >> n;
  vector<pair<long long,long long>> a(n);
  for(int i=0;i < n;i++){
    int x, y;
    cin >> x >> y;
    a.at(i) = make_pair(x, y);
  }
  long double x = func(n,1);
  long double sum = 0;
  for(int i=0;i < x;i++){
  	next_permutation(a.begin(),a.end());
    for(int j=1;j < n;j++){
      //cout << a.at(j-1).first << "," << a.at(j-1).second ;
      sum += sqrt((a.at(j-1).first - a.at(j).first)*(a.at(j-1).first - a.at(j).first) + (a.at(j-1).second - a.at(j).second)*(a.at(j-1).second - a.at(j).second));
    }
    //cout << a.at(n-1).first << "," << a.at(n-1).second;
    //cout << sum << endl;
  }
  long double ans = sum / x ;
  cout << setprecision(12) << ans << endl;
}

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

int main() {
  int n, d, x;
  cin >> n >> d >> x;
  
  rep(i,n) {
    int a;
    cin >> a;
    x += (d+a-1)/a;
  }
  
  cout << x << endl;
}

Measured memory_bytes: 256
// Use the recursion hint

#include <bits/stdc++.h>
using namespace std;

int N;
vector<long long> values;


long long MINUS_INF = -1e15;

long long dp[3001][3001][2];

void init() {
    for (int i = 0; i <= 3000; i++)
        for (int j = 0; j <= 3000; j++)
            dp[i][j][0] = dp[i][j][1] = MINUS_INF;
}

long long makeMove(int start, int end, int move) {
    if (dp[start][end][move] != MINUS_INF) {
        return dp[start][end][move];
    }

    if (start > end) {
        return 0;
    } else {
        if (move == 1) {
            dp[start][end][move] = 
                max(values[start] + makeMove(start + 1, end, 0),
                    values[end] + makeMove(start, end - 1, 0));
        } else {
            dp[start][end][move] =
                min(-values[start] + makeMove(start + 1, end, 1),
                    -values[end] + makeMove(start, end - 1, 1));        
        }
    }

    return dp[start][end][move];
}

int main() {
    // freopen("input.txt", "r", stdin);

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

    init();

    long long ans = makeMove(0, N - 1, 1);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define pob pop_back
#define ff first
#define ss second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define debug(x) cout << x << endl;
#define int long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
/* 	1) order_of_key (k) : Number of items strictly smaller than k .
	2) find_by_order(k) : K-th element in a set (counting from zero).
*/
using namespace __gnu_pbds;
using namespace std;
using LD = long double;

const int N = 1e4+2;
const int mod = 1e9+7;
const int INF = 1e18;
int row[8] = {1,1,0,-1,-1,-1,0,1};
int col[8] = {0,-1,-1,-1,0,1,1,1};

void solve() {
	int x;
	cin >> x;
	if(x >= 30)
		cout << "Yes";
	else
		cout << "No";
}
 
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t = 1,i = 1;
    //cin >> t;
    while(t--) {
        //cout << "Case #" << i << ": ";
        solve();
        //i++;
    }
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

struct union_find {
    vector<int> par, siz;
    union_find(int n) {
        par.resize(n);
        siz.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            siz[i] = 1;
        }
    }
    
    int find(int x) {
        if (par[x] == x) return x;
        return par[x] = find(par[x]);
    }
 
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)return;
        if (siz[x] < siz[y]) {
            par[x] = y;
            siz[y] += siz[x];
        }
        else {
            par[y] = x;
            siz[x] += siz[y];
        }
    }
    
    long long size(int x){
        return siz[find(x)];
    }

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

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, m; cin >> n >> m;
    ll a[m], b[m]; zep(i, 0, m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    union_find u(n);
    zep(i, 0, m){
        u.unite(a[i], b[i]);
    }

    ll ans = 0;
    zep(i, 0, n){
        ans = max(ans, u.size(i));
    }
    print(ans)

    return 0;
}

Measured memory_bytes: 7948
#include<iostream>
using namespace std;
int main(){
    int a, b, c, x, y = 0; ;
    cin >> a >> b >> c;
    for ( x = a; x <= b; x++ ){
        if ( c % x == 0 ){
            y = y + 1;
        }
    }
    cout << y << endl;
    return 0;
}




Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y;
	cin >> n >> x >> y;
	int a[2010] = {0};
	for(int i = 1; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			int dis = min(abs(i - x) + abs(j - y)+1,j - i);
			//printf("i:%d j:%d dis:%d\n",i,j,dis);
			a[dis]++;
		}
	}
	for(int i = 1; i < n; i++){
		cout << a[i] << endl;
	}
    return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

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

        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int P = scanner.nextInt();

        int fragment = A * 3 + P;
        int ans = fragment / 2;
        System.out.println(ans);

    }
}

Measured memory_bytes: 24020
import numpy as np
from numpy.linalg import matrix_rank
A = np.array([[1,0,0,1,0,0],
            [1,0,0,0,1,0],
            [1,0,0,0,0,1],
            [0,1,0,1,0,0],
            [0,1,0,0,1,0],
            [0,1,0,0,0,1],
            [0,0,1,1,0,0],
            [0,0,1,0,1,0],
            [0,0,1,0,0,1]])

c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

Ac = np.array([[1,0,0,1,0,0, c11],
            [1,0,0,0,1,0, c12],
            [1,0,0,0,0,1, c13],
            [0,1,0,1,0,0, c21],
            [0,1,0,0,1,0, c22],
            [0,1,0,0,0,1, c23],
            [0,0,1,1,0,0, c31],
            [0,0,1,0,1,0, c32],
            [0,0,1,0,0,1, c33]])

if matrix_rank(A) == matrix_rank(Ac):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14444
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
const int N = 1e5 + 5, mo = 998244353 ;
using namespace std ;

char A[N], B[N] ;
int fac[N], inv[N], G[N], W[N], n, rev[N], a[2][N] ;
inline void upd(int &x, int y) {
	x = (x + y) % mo ; 
}
inline int mul(int a, int b) {
	int ans = 1, w = a % mo ;
	for ( ; b; b /= 2) {
		if (b & 1) ans = (ll) ans * w % mo ;
		w = (ll) w * w % mo ;
	}
	return ans ;
}

void dft(int x, int fl) {
	int u, v, w, wn, inv3 = mul(3, mo - 2) ;
	rep(i, 0, n - 1) if (i < rev[i]) swap(a[x][i], a[x][rev[i]]) ;
	for (int i = 2 ; i <= n ; i <<= 1) {
		if (fl) wn = mul(inv3, (mo - 1) / i) ; else wn = mul(3, (mo - 1) / i) ;
		for (int j = 0 ; j < n ; j += i)
		  for (int w = 1, q = j ; q < j + i / 2 ; q ++ , w = (ll) w * wn % mo) {
			  u = a[x][q], v = (ll) a[x][q + i / 2] * w % mo ;
			  a[x][q] = (u + v) % mo, a[x][q + i / 2] = (u - v) % mo ;
		  }
	}
}

void ntt(const int A[N], const int B[N], int (&ret)[N], int na) {
	++ na ;
	for (n = 1 ; n <= na + na ; n <<= 1) ;
	rep(i, 0, n - 1) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) ? (n >> 1) : 0) ;
	rep(i, 0, n - 1) a[0][i] = a[1][i] = 0 ;
	rep(i, 0, na - 1) a[0][i] = A[i], a[1][i] = B[i] ;
	dft(0, 0), dft(1, 0) ;
	rep(i, 0, n - 1) a[0][i] = (ll) a[0][i] * a[1][i] % mo ;
	dft(0, 1) ; int inv = mul(n, mo - 2) ;
	rep(i, 0, n - 1) ret[i] = 0 ;
	rep(i, 0, na - 1) ret[i] = (ll) a[0][i] * inv % mo ;
}

void solve(int m, int e) {
	fac[0] = 1 ;
	int mx = max(m + 1, m + e) ;
	rep(i, 1, mx) fac[i] = (ll) fac[i - 1] * i % mo ;
	inv[mx] = mul(fac[mx], mo - 2) ;
	for (int i = mx - 1; i >= 0; -- i) inv[i] = (ll) inv[i + 1] * (i + 1) % mo ;
	G[0] = 1 ;
	rep(i, 0, m) W[i] = inv[i + 1] ;
	int ans = 0 ;
	mx = m + e ;
	for ( ; e; e /= 2) {
		if (e & 1) ntt(G, W, G, m) ;
		ntt(W, W, W, m) ;
	}
	rep(i, 0, m) upd(ans, G[i]) ;
	ans = (ll) ans * fac[mx - m] % mo * fac[m] % mo * fac[mx] % mo ;
	printf("%d\n", (ans + mo) % mo) ;
}

int main() {
	scanf("%s%s", A + 1, B + 1) ;
	int n = strlen(A + 1), m = 0, e = 0 ;
	rep(i, 1, n) m += (A[i] == '1' && B[i] == '1'), e += (A[i] == '1' && B[i] == '0') ;
	solve(m, e) ;
	return 0 ;
}

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

#define FOR(i,n,m) for(int i=n; i<m; i++)

int main() {
    int n;
    cin >> n;
    
    int a;
    int notPrime=0;
    FOR(i,0,n) {
        cin >> a;
        FOR(j,2,sqrt(a+1)) {
            if(a%j == 0)  {
                notPrime++;
                break;
            }
        }
    }
    
    cout << n - notPrime << endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 3116
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.stream.Collectors;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            List<Integer> primes = new ArrayList<>();
            boolean[] isPrime = new boolean[55556];
            Arrays.fill(isPrime, true);
            isPrime[0] = isPrime[1] = false;
            for (int i = 2; i <= 55555; i++) {
                if (isPrime[i]) {
                    if (i % 5 == 2)
                        primes.add(i);
                    for (int j = i; j <= 55555; j += i) {
                        isPrime[j] = false;
                    }
                    if (primes.size() == n) break;
                }
            }

            out.println(primes.stream().map(Object::toString).collect(Collectors.joining(" ")));
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 26580
#include <iostream>
#include <string>
using namespace std;
int main(void){
  
  string s,t;
  cin >> s >> t;
  
  if(s > t)
    cout << ">" << endl;
  else if(s < t)
    cout << "<" << endl;
  else
    cout << "=" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "E"
int n;
ll a[100001];
int pos[100002];
bool cmp(int x, int y){
    if(a[x]!=a[y]) return a[x]>a[y];
    else return x<y;
}
ll ans[100001];
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    read(n);
    FOR(i, 1, n){
        read(a[i]);
        pos[i]=i;
    }
    sort(pos+1, pos+n+1, cmp);
    int i=1, j;
    ll sum=0;
    while(i<=n){
        j=i+1;
        sum+=a[pos[i]];
        while(j<=n&&(pos[j]>pos[i])){
            sum+=a[pos[j]];
            j++;
        }
        ll down=sum-a[pos[j]]*(j-1);
        sum-=down;
        ans[pos[i]]+=down;
        i=j;
    }
    FOR(i, 1, n) writeln(ans[i]);
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>


typedef long long ll;

using namespace std;


int main() {
    ll n,i,j,m,tempi,temp,ans=0;
    cin>>n>>m;
    vector<int> k(m,0);
    vector<vector<int>> s(m,vector<int>());
    vector<int> p(m);


    for(i=0;i<m;i++){
        cin>>k[i];
        s[i]=vector<int>(k[i],0);
        for(j=0;j<k[i];j++){
            cin>>s[i][j];
        }
    }
    for(i=0;i<m;i++){
        cin>>p[i];
    }

    for(i=0;i<pow(2,n);i++){
        ans++;
        vector<bool> state(n);
        tempi=i;
        for(j=0;j<n;j++){
            if(tempi%2==0){
                state[j]=true;
            }else{
                state[j]=false;
            }
            tempi=tempi/2;
        }


        for(j=0;j<m;j++){
            temp=0;
            for(ll bl:s[j]){
                if(state[bl-1])temp++;
            }
            if(temp%2!=p[j]){
                ans--;
                break;
            }
        }

    }


    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
  int m, n;
  int price = 0, sum = 0, cnt = 0;

  while (scanf("%d,%d", &m, &n) != EOF) {
        price += m*n;
        sum += n;
        cnt++;
  }
  int ave = (float)sum/cnt + 0.5;
  printf("%d\n%d\n", price, ave);

  return 0;
}

Measured memory_bytes: 2588
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,m = readline() |> split |> parseMap
	e = [Int[] for i in 1:n]
	vst = zeros(Int,n)
	ans = Tuple{Int,Int}[]
	stack = Int[]
	for i in 1:m
		a,b = readline() |> split |> parseMap
		if i == 1
			vst[a] = 1
			vst[b] = 1
			push!(ans,(a,b))
			push!(stack,a)
			push!(stack,b)
			end
		push!(e[a],b)
		push!(e[b],a)
	end
	while !isempty(stack)
		now = pop!(stack)
		for i in e[now]
			if vst[i] == 0
				vst[i] = 1
				push!(ans,(now,i))
				push!(stack,i)
				break
			end
		end
	end
	println(sum(vst))
	path = [Int[] for i in 1:n]
	for i in ans
		l = i[1]
		r = i[2]
		push!(path[l],r)
		push!(path[r],l)
	end
	now = 0
	for i in 1:n
		if length(path[i]) == 1
			now=i
			break
		end
	end
	pst = zeros(Int,n)
	pst[now] = 1
	print(now)
	while now != -1
		f = 0
		for i in path[now]
			if pst[i] == 0
				f = 1
				now = i
				pst[now] = 1
				print(" ",i)
			end
		end
		if f == 0
			now = -1
		end
	end
end

main()

Measured memory_bytes: 165236
#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>;

int main() {
  int n; cin >> n;
  string s;
  s = to_string(n);
  rep(i,3) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    } 
  }
  cout << "No" << endl;
  return 0;
} 



Measured memory_bytes: 3676
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
main()
{
	fast();
	int t=1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		cout<<n+n*n+n*n*n<<endl;
		
	}
	
}




Measured memory_bytes: 3580
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
	return a*b//gcd(a,b)
N=int(input())
T1=int(input())
for i in range(N-1):
    T2=int(input())
    T1=lcm(T1,T2)
print(T1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
  {
    cout << "vowel" << endl;
  }
  else
  {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    stack<int> st[3];
    for(int i =0; i<3; i++){
        cin>>s;
        for(int j=s.size()-1; j>=0; j--){
            st[i].push(s[j]);
        }
    }
    int pick = 0;
    while(true){
        if(st[pick].empty()) break;
        char top = st[pick].top(); st[pick].pop();
        
        if(top=='a') pick = 0;
        if(top=='b') pick = 1;
        if(top=='c') pick = 2;
    }

    if(pick==0) cout<<"A";
    if(pick==1) cout<<"B";
    if(pick==2) cout<<"C";
    return 0; 
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(M)]

ans = min(a) + min(b)
for i in range(M):
    x, y, c = xyc[i]
    x -= 1
    y -= 1
    cost = a[x] + b[y] - c
    ans = min(ans, cost)
print(ans)

Measured memory_bytes: 82200
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

a = []

def g(x):
    for i in range(-1,2):
        last = (x%10) + i
        if x <= 3234566667 and last != -1 and last != 10:
            f(10*x+last)
def f(x):
    a.append(x)
    g(x)

for i in range(1,10):
    f(i)
a.sort()

def main():
    n = inp()
    print(a[n-1])
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 114140
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
#include<cctype>
#include<algorithm>
const int INF=1e9;
using namespace std;

int main(){
    string s;
    cin>>s;
    if(s[0]=='9'||s[1]=='9')cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n,m;cin >> n >> m;
  priority_queue<ll> pq;
  for(int i=0; i<n; i++){
    int a;cin >> a;
    pq.push(a);
  }
  while(m>0){
    int maxx=pq.top();pq.pop();
    maxx/=2;
    m--;
    pq.push(maxx);
  }
  ll ans=0;
  while(!pq.empty()){
    ans+=pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

class Main {

    public static void main(String[] args){
	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t\n,]");
	double x = 0;
	double y = 0;
	int theta = 90;
	while(true){
	    int d = stdin.nextInt();
	    int dtheta = stdin.nextInt();
	    if(d == 0 && dtheta == 0)  break;
	    x += d * Math.cos(theta * Math.PI / 180);
	    y += d * Math.sin(theta * Math.PI / 180);
	    theta -= dtheta;
	}
	System.out.println((int)(x));
       	System.out.println((int)(y));
	
    }
}

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

int main(){
	int a, b, result;
	char op;
	while(cin >> a >> op >> b){
		if(op == '?') break;
		if(op == '+') result = a + b;
		else if(op == '-') result = a - b;
		else if(op == '*') result = a * b;
		else result = a / b;
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define MOD 100000
char f[21][21];
int n,m;
int dp[2][1<<20][2];
int crt=0,next=1,num=0;
ll mpow(ll a,ll x)//a^x
{
	ll res=1ll;
	while(x>0)
	{
		if(x&1)res=res*a%MOD;
		a=a*a%MOD;
		x>>=1;
	}
	return res;
}
int main()
{
	cin >> n >> m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin >> f[i][j];
			if(f[i][j]=='?')num++;
		}
	}
	string str="JOI";
	dp[crt][0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			memset(dp[next],0,sizeof(dp[next]));
			for(int k=0;k<1<<m;k++)
			{
				for(int l=0;l<2;l++)
				{
					if(dp[crt][k][l]>0)
					{
						for(int s=0;s<3;s++)
						{
							if(f[i][j]!='?'&&f[i][j]!=str[s])continue;
							if((k&1<<j)&&s==2)continue;
							int mask=~(1<<j),l2=(s==0);
							int k2=k&mask;
							if(l==1&&s==1)k2|=1<<j-1;
							dp[next][k2][l2]+=dp[crt][k][l];
							dp[next][k2][l2]%=MOD;
						}
					}
				}
			}
			swap(crt,next);
		}
		for(int k=0;k<1<<m;k++)
		{
			dp[crt][k][0]+=dp[crt][k][1];
			dp[crt][k][0]%=MOD;
			dp[crt][k][1]=0;
		}
	}
	int ans=mpow(3,num);
	for(int i=0;i<1<<m;i++)
	{
		ans=(ans+MOD-dp[crt][i][0])%MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 17600
main :: IO ()
main = do
  n <- getLine
  s <- getLine
  k <- readLn
  putStrLn $ ans k s
  
ans :: Int -> String -> String
ans k s = let i = s !! (k-1) in okikae i (reverse s) where
  okikae c = foldl (\acc l -> if l == c then c:acc else '*':acc) []

Measured memory_bytes: 508
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    N = intinput()
    K = intinput()
    X = intinput()
    Y = intinput()

    if N <= K:
        print(X*N)
    else:
        print(X*K + Y*(N-K))



# EOF

Measured memory_bytes: 5544
#include <cstdio>
#include <vector>
#include <queue>


using namespace std;

const int N = 2010;
const int INF = 0x3f3f3f3f;


vector<int> adj[N];
int dist[N];

queue<int>q;


int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	for(int i = 0; i < n-1; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int ansmn = INF;
	if(k%2==0){

		for(int v = 1; v <= n; v++){
			int ans = 0;
			for(int j = 1; j <= n; j++)dist[j]=INF;
			dist[v]=0;
			q.push(v);
			while(!q.empty()){
				int f = q.front();
				q.pop();
				for(int af = 0; af < adj[f].size(); af++){
					int nxt = adj[f][af];
					if(dist[nxt]==INF){
						dist[nxt]=dist[f]+1;
						if(dist[nxt]>k/2)ans++;
						q.push(nxt);
					}
				}
			}
			ansmn = min(ansmn, ans);
		}

	}
	else{

		for(int v = 1; v <= n; v++){
			for(int fk = 0; fk < adj[v].size(); fk++){
				int nxt = adj[v][fk];
				if(v < nxt){
					int ans = 0;
					for(int j = 1; j <= n; j++)dist[j]=INF;
					dist[v]=0;
					dist[nxt]=0;
					q.push(v);
					q.push(nxt);
					while(!q.empty()){
						int f = q.front();
						q.pop();
						for(int af = 0; af < adj[f].size(); af++){
							int nxt = adj[f][af];
							if(dist[nxt]==INF){
								dist[nxt]=dist[f]+1;
								if(dist[nxt]>k/2)ans++;
								q.push(nxt);
							}
						}
					}
					ansmn = min(ansmn, ans);
				}

			}
		}


	}
	printf("%d\n",ansmn);

}

Measured memory_bytes: 384
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  _  <- getLine 
  as <- readInts
  print $ counter as

counter
  :: [Int] -> Int
counter ns = helper ns 0
  where
    helper :: [Int] -> Int -> Int
    helper ms k
      | all even ms = helper ms' (k+1)
      | otherwise         = k
      where
        ms' = map (`div` 2) ms

Measured memory_bytes: 1020
import copy
import string

s = list(input())
ans = 0
if len(set(s)) == 1:
  print(0)
else:
  for k in string.ascii_lowercase:
    tmp = 0
    l = copy.deepcopy(s)
    while any(ss != k for ss in l):
      for i in range(len(l) - 1):
        if l[i + 1] == k:
          l[i] = k
      l.pop(-1)
      tmp += 1
    if ans:
      ans = min(ans, tmp)
    else:
      ans = tmp
  print(ans)

Measured memory_bytes: 9916
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };
int l, r, ans = mod;
signed main() {
	cin >> l >> r;
	int l1 = l % 2019;
	int r1 = r % 2019;
	if (l1 >= r1 || r - l >= 2019)cout << 0 << endl;
	else {
		for (int i = l1; i <= r1; i++) {
			for (int j = i + 1; j <= r1; j++) {
				ans = min(ans, (i * j) % 2019);
			}
		}
		cout << ans << endl;
	}
}

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

int main(){
    int n,q;
    string s;
    cin>>n>>q>>s;
    vector<pair<int,int>> p(q);
    for(int i=0;i<q;i++){
        int l,r;
        cin>>l>>r;
        l--;
        r--;
        p[i]=make_pair(l,r);
    }
    vector<int> a(n,0);
    for(int i=0;i<n-1;i++){
        if(s.substr(i,2)=="AC") a[i+1]=a[i]+1;
        else a[i+1]=a[i];
    }

    for(int i=0;i<q;i++){
        cout<<a[p[i].second]-a[p[i].first]<<endl;
    }
}

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

vector<int> a(1000001);
int n;

bool pairwise() {
  vector<int> d(1000001);
  d[1]=1;
  vector<bool> sieve(1000001,true);
  int maxa = 0;
  for(int i=0;i<n;i++) {
    maxa = max(maxa, a[i]);
  }
  sieve[0]=false;
  sieve[1]=false;
  for(int i=2;i<=maxa;i++) {
    if(sieve[i]) d[i]=i;
    if(sieve[i] && (long long)i*i <= maxa) {
      for(int j=i*i;j<=maxa;j+=i) {
        d[j]=i;
        sieve[j]=false;
      }
    }
  }
  unordered_set<int> div;
  for(int i=0;i<n;i++){
    int e = a[i];
    while(e!=1) {
      if(div.find(d[e])!=div.end()) {
        return false;
      }
      div.insert(d[e]);
      int f = d[e];
      while(e%f==0) e/=f;
    }
  }
  return true;
}

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

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

    bool p = pairwise();
    if(p) {
      cout << "pairwise coprime";
      return 0;
    }

    int g = a[0];
    for(int i=1;i<n;i++) g = __gcd(g,a[i]);
    if(g==1) {
      cout << "setwise coprime";
      return 0;
    }

    cout << "not coprime";

    return 0;
}

Measured memory_bytes: 14576
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using ll = long long;
using ld = long double;

int n,m,q;
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;
int ans=0;

void dfs(vector<int> capa){
    if(capa.size()==n+1){
        int point=0;
        for(int i = 0; i < q; i++) {
            if(capa[b[i]]-capa[a[i]]==c[i]) point+=d[i];
        }
        ans=max(ans,point);
        return;
    }
    capa.push_back(capa.back());
    while(capa.back()<=m){
        dfs(capa);
        capa.back()++;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> q;
    a=b=c=d=vector<int>(q);
    for(int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int> (1,1));
    cout << ans << "\n";
    return 0;
}

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

typedef long long ll;
const int N = 2000006;



int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin>>n;
	vector<pair<int,int> > v;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		v.push_back({x,i});
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++){
		cout<<v[i].second<<" ";
	}
	
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  int res = 0;
  
  for(int i = 0; i < N; i++){
    int l, r;
    cin >> l >> r;
    
    res += r - l + 1;
  }
  cout << res << endl;
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600

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

  if(n<3){cout<<0<<endl; return 0;}

  vector<int> vec;
  repl(i,1,11+1) repl(j,1,6){
    if((7*i+j+1)*9 % 11 == k){
      vec.pb(i);
    }
  }

  int res = (n-2)/11 * vec.size();
  n = (n-2)%11;

  rep(i, vec.size()) if(vec[i] <= n) res++;

  cout<<res<<endl;


  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  if (s == "RRR") ans = 3;
  if (s == "RRS") ans = 2;
  if (s == "RSR") ans = 1;
  if (s == "RSS") ans = 1;
  if (s == "SRR") ans = 2;
  if (s == "SRS") ans = 1;
  if (s == "SSR") ans = 1;
  if (s == "SSS") ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
import * as fs from "fs";


interface FlipQuery {
	type: "flip";
}

interface AddQuery {
	type: "add";
	to: "start" | "end";
	char: string
}

type Query = FlipQuery | AddQuery;

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const s = input[0];
const q = +input[1];
const queries = [];
for (let i = 0; i < q; i++) {
	const query = input[i + 2].split(" ");
	if (query[0] === "1") {
		queries.push({ type: "flip" });
	} else {
		if (query[1] === "1") {
			queries.push({ type: "add", to: "start", char: query[2] });
		} else {
			queries.push({ type: "add", to: "end", char: query[2] });
		}
	}
}
queries.reverse()
let strs: [string, string] = ["", ""];
let flip_count = 0;

for (const query of queries) {
	if (query.type === "flip") {
		flip_count++;
		continue;
	}
	else if (query.type === "add") {
		// add
		const to = (query as AddQuery).to;
		const char = (query as AddQuery).char;
		const reversed = flip_count % 2 === 1;

		let to_start = to === "start";
		if (reversed) to_start = !to_start;
		strs[to_start ? 0 : 1] += char;
	}
}

let result = strs[0];
if (flip_count % 2 === 1) {
	result += s.split("").reverse().join("");
} else {
	result += s;
}
result += strs[1].split("").reverse().join("");

console.log(result);


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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant " << endl;
  }
}

Measured memory_bytes: 256