akhauriyash/Code-Regression huggingface dataset:
//#pragma optimization_level 3
#include <bits/stdc++.h>
#define  f               first
#define  s               second
#define  sym(s)          s = "#" + s + "#";
#define  all(x)          (x).begin(), (x).end()
#define  alll(x,n)       x+1, x+n+1
#define  newl            cout<<"\n";
#define  foo(i,a,n)      for(ll i = (a); i <= n; i++)
#define  deb1(a)         cout<<a<<"\n";
#define  deb2(a,b)       cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)     cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)   cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  debp(a)         cout<<a.f<<" "<<a.s<<"\n";
#define  debv(a)         for(auto it: a)cout<<it<<" ";newl;
#define  debm(a)         for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  deb1d(a,n)      foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)    foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}

using namespace std;
using ll              =  long long;
using ld              =  long double;
const ll   MOD        =  1e+9 + 7;
const ll   INF        =  LLONG_MAX;
const int  N          =  (int)2e+5 + 8;

ll n, a[N]; 
ll x, t;

void MAIN(int tc){
    string s;
    int res = 0;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        res += (s[i] - '0');
        res %= 9;;
    }
    res == 0? cout<<"Yes": cout<<"No";
}

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

    int test_cases = 1;
    //cin>>test_cases;
    for(int i = 1; i <= test_cases; i++){
        MAIN(i);
    }
}

Measured memory_bytes: 3756
import Data.List
import Control.Applicative
import Control.Monad

splitArgs :: [a] -> [[a]]
splitArgs [] = []
splitArgs (a1 : a2 : r) = [[a1, a2]] ++ splitArgs r

judge :: [String] -> [Int]
judge (a1 : a2 : a3 : a4 : b1 : b2 : b3 : b4 : _) = [hit, blow]
    where
        a = [a1, a2, a3, a4]
        b = [b1, b2, b3, b4]
        hit = length $ filter (\(x, y) -> x == y) $ zip a b
        blow = (length $ intersect a b) - hit

main :: IO ()
main = interact $ unlines . map unwords . map (map show) . map judge . map concat . map (map words) . splitArgs . lines

Measured memory_bytes: 3512
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    int n;
    cin>>n;
    ll a[n],b[n];
    loop(n,i,0)
        cin>>a[i];
    loop(n,i,0)
        cin>>b[i];
    ll x=0,y=0;
    loop(n,i,0){
        if(a[i]>=b[i])x+=a[i]-b[i];
        else y+=(b[i]-a[i])/2;
    }
    cout<<(y>=x?"Yes":"No")<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3784
#include<stdio.h>
#include<string.h>
int main(){
  char s[10],t[10],u[10];
  int a,b;
  scanf("%s",s);
  scanf("%s\n",t);
  scanf("%d",&a);
  scanf("%d\n",&b);
  scanf("%s\n",u);
  if((strcmp(s,u))==0) printf("%d %d",a-1,b);
  if((strcmp(t,u))==0) printf("%d %d",a,b-1);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

void rec( string s, int pos, LL tmp_res, LL dig );

LL ans;

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

    rec( s, s.size() - 1, 0, 1 );
    cout << ans << endl;

    return 0;
}

void rec( string s, int pos, LL tmp_res, LL dig)
{
    tmp_res += ( s[pos] - '0' ) * dig;
    if( pos == 0 ) {
        ans += tmp_res;
        return;

    }
    rec( s, pos - 1, tmp_res, 1 );
    rec( s, pos - 1, tmp_res, dig * 10 );

    return;

}


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

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

int main()
{
    int N;
    while (cin >> N && N)
    {
        vector<int> h(N + 1);
        rep(i, N + 1) cin >> h[i];

        rep(i, N + 1)
        {
            auto vec = h;
            vec.erase(vec.begin() + i);

            int growth = vec[1] - vec[0];

            bool flag = true;

            rep(i, N - 1)
            {
                if(vec[i + 1] - vec[i] != growth)
                    flag = false;
            }

            if(flag)
            {
                cout << h[i] << endl;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n],b[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i] >> b[i];
    }
    int c=0,d=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==b[i])
        {
            for(int j=i;j<n;j++)
            {
                if(a[j]==b[j])
                d++;
                else
                break;
            }
            if(d>=3)
            {
                c++;
                break;
            }
            else
            d=0;
        }
    }
    if(c>0)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int A,B;
    cin >> A >> B;

    cout << max(A+B, max(A-B,A*B)) << endl;

}


Measured memory_bytes: 256
numList = input().split()
numList = list(map(int, numList))
commandList = [
	[2,0,0],
	[0,2,0],
	[0,0,2],
	[0,1,1],
	[1,0,1],
	[1,1,0]
]
numListList = [numList]

def search(depth):
	global numListList
	tmpList = []
	for numList in numListList:
		for command in commandList:
			sumedList = sumList(numList, command)
			if check(sumedList, depth+1):
				return
			tmpList.append(sumedList)
	numListList = tmpList
	search(depth+1)

def sumList(list1, list2):
	return [list1[0]+list2[0], list1[1]+list2[1], list1[2]+list2[2]]

def check(numList, count):
	if numList[0] == numList[1] and numList[1] == numList[2]:
		print(count)
		return True

	if numList[0] == numList[1]:
		return check2(numList[0], numList[2], count)

	if numList[1] == numList[2]:
		return check2(numList[1], numList[0], count)

	if numList[0] == numList[2]:
		return check2(numList[0], numList[1], count)

	return False

def check2(num1, num2, count):
	if num1 > num2:
		if (num1-num2)%2 == 0:
			print(int(count+(num1-num2)/2))
			return True
		else:
			print(int(count+(num1-num2)/2)+2)
			return True
	else:
		print(int(count+(num2-num1)))
		return True

if check(numList, 0):
	pass
else:
	search(0)

Measured memory_bytes: 3444
import java.util.*;
import java.io.*;
class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int lengths[]=new int[n];
        for(int i=0;i<n;i++){
            lengths[i]=sc.nextInt();
        }
        int cnt=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    if(lengths[i]!=lengths[j] && lengths[i]!=lengths[k] && lengths[j]!=lengths[k]){
                        int val1=lengths[i]+lengths[j];
                        int val2=lengths[j]+lengths[k];
                        int val3=lengths[i]+lengths[k];
                        if(val1>lengths[k] && val2>lengths[i] && val3>lengths[j]){
                            cnt++;
                        }
                    }
                }
            }
        }
        System.out.println(cnt);
    }
}

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


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


Measured memory_bytes: 256
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,L = map(int,input().split())
a  =[0]*(N)
b = [0]*(N)
for i in range(N):
    a[i] = L+i
    b[i] = abs(a[i])
s = sum(a)
c = inf
index = 0
for i in range(N):
    if b[i]<c:
        c = b[i]
        index = i
print(s-a[index])

Measured memory_bytes: 38480
#include <iostream>
#include <set>

using namespace std;
int main() {
  set<int> s;
  int q, x;
  cin >> q; // skip n
  while (cin >> q >> x) {
    if (q == 0) {
      s.insert(x);
      cout << s.size() << endl;
    }
    if (q == 1)
      cout << s.count(x) << endl;
    if (q == 2)
      s.erase(x);
    if (q == 3) {
      int r;
      cin >> r;
      auto li = s.lower_bound(x);
      auto ri = s.lower_bound(r + 1);
      while (li != ri)
        cout << *(li++) << endl;
    }
  }
}


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

typedef long long ll;
// const int INF = 1e8;
const ll INF = 1LL << 60;
typedef pair<int, int> P;

string S;

int main() {
    cin >> S;
    if (S.size() % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i <= S.size() - 2; i+=2) {
        if (!(S[i] == 'h' && S[i + 1] == 'i')) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

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

typedef pair<string ,int>P;
typedef pair<P,int>PP;
vector<PP>p;

bool comp(const PP &p1, const PP &p2) {
  if(p1.first.first<p2.first.first){
	return 1;
  }else if(p1.first.first>p2.first.first){
	return 0;
  }else{
	if(p1.first.second>p2.first.second){
	  return 1;
	}else{
	  return 0;
	}
	
  }

}
int main(){

  int N;

  cin>>N;

  string s[101];

  int d[101];
  
  
  for(int i=0;i<N;i++){
	cin>>s[i]>>d[i];

	p.push_back(PP(P(s[i],d[i]),i+1));
	
  }

  sort(p.begin(),p.end(),comp);

  for(int i=0;i<N;i++){
	cout<<p[i].second<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
//const int mod= int(1e9)+7;
const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;cin >>s;
    string r=s;
    reverse(all(r));
    if(s==r)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3640
s=list(input())
if s[0]=="A" and s[2:len(s)-1].count("C")==1:
    s[0]="a"
    s[s.index("C")]="c"
    if "".join(s).islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 9108
import sys
n, m = map(int, input().split())
N = 2000
G = [[0] * N for i in range(N)]
dp = [[0] * N for i in range(N)]
col = [0] * N
cnt = [0] * 2
visit = [0] * N
for i in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    G[a][b], G[b][a] = 1, 1


def dfs(u, c):
    visit[u] = 1
    col[u] = c
    cnt[c] += 1

    for v in range(n):
        if v == u or G[u][v] == 1:
            continue

        if visit[v] == 1 and col[v] == c:
            return False

        if not visit[v] and not dfs(v, c ^ 1):
            return False

    return True


num = 0
dp[0][0] = 1
for i in range(n):
    if not visit[i]:
        num += 1

        cnt[0], cnt[1] = 0, 0

        if not dfs(i, 0):
            print(-1)
            sys.exit()

        for j in range(n):
            for k in range(2):
                if j >= cnt[k]:
                    dp[num][j] |= dp[num - 1][j - cnt[k]]

ans = m
for i in range(n):
    if dp[num][i]:
        ans = min(ans, i * (i - 1) // 2 + (n - i) * (n - i - 1) // 2)

print(ans)




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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int size = in.nextInt(), arr[] = new int[size];
		for(int i = 0; i < size; i++) {
			arr[i] = Integer.parseInt(in.next());
		}

		int query = in.nextInt();
		for(int i = 0; i < query; i++) {
			int begin = Integer.parseInt(in.next()), end = Integer.parseInt(in.next()), target = Integer.parseInt(in.next());

			for(int j = 0; j < end - begin; j++) {
				int temp = arr[begin + j];
				arr[begin + j] = arr[target + j];
				arr[target + j] = temp;
			}

		}

		for(int i = 0; i < size; i++) {
			out.printf("%d%s", arr[i], (i < size - 1) ? " " : "\n");
		}
		out.flush();
		in.close();
	}

}



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

int main(){
    string S;
    cin >> S;
    int len = (int)S.length();
    // cout << len << endl;

    // vector<int> num(2019, 0); //num[a]はあまりがaのパターンの個数
    long num[2019];
    rep(i, 2019) num[i] = 0;

    num[0]++;
    // cout << 0 << endl;

    long res = (long) ( S[len-1] - '0');
    num[res]++; //この1行があればACだった...
    // cout << res << endl;
    long modten = 1;

    // for(int i = 1; i < len; i++){
    //     modten *= 10;
    //     modten = modten % 2019;
    //     res = res + modten * ( ( (long)S[len - i - 1] ) - '0' );
    //     res = res % 2019;
    //     num[res]++;
    //     // cout << res << " " << num[res] << endl;
    // }

    for(int i = len-2; i >= 0; i--){
        modten *= 10;
        modten = modten % 2019;
        res = res + modten * ( (long) ( S[i] - '0') );
        res = res % 2019;
        num[res]++;
        // cout << res << " " << num[res] << endl;
    }


    long ans = 0;

    for(int i = 0; i < 2019; i++){
        ans = ans + num[i] * (num[i] - 1) / 2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3768
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define reo(i,n) for(int (i) = 1 ; (i) <= (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(n,i) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
#define cyes cout<<"Yes\n"
#define cno cout<<"No\n"
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ 0,0,-1,1 }, dy{ 1,-1,0,0 };
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------------------
signed main() {
	int n, k;
	cin >> n >> k;
	vec<int>a;
	rep(i, n) a.pb(read());
	sort(all(a));
	int sum = 0;
	rep(i, n - k) {
		sum += a[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 2420
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      int N = nextInt();
      int K = nextInt();
      int output = 1;
      for(int i = 0; i < N; i++){
        if(output <= K){
          output *= 2;
        }else{
          output += K;
        }
      }
      myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32788
a, b, c, d = gets.split.map(&:to_i)

lcm = c.lcm(d)

a_lt = (a - 1) / c + (a - 1) / d - (a - 1) / lcm
b_lte = b / c + b / d - b / lcm
a_gte_b_lte = b_lte - a_lt

p b - a - a_gte_b_lte + 1

Measured memory_bytes: 14384
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define inputv(arr,n) for(ll i=0;i<n;i++){ll value;cin>>value;arr.pb(value);}
#define sz(a) ((ll)(a).size())
#define len(a) ((ll)(a).length())
#define precise cout<<fixed<<setprecision(0); 
#define F first
#define S second
#define vi vector <int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
#define nl cout<<"\n"
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
// hashing for pairs
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
//sort in reverse order
bool compare(ll x, ll y){
    return x>y;
}
void solve()
{
  ll h,w,k;
  cin>>h>>w>>k;
  ll ones=0,cnt=0;
  char ch;
  ll arr[7][7]={0};
  ll row[7]={0};
  ll col[7]={0};
  ll dp[(ll)pow(2,h)][(ll)(pow(2,w))]={0};
  rep(i,h)
  {
    rep(j,w)
    {
      cin>>ch;
      if(ch=='#')
      {
        arr[i][j]=1;
        row[i]++;
        col[j]++;
        ones++;
      }
    }
  }

  for (ll i = 0; i < pow(2,h); i++)
  {
    string a = bitset<6>(i).to_string();
    reverse(all(a));
    for (ll j = 0; j < pow(2,w); j++)
    {
      string b = bitset<6>(j).to_string();
      //cout<<"checking for row "<<a<<" ans col "<<b;nl;
      reverse(all(b));
      //cout<<"checking for row "<<a<<" ans col "<<b;nl;
      ll ans=0;
      for (ll p = 0; p < len(a); p++)
      {
        if(a[p]!='0')
        {
           ans+=row[p];
        }
      } 
      for (ll q = 0; q < len(b); q++)
      {
        if(b[q]!='0')
        {
          ans+=col[q];
        }
      }
      rep(m,len(a))
      {
        rep(n,len(b))
        {
          if(a[m]!='0'&&b[n]!='0')
          {
            ans-=(arr[m][n]);         
          }
        }
      }
     // cout<<"ans is "<<ans;nl;
      if(ans ==ones-k)
      {
        cnt++;
      }
    }
    
  }
  cout<<cnt;nl;
  return;
}
int main()
{
    IOS;
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
#define F first
#define S second
#define MP make_pair
int N, K;
int c[5000], r[5000];
bool flag[5000];
int flag2[5000];
vector<int> G[5000], G2[5000];
priority_queue<P, vector<P>, greater<P> > pq;
void bfs(int s)
{
	queue<P> que;
	que.push(MP(s, 0));
	memset(flag, 0, sizeof(flag));
	flag[s] = true;
	while(!que.empty())
	{
		P now = que.front();
		que.pop();
		if(now.S == r[s]) continue;
		for(int i = 0; i < G[now.F].size(); ++i)
		{
			if(!flag[G[now.F][i]])
			{
				flag[G[now.F][i]] = true;
				que.push(MP(G[now.F][i], now.S + 1));
				G2[s].push_back(G[now.F][i]);
			}
		}
	}
}
void dijkstra(int s)
{
	pq.push(MP(0, 0));
	while(!pq.empty())
	{
		P now = pq.top();
		pq.pop();
		for(int i = 0; i < G2[now.S].size(); ++i)
		{
			if(flag2[G2[now.S][i]] > now.F + c[now.S])
			{
				flag2[G2[now.S][i]] = now.F + c[now.S];	
				pq.push(MP(now.F + c[now.S], G2[now.S][i]));
			}
		}
	}
}
int main()
{
	cin >> N >> K;
	for(int i = 0; i < N; ++i)
		scanf("%d%d", c + i, r + i);
	for(int i = 0; i < K; ++i)
	{
		int in1, in2;
		scanf("%d%d", &in1, &in2);
		--in1; --in2;
		G[in1].push_back(in2);
		G[in2].push_back(in1);
	}
	fill(flag2 + 1, flag2 + N, INT_MAX);
	for(int i = 0; i < N; ++i)
		bfs(i);
	dijkstra(0);
	cout << flag2[N - 1] << endl;
}

Measured memory_bytes: 70724
# -*- coding: utf-8 -*-

def LBp(N,X,dLB):
    if N == 0 and X == 1:
        P = 1
    elif N >= 1:
        if X == 1:
            P = 0
        elif 2 <= X <= dLB[N-1]+1:
            P = LBp(N-1,X-1,dLB)
        elif X == dLB[N-1]+2:
            P = LBp(N-1,dLB[N-1],dLB) + 1
        elif dLB[N-1]+3 <= X <= dLB[N]-1:
            P = LBp(N-1,dLB[N-1],dLB) + LBp(N-1,X-dLB[N-1]-2,dLB) + 1
        elif X == dLB[N]:
            P = 2*LBp(N-1,dLB[N-1],dLB) + 1
    return P

def solve():
    N, X = map(int, input().split())
    dLB = [1]
    for i in range(1,N+1):
        dLB[i:] = [2*dLB[i-1]+3]
    res = LBp(N,X,dLB)
    return str(res)

if __name__ == '__main__':
    print(solve())

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

int main() {
	string s, t;
	cin >> s;
	cin >> t;
	//-1
	set<char>ss, ts;
	for (int i = 0; i < s.length(); i++)ss.insert(s.at(i));
	for (int i = 0; i < t.length(); i++) {
		ts.insert(t.at(i));
		if(ss.count(t.at(i)))continue;
		else {
			cout << -1 << endl;
			return 0;
		}
	}
	//alphabet-indexを作る
	int ends = s.length();
	vector<vector<int>>alpex(26, vector<int>(0));
	vector<int>alpmax(26,-1);
	for (int i = 0; i < s.length(); i++) {
		int x = s.at(i) - 'a';
		alpex.at(x).push_back(i + 1);
	}
	for (int i = 0; i < 26; i++) {
		if(alpex.at(i).size()>=1)alpmax.at(i) = alpex.at(i).at(alpex.at(i).size() - 1);
	}
	for (int i = 0; i < 26; i++) {
		char x = 'a' + i;
		if (!ts.count(x))alpex.at(i).clear();
	}
	ll ans = 0;
	int ct = 0;
	for (int i = 0; i < t.length(); i++) {
		int x = t.at(i) - 'a';
		if (alpmax.at(x) <= ct) {
			ans += ends - ct;
			ct = 0;
			//cout << "Re:"<<ans << endl;
		}
		int y = upper_bound(alpex.at(x).begin(), alpex.at(x).end(), ct) - alpex.at(x).begin();
		ans += alpex.at(x).at(y) - ct;
		ct = alpex.at(x).at(y);
		//cout <<i<<":"<< ans << " ct:"<<ct<< endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
// #define fi first
// #define se second
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};

/*--------------------------------------------------------------------------------

--------------------------------------------------------------------------------*/

int main() {
    ll x; cin >> x;
    cout << 1 - x << endl;

    return 0;
}

Measured memory_bytes: 3628
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*   
*   文件名称：B.cpp
*   创 建 者：YaliKiWi
*   创建日期：2019年08月04日
*   描    述：
*
================================================================*/


#include<bits/stdc++.h>
using namespace std;
int n,ans; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	for(register int i=1;i<=n;i++){
		if((i<10 and i>=1) or (i<1000 and i>=100) or (i<100000 and i>=10000))
			ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
/*
---------------------------------
题解：
我还是太蒟了，没有想到能二分答案……
我们二分塔顶的值，把小于等于这个值的变为1，大于变为0。
我们可以发现如果有多个个1或0连在一起，那么他们就无法被分开，他会一直往上走。
那也就是说，最后那组先走到顶那组就赢了，那就要看那组离中心更近。
那会不会存在两个不同阵营的组距离一样远能，你会发现这是不可能的。
因为，如果距离相等，那么中间一定是奇数个位置，我们用1和0,交替隔开两组，
那么最后一个位置肯定会和左边或者右边一样，又形成一个组，所这两个组要么都是1，要么都是0。
解决了这些问题就能愉快的判断了！
CODE：
---------------------------------题解1

最后还有一种特殊情况。就是没有任何两个相邻的。
大概长这样。。
    0
  0 1 0
0 1 0 1 0
我们只需要特判一下就行了。
总结，一道二分贪心题，需要一定的手推过程找到规律。
---------------------------------题解2
*/
#include<iostream>
#include<cstdio>
#include<cassert>
using namespace std;

int n,a[200005];

inline bool check(const int &k){
    if((a[n-1]<=k&&a[n]<=k)||(a[n]<=k&&a[n+1]<=k))return 1;
    if((a[n-1]> k&&a[n]> k)||(a[n]> k&&a[n+1]> k))return 0;
    for(int i=1;i<n-1;i++){
        if((a[n+i]<=k&&a[n+i+1]<=k)||(a[n-i]<=k&&a[n-i-1]<=k))return 1;
        if((a[n+i]> k&&a[n+i+1]> k)||(a[n-i]> k&&a[n-i-1]> k))return 0;
    }
    return a[1]<=k;
}

int main(){
    scanf("%d",&n);
    for(int i=1;i<n<<1;i++)scanf("%d",a+i);
    int l=1,r=(n<<1)-1;
    while(l<r){//满足 l<=k<=r
        int mid=l+r>>1;
        if(check(mid))r=mid;//结果可能小于等于k
        else l=mid+1;//不可能-->结果大于k-->往右半部分搜
    }
    assert(l==r);
    printf("%d",l);
}

Measured memory_bytes: 1024
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

xs, ys, xt, yt = map(int, input().split())
n = int(input())

p = [(xs,ys,0),(xt,yt,0)]
for i in range(2,n+2):
    p.append(tuple(map(int,input().split())))
edge = [[-1]*(n+2)for i in range(n+2)]
 
for i in range(n+2):
    for j in range(i+1,n+2):
        edge[i][j] = edge[j][i] =  max(((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5 - p[i][2] - p[j][2],0.0)

G = csgraph_from_dense(edge,null_value=-1)
print(dijkstra(G,indices=0)[1])

#print(d[1])


Measured memory_bytes: 63280
N=int(input())
A=list(map(int,input().split()))
node=[1 for _ in range(N+1)]
Sn=sum(A)
S=[Sn]
for s in range(N):
    S.append(S[s]-A[s+1])

ans=1
for i in range(1,N+1):
    if node[i-1]*2<=S[i-1]:
        ans+=node[i-1]*2
        node[i]=node[i-1]*2
    elif node[i-1]<=S[i-1]<node[i-1]*2:
        node[i]=S[i-1]
        ans+=S[i-1]
    node[i]-=A[i]
    if node[i]<0:
        ans=-1
        break

if A[0]>0:
    ans=-1
if N==0 and A[0]==1:
    ans=1

print(ans)

Measured memory_bytes: 20868
#include <stdio.h>

int main(void)
{
    char str[1024], *p;
    int n, sim;
    
    
    scanf("%d", &n);
    
    while (n--){
        scanf("%s", str);
        
        if (str[0] == '0'){
            break;
        }
        
        sim = 0;
        p = str;
        while (strlen(p) != 1){
            p[0] = p[0] + p[1] - '0';
            p[1] = (p[0] - '0') % 10 + '0';
            p[0] = (p[0] - '0') / 10 + '0';
            
            while (*p == '0'){
                p++;
            }
            
            sim++;
        }
        
        if (sim % 2){
            printf("Fabre wins.\n");
        }
        else {
            printf("Audrey wins.\n");
        }
    }
    return (0);
}

Measured memory_bytes: 0
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))


a.sort()
c.sort()
sum_count = 0
for i in b:
    sum_count += bisect.bisect_left(a, i) * (N - bisect.bisect_right(c, i))
print(sum_count)


Measured memory_bytes: 29500
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
#include<iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    long double ans = 0.0;
    rep(i, n){
        long double a;
        string s;
        cin >> a >> s;
        if(s == "JPY"){
            ans += a;
        }
        else{
            ans += (380000.0)*a;
        }
    }
    cout << fixed << setprecision(8) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main (){
  vector<vector<int>>vec(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0; j<3;j++){
      cin >> vec[i][j];
    }
  }
  int a2,b2,b3,a3;
  for(int i=-10000;i<10000;i++){
    for(int j=-10000;j<10000;j++){
      
      b2=vec[0][1]-i;
      b3=vec[0][2]-i;
      a2=vec[1][0]-j;
      a3=vec[2][0]-j;
      if(i+j==vec[0][0] && a2+b2==vec[1][1] && a3+b3==vec[2][2] && a2+b3==vec[1][2] && a3+b2==vec[2][1]){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}




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

int n;
string s;
map<string, int> cnt;
vector<string> ans;

int main() {
	cin>>n;
	int m = 0;
	for(int i = 0; i < n; i++){
		cin>>s;
		cnt[s]++;
		if(cnt[s] > m){
			m = cnt[s];
		}
	}
	for(auto k : cnt){
		if(k.second == m)	ans.push_back(k.first);
	}
	sort(ans.begin(), ans.end());
	for(auto w : ans)
		cout<<w<<'\n';
	return 0;
}

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

class point {
public:
	int x, y;
	point() {}
	point(int a, int b) { x = a; y = b; }
	point operator +( point p ) { return point( x + p.x, y + p.y ); }
	point operator -( point p ) { return point( x - p.x, y - p.y ); }
	bool operator <( point p ) { if( y == p.y ) return x < p.x; else return y < p.y; }
	point operator *( int a ) { return point( x * a, y * a ); }
	point operator /( int a ) { return point( x / a, y / a ); }
};

int dot( point a, point b ) { return a.x * b.x + a.y * b.y; }
int cross( point a, point b ) { return a.x * b.y - a.y * b.x; }

int main()
{
	int n;
	cin >> n;
	vector<point> S( n );
	for( int i = 0; i < n; i++ ) {
		cin >> S[i].x >> S[i].y;
	}

	sort( S.begin(), S.end() );
	vector<point> U;
	U.push_back( S[0] );
	U.push_back( S[1] );
	for( int i = 2; i < S.size(); i++ ) {
		int flag = 1;
		while( U.size() > 1 && flag ) {
			point v1 = U[U.size() - 1] - U[U.size() - 2];
			point v2 = S[i] - U[U.size() - 2];
			if( cross( v1, v2 ) >= 0 ) {
				flag = 0;
			}
			else {
				U.pop_back();
			}
		}
		U.push_back( S[i] );
	}
	vector<point> L;
	L.push_back( S[S.size() - 1] );
	L.push_back( S[S.size() - 2] );
	for( int i = S.size() - 3; i >= 0; i-- ) {
		int flag = 1;
		while( L.size() > 1 && flag ) {
			point v1 = L[L.size() - 1] - L[L.size() - 2];
			point v2 = S[i] - L[L.size() - 2];
			if( cross( v1, v2 ) >= 0 ) {
				flag = 0;
			}
			else {
				L.pop_back();
			}
		}
		L.push_back( S[i] );
	}

	cout << U.size() + L.size() - 2 << endl;
	for( int i = 0; i < U.size(); i++ ) {
		cout << U[i].x << " " << U[i].y << endl;
	}
	for( int i = 1; i < L.size() - 1; i++ ) {
		cout << L[i].x << " " << L[i].y << endl;
	}
}



Measured memory_bytes: 4460
#include<stdio.h>
int main(){
	int a,b,i;
	while(scanf("%d%d",&a,&b)!=EOF){
		i=0,a+=b;
		while(a!=0){
			a/=10;
			++i;
		}
		printf("%d\n",i);
	}
	return 0;
}


Measured memory_bytes: 2028
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	string str;
	cin >> str;
	for(int i=0;i<4;i++)	cout << str[i];
	cout << ' ';
	for(int i=4;i<str.size();i++)	cout << str[i];
	cout << endl;
}


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

#define int long long
#define vi vector <int>
#define endl "\n"
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int N=1e5+5 , MOD=1e9+7;

int a[N], b[N], c[N];

int dp[N][3]={0};

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


void solve()
{
    int n;
    cin >> n;
    rep(i,0,n) cin >> a[i] >> b[i] >> c[i];

    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];

    rep(i,1,n)
    {
    	dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);
    	dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
    	dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << endl;

}

signed main()
{
    speed;
    
 //    int t; cin >> t;
 //    rep(tt,1,t+1)
 //    {
	// cout <<"Case #"<<tt<<": ";
	solve();
 //    }
    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNext()){
			int num = 0;
			int n = scan.nextInt();
			
			for(int a=0; a<=9; a++){
				for(int b=0; b<=9; b++){
					for(int c=0; c<=9; c++){
						for(int d=0; d<=9; d++){
							if(a+b+c+d == n){
								num++;
							}
						}
					}
				}
			}
			System.out.println(num);
		}
	}
}

Measured memory_bytes: 18824
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
 
typedef pair<long long int,long long int>pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
 
# define  MAX 200005
long long int MOD=998244353;
long long int INF=1e18;
 
int main()
{
    
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
     cout.tie(NULL);
      long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t;
    cin>>n;
    vector<long long int>V;
    long long int A[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>A[i];
    }
    long long int B[n+1];
    for(i=0;i<=n;i++)
    {
        B[i]=0;   
    }
    for(i=n;i>=1;i--)
    {

        if((B[i])!=(A[i]%2))
        {
           V.push_back(i);
          for(j=1;j<=sqrt(i);j++)
         {
              
                if(i%j==0)
                {
                    
                 if(i!=j*j)
                 {
                   B[i/j]++;
                   B[i/j]=B[i/j]%2;
                 }
                
                    B[j]++;
                    B[j]=B[j]%2;
                   // cout<<j<<" "<<i/j<<endl;
                 
                }
        }
            
        }
        
    }
    
    cout<<V.size()<<endl;
    for(i=0;i<V.size();i++)
        cout<<V[i]<<" ";
   
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N,X;
int A [200000];
bool used [200000];

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

	cin >> N >> X;
	if(X == 1 || X == N * 2 - 1){
		cout << "No" << endl;
		return 0;
	}
	if(N == 2){
		if(X == 2){
			cout << "Yes" << endl;
			for(int i = 1;i <= 3;i++){
				cout << i << endl;
			}
		}
		else{
			cout << "No" << endl;
		}
		return 0;
	}

	cout << "Yes" << endl;
	if(X >= 3){
		A [N - 2] = 1;
		A [N - 1] = X;
		A [N] = X + 1;
		A [N + 1] = 2;
		used [1] = true;
		used [2] = true;
		used [X + 1] = true;
		used [X] = true;
	}
	else if(X <= N * 2 - 3){
		A [N - 2] = N * 2 - 1;
		A [N - 1] = X;
		A [N] = X - 1;
		A [N + 1] = N * 2 - 2;
		used [N * 2 - 1] = true;
		used [X] = true;
		used [X - 1] = true;
		used [N * 2 - 2] = true;
	}

	int x = 1;
	for(int i = 0;i < N * 2 - 1;i++){
		if(A [i] == 0){
			while(x <= N * 2 - 1 && used [x] == true){
				x++;
			}
			if(!(x >= 1 && x <= N * 2 - 1)){
				cout << "No" << endl;
				return 0;
			}
			A [i] = x;
			used [x] = true;
		}
		cout << A [i] << endl;
	}

	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )
#define rep2(n) for( int j = 0 ; j < n ; j++ )
#define REP2(n) for( int j = 1 ; j <= n ; j++ )
#define repll2(n) for( ll j = 0 ; j < n ; j++ )
#define REPll2(n) for( ll j = 1 ; j <= n ; j++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if( n < 1200 ) cout << "ABC";
    else if( n < 2800 ) cout << "ARC";
    else cout << "AGC";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int r,d,x2000,temp;
  cin >> r >> d >> x2000;

  temp= x2000;
  rep(i,0,10){
    temp= r* temp -d;
    cout << temp << endl;
  }
}


Measured memory_bytes: 256
n = gets.to_i

odd = Hash.new(0)
even = Hash.new(0)

v = gets.split.map(&:to_i)

n.times do |i|
  if i%2 == 0
    even[v[i]] += 1
  else
    odd[v[i]] += 1
  end
end

odd = odd.sort_by{ |k, t| -t}.to_h
odd.store(0,0)
even = even.sort_by{ |k, t| -t}.to_h
even.store(0,0)

if odd.keys.first != even.keys.first
  puts n - odd.values.first -  even.values.first
else
  x = odd.values[0] + even.values[1]
  y = odd.values[1] + even.values[0]

  puts [n-x,n-y].min
end


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


int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   cout << fixed << setprecision(20);
   
   ll n,k,q,ans; cin >> n >> k >> q;
   vector<ll> a(q),b(n,k-q); rep(i,0,q)cin >> a[i];
   rep(i,0,q){
     b[(a[i]-1)]+=1;
   }
   rep(i,0,n){
   	if(b[i]>0) cout << "Yes" << endl;
   	else cout << "No" << endl;
   }

   

   //cout << ans << endl;
}



Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <bitset>
#include <set>
#include <iomanip>

using namespace std;

int main() {
    int Q;
    cin >> Q;
    vector<int> l(Q, 0);
    vector<int> r(Q, 0);
    for (int i = 0; i < Q; ++i) {
        cin >> l[i] >> r[i];
    }

    int maxR = *max_element(r.begin(), r.end());
    int sqrtMaxR = (int)sqrt(maxR);

    vector<int> primes;
    for (int i = 0; i <= maxR; ++i) {
        primes.push_back(i);
    }
    primes[0] = -1;
    primes[1] = -1;

    for (int i = 2; i < primes.size(); ++i) {
        if (i > sqrtMaxR) {
            break;
        }
        if (primes[i] < 0) {
            continue;
        }
        int j = 2;
        while (i * j < primes.size()) {
            primes[i * j] = -1;
            ++j;
        }
    }

    vector<int> accumLike2017(primes.size(), 0);
    int accum = 0;
    for (int i = 0; i < primes.size(); ++i) {
        if (i % 2 == 1 && primes[i] > 0 && primes[(i + 1) / 2] > 0) {
            ++accum;
        }
        accumLike2017[i] = accum;
    }

    vector<int> answers(Q, 0);
    for (int i = 0; i < Q; ++i) {
        answers[i] = accumLike2017[r[i]] - accumLike2017[l[i] - 1];
        //int cnt = 0;
        //for (int j = l[i]; j <= r[i]; ++j) {
        //    if (j % 2 == 1 && primes[j] > 0 && primes[(j + 1) / 2] > 0) {
        //        ++cnt;
        //    }
        //}
    }

    for (int i = 0; i < Q; ++i) {
        cout << answers[i] << endl;
    }
    //cout << setprecision(15) << endl;
    return 0;
}


Measured memory_bytes: 2680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
   
public class Main {
    public static void main( String args[] ) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] dat=br.readLine().split(" ");
        int a,b,C;
		a=Integer.parseInt(dat[0]);
        b=Integer.parseInt(dat[1]);
        C=Integer.parseInt(dat[2]);
		
		final double radianC	= Math.toRadians( C );
		final double ab				= a * b;
          
        final double sinC = Math.sin( radianC );
        final double cosC = Math.cos( radianC );
          
          
        // S
        double S = ab * sinC / 2;
          
        // L
        double L = a + b + Math.sqrt( a * a + b * b - 2 * ab * cosC );
          
        // h
        double h = b * sinC;
          
        System.out.print(S + "\n" + L + "\n" + h + "\n");
          
    }
      
}

Measured memory_bytes: 16972