akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int main(){
    // chrono::steady_clock clk;
    // auto start = clk.now();
    int n, k;
    cin >> n >> k;
    string s; cin >> s;
    vector<int> ss(n);
    for(int i=0;i<n;i++){
        ss[i] = s[i] == 'A';
    }
    bool flip = false, fflip = false;;
    int idx = 0;
    for(int i=0;i<k;i++){
        if(flip ^ ss[idx]){
            // ss[idx] = !ss[idx];
            ss[idx] ^= 1;
        }else{
            // flip = !flip;
            flip ^= 1;
            idx++;
            if(idx == n){ idx = 0; }
        }
        // if(i % 1000000 == 0 && clk.now() - start > 1900ms){
        //     if(n % 2 && (k - i - 1) % 2){
        //         fflip = true;
        //     }
        //     break;
        // }
    }
    cout << (fflip ^ flip ^ ss[idx] ? 'A' : 'B');
    for(int i=1;i<n;i++){
        cout << (flip ^ ss[(idx + i) % n] ? 'A' : 'B');
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 1660
h,n=map(int,input().split())
a_=0
magic=[]
for i in range(n):
  a,b=map(int,input().split())
  a_=max(a,a_)
  c=[a,b]
  magic.append(c)
dp=[10**8+1]*(h+a_+1)
dp[0]=0
for i in range(n):
  a,b=magic[i]
  for j in range(len(dp)):
    if j+a<=h+a_:
      dp[j+a]=min(dp[j+a],dp[j]+b)
print(min(dp[h:]))     


Measured memory_bytes: 73560
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
int MOD=1000000007;
int main() {
    int H,W,count=0;
	cin >> H >> W;
    char c[H+10][W+10];
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++){
        cin >> c[i][j];
        }
	}
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			if (c[i][j]=='#' && c[i][j-1]!='#' && c[i][j+1]!='#' && c[i-1][j]!='#' && c[i+1][j]!='#') 
            count+=1;
		}
	}
	if (count == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>b) swap(a,b);
  if(b>c) swap(b,c);
  if(a>c) swap(a,c);
  if(a>b) swap(a,b);
  cout<<a<<" "<<b<<" "<<c<<endl;
}



Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
 
using pii = pair<int, int>;
using ll = long long;
 
constexpr int INF = 1e9;
 
int main() {
    int H, W, D;
    cin >> H >> W >> D;
    string color = "RYGB";
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            int mask = 0;
            // rotate 45
            mask |= (i + j) / D % 2;
            mask |= ((H - 1 - (i - j)) / D % 2) << 1;

            cout << color[mask];
        }
        cout << endl;
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	
	
	ll a,b,i,ans;
	cin>>a>>b;
	ans=0;
	
	if(a%2==0){
		if(b%2==0){
			cout<< (b^((max(b-a,(ll)0)+1)/2%2)) << endl;
		}
		else{
			cout<<((max(b-a,(ll)0)+1)/2%2)<<endl;
		}
	}
	else{
		if(b%2==0){
			cout<< (a^b^((max(b-a-1,(ll)0)+1)/2%2)) << endl;
		}
		else{
			cout<<(a^(max(b-a-1,(ll)0)+1)/2%2)<<endl;
		}
	}
	
	
	
	
//////////////////////////////////////////////////////
return 0;}











Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class88
    {
        static char[,] map = new char[50, 50];
        static bool[,] frag = new bool[50, 50];
        static int[] dx = new int[4] { 1, 0, -1, 0 };
        static int[] dy = new int[4] { 0, 1, 0, -1 };
        static void Main()
        {
            var HW = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int count = 0;
            for(int i = 0; i < HW[0]; i++)
            {
                var r = Console.ReadLine();
                for (int j = 0; j < HW[1]; j++)
                {
                    map[i, j] = r[j];
                    if (r[j] == '#') count++;
                }
            }
            var que = new Queue<Tuple<int, int, int>>();
            que.Enqueue(Tuple.Create(0, 0, 0));

            bool found = false;
            while (que.Count > 0)
            {
                var p = que.Dequeue();
                for(int i = 0; i < 4; i++)
                {
                    var t = Tuple.Create(p.Item1 + dy[i], p.Item2 + dx[i], p.Item3 + 1);
                    if(0<=t.Item1&&t.Item1<HW[0]&&0<=t.Item2&&t.Item2<HW[1])
                        if(map[t.Item1,t.Item2]!='#'&&!frag[t.Item1,t.Item2])
                        {
                            que.Enqueue(t);
                            frag[t.Item1, t.Item2] = true;

                            if (t.Item1 == HW[0] - 1 && t.Item2 == HW[1] - 1)
                            {
                                found = true;
                                break;
                            }
                        }
                }
                if (found) break;
            }
            if(!found) { Console.WriteLine(-1);return; }
            var m = que.Last().Item3;
            Console.WriteLine(HW[1] * HW[0]-1 - count - m);
        }
    }
}


Measured memory_bytes: 13524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int N;
        int[] A, B;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            A = new int[N + 1];
            B = new int[N + 1];
            for (int i = 1; i < N + 1; i++) {
                A[i] = in.nextInt();
                B[i] = in.nextInt();
            }
            Arrays.sort(A);
            Arrays.sort(B);

            if (N % 2 != 0) {
                int midA = A[(N + 1) / 2];
                int midB = B[(N + 1) / 2];
                out.println(midB - midA + 1);
            } else {
                int midA = (A[N / 2] + A[N / 2 + 1]);
                int midB = (B[N / 2] + B[N / 2 + 1]);
                out.println(midB - midA + 1);
            }
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 57748
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  for (int i = 1; i <= 9; i++){
    if (N < (i * 111 + 1) && N > ((i - 1) * 111)){
      cout << i * 111 << endl;
    }
    else {
      continue;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        double t=sc.nextDouble();
        double x=sc.nextDouble();
        out.println(t/x);
    }
}

Measured memory_bytes: 25168
#include<stdio.h>
#include<string.h>
int main(){
    int i, r, n, n2, z;
    char moji1[201] = {}, tmp1, tmp2;

    for(;scanf("%s", moji1),moji1[0] != '-';){
        scanf("%d", &n);
        for( i = 0; i < n; i++ ){
            scanf("%d", &n2);
            for( r = 0; r < n2; r++ ){
                for( z = 0; z < strlen( moji1 ); z++ ){
                   if( z == 0 ){
                    tmp1 = moji1[z];
                   }else if( z == strlen(moji1) - 1 ){
                        moji1[z - 1] = moji1[z];
                        moji1[z] = tmp1;
                    }else{
                        moji1[z - 1] = moji1[z];
                        tmp2 = moji1[z];
                   }
                }
            }
        }
        printf("%s\n", moji1);
    }
    return 0;
}

Measured memory_bytes: 584
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        w: usize,
        p: [(usize, usize); n],
    }
    let mut dp = vec![0; w + 1];
    for &(x, y) in &p {
        for i in (x..(w + 1)).rev() {
            dp[i] = std::cmp::max (dp[i], dp[i - x] + y);
        }
    }
    println! ("{}", dp[w]);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main()
{
	int n, h, t, cnt=0;
	cin >> n;
	cin >> h;
	while (n--)
	{
		cin >> t;
		if (t>=h)
		{
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	// 最も左or右の人どちらか一方は幸福にはできない
	// RLが幸福ではないので、Lが続くところを変えてやると二人幸福になる,1回で2人以上幸福にはできない
	int cnt = 0;
	rep1(i, n - 1) {
		if (s[i - 1] == s[i]) cnt++;
	}
	cout << min(cnt + 2 * k, n - 1) << endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#define N 8
#define FREE -1
#define NFREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1],X[N][N];

void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i]=FREE;
    col[i]=FREE;
  }
  for(i=0;i<2*N-1;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
}
void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j){
	printf("Q");
      }
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;
  if(i==N){
    printBoard();
    return;
  }
  for(j=0;j<N;j++){
    if(col[j]==NFREE||dpos[i+j]==NFREE||dneg[i-j+N-1]==NFREE)continue;
    row[i]=j;
    col[j]=NFREE;
    dpos[i+j]=NFREE;
    dneg[i-j+N-1]=NFREE;
    recursive(i+1);
    row[i]=FREE;
    col[j]=FREE;
    dpos[i+j]=FREE;
    dneg[i-j+N-1]=FREE;
 }

}

int main(){
  int i,j,k,r,c;
  initialize();

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      X[i][j]=0;
    }
  }
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    X[r][c]=1;
  }
  recursive(0);
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int P=1e9+7,N=(int)(6e5+50)<<2;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }

int Q(string s){
	printf("? %s\n",s.c_str()); 
	fflush(stdout); 
	int x; scanf("%d",&x); return x; 
}

const int L=128;
int m,len; string bet;
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
#endif
	lop(i,0,26)bet+='a'+i;
	lop(i,0,26)bet+='A'+i;
	lop(i,0,10)bet+='0'+i;
	m=bet.size();
	vector<string> v(m,"");
	lop(i,0,m){
		int z=L-Q(string(L,bet[i]));
		len+=z;
		v[i]=string(z,bet[i]);
	}
	while(v.size()>1){
		sort(all(v),[](string a,string b){return a.size()>b.size();});
		while(v.back().empty())v.pop_back();
		if(v.size()==1)break;
		string q,x=v.back(),y=*(v.rbegin()+1),z;
		v.pop_back(),v.pop_back();
		while(!x.empty()&&!y.empty()){
			if(!x.empty())q=y+x.back()+z;
			if(!x.empty()&&(Q(q)==len-q.size())){
				z=x.substr(x.size()-1,1)+z;
				x=x.substr(0,x.size()-1);
			}else{
				z=y.substr(y.size()-1,1)+z;
				y=y.substr(0,y.size()-1);
			}
		}
		z=x+y+z;
		v.push_back(z);
	}
	printf("! %s\n",v[0].c_str()); 
	fflush(stdout);
	return 0; 
}


Measured memory_bytes: 3780
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
l = []
for i in range(N):
  l.append(LIST())
L = []
for i in range(N):
  b = l[i][0] - l[i][1]
  a = l[i][0] + l[i][1]
  L.append([a, b])
L.sort()
# print(L)
t = -INF
ans = 0
for i in range(N):
  if t <= L[i][1]:
    ans += 1
    t = L[i][0]
print(ans)


Measured memory_bytes: 44084
import java.io.PrintWriter
import java.util.*

fun main(args: Array<String>) = IO().exec {
    val n = int()
    val s = string()
    var left = 0
    var right = 0
    for (i in s.indices) {
        if (s[i] == '(') left++ else if (left > 0) left--
    }
    for (i in n-1 downTo 0) {
        if (s[i] == ')') right++ else if (right > 0) right--
    }

    val sb = StringBuilder()
    sb.append("(".repeat(right))
    sb.append(s)
    sb.append(")".repeat(left))
    println(sb)
}

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = PrintWriter(System.out)
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = System.`in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun string(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun long(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun double(): Double {
        return string().toDouble()
    }
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}

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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        //各位の和の取り方
        int num = i;
        int sum = 0;
        for(int j = 0; j < 5; j++){
            sum += num % 10;
            num /= 10;
        }
        if(sum <= B && sum >= A){
            ans += i;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
string S;
int main(){

  int N; cin >> N;
  vector<int> H(N);  int max_height = 0; bool flag = true;
  for(int i = 0; i < N; i++){
    int h ; cin >> h; H[i] = h; max_height = max(max_height , h);
    if( max_height - h >= 2){  flag = false; break;}
  }
  
  if( flag){ S = "Yes";}else{S = "No";}
  cout<< S << endl; return 0;}
    

Measured memory_bytes: 640
alpha = input()

Big = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

if alpha in Big:
    print("A")
else:
    print("a")

Measured memory_bytes: 8920
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  set<ll> st;
  REP(i,n){
    ll a;
    cin >> a;
    if(st.find(a)==st.end()){
      st.insert(a);
    }else{
      st.erase(a);
    }
  }
  cout << st.size() << endl;
  return 0;
}


Measured memory_bytes: 4864
def solve():
    N, K, *A = map(int, open(0).read().split())

    if (N - 1) % (K - 1) == 0:
        ans = (N - 1) // (K - 1)
    else:
        ans = (N - 1) // (K - 1) + 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 13940
N = gets.to_i
Xs = gets.split.map(&:to_i)
list = []
Xs.each_with_index{|x,i|
    list.push([i,x])
}
list.sort_by!{|_,i| i}
hash = {}
index = N / 2
N.times{|i|
    k, v = list[i]
    if i < index
        hash[k] = list[index]
    else
        hash[k] = list[index-1]
    end
}

N.times{|i|
    k, v = hash[i]
    puts "#{v}"
}

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

int main(){
  int A;
  int B;
  int ans = 0;
  int plg = 1;
  
  cin >> A >> B;

  while(plg < B){
    ans++;
    plg += (A-1);

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()



int main (void) {
  int N; std::cin >> N;
  std::vector<int> Au(N), Su(N);
  for(int i=0; i<N; i++) {
    std::cin >> Au[i];
    if( i != 0 ) Su[i] = Su[i-1] + Au[i];
    else Su[i] = Au[i];
  }

  std::vector<int> Ad(N), Sd(N);
  for(int i=0; i<N; i++) {
    std::cin >> Ad[i];
    if( i != 0 ) Sd[i] = Sd[i-1] + Ad[i];
    else Sd[i] = Ad[i];
  }

  int max = -1;
  for(int i=0; i<N; i++) {
    int tmp;
    if ( i == 0 ) tmp = Su[0] + Sd[N-1];
    else tmp = Su[i] + (Sd[N-1] - Sd[i-1]);
    max = std::max(tmp, max);
  }
  std::cout << max << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;



void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        a[i] -= i;
    }
    if (a[0] != 0) {
        printf("-1\n"); return;
    }
    for (i = 1; i < n; i++) {
        if (a[i] > a[i - 1]) {
            printf("-1\n"); return;
        }
    }
    ll sum = 0;
    int curr = -INF;
    for (i = n - 1; i > 0; i--) {
        a[i] = MAX(a[i], curr);
        if (a[i] > curr) {
            if (-a[i] > i) {
                printf("-1\n"); return;
            }
            sum += (i - (-a[i]));
            curr = a[i];
        }
    }
    printf("%lld\n", sum);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


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

int main(){
  int A[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  
  cout << A[K - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 bool Four=false;
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
  string S;
    cin >> S;
    if(S == "Y"){
    Four =true;
      break;
    } 
  }
  if(Four){cout << "Four" <<endl;}
  else {cout << "Three"<<endl;}
  
}

Measured memory_bytes: 256
#include "stdio.h"
 
int main(void){
  int N,K;
  scanf("%d %d",&N, &K);
  
  char S[N];
 
  scanf("%s",S);
   
  K-=1;
 
  S[K]= S[K]+0x20;
  
  printf("%s", S);
}

Measured memory_bytes: 128
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut aa: [usize; n],
    }

    aa.sort();

    let mut ans = n;
    let mut count = 1;
    let mut sum = 0;
    for i in 0..n-1 {
        sum += aa[i];

        if aa[i+1] <= 2 * sum {
            count += 1;
        } else {
            ans -= count;
            count = 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4196
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int N, Q;
    string S;
    cin >> N >> Q;
    cin >> S;
    vector<int> cnt(N);
    bool a = (S[0] == 'A');
    for (int i = 1; i < N; i++) {
        // cout << cnt[i-1];
        if (S[i] == 'A') {
            a = true;
            cnt[i] = cnt[i-1];
            continue;
        }
        if (a && S[i] == 'C') {
            cnt[i] = cnt[i-1] + 1;
        } else {
            cnt[i] = cnt[i-1];
        }
        a = false;
    }
    int l, r;
    for (int j = 0; j < Q; j++) {
        cin >> l >> r;
        l--; r--;
        int result = cnt[r];
        if (l > 0) {
            if (cnt[l] > cnt[l-1]) {
                result -= cnt[l];
            } else {
                result -= cnt[l-1];
            }
        }
        cout << result << endl;
    }

    return 0;
}


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

using namespace std;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  void unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x != y) {
      if(data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

int main()
{
  int N, W, H;
  int xs[100000], ys[100000];
  memset(xs, -1, sizeof(xs));
  memset(ys, -1, sizeof(ys));

  scanf("%d %d %d", &N, &W, &H);
  bool ei = false;
  UnionFind tree(N);
  for(int i = 0; i < N; i++) {
    int X, Y;
    scanf("%d %d", &X, &Y);
    --X, --Y;
    if(~xs[X]) tree.unite(xs[X], i);
    else xs[X] = i;
    if(~ys[Y]) tree.unite(ys[Y], i);
    else ys[Y] = i;
    ei |= X == 0 || Y == 0 || X == W - 1 || Y == H - 1;
  }
  int cnt = 0;
  for(int i = 0; i < N; i++) cnt += tree.find(i) == i;
  int ret = N - cnt;
  if(cnt > 1) ret += cnt * 2 - 1 - ei;
  printf("%d\n", ret);
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

  using P = pair<int, int>;
  using P3 = pair<string, P>;
  vector<P3> A(N);
  for ( int i = 0; i < N; i++ ) {
    cin >> A[i].first >> A[i].second.first;
    A[i].second.first *= -1;    
    A[i].second.second = i+1;
  }

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
long long n, m, sum = 0;
int main() {
    std::cin >> n >> m;
    long long k = m / 2;
    if (k <= n) {
        sum += k;
        m -= (k*2);
    }
    else {
        sum += n;
        m -= (n*2);
    }
    sum += (m / 4);
    std::cout << sum << std::endl;
}


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

void main_()
{
    int N;
    cin >> N;
    vector<int> Hs;
    Hs.reserve(N);
    copy_n(istream_iterator<int>(cin), N, back_inserter(Hs));

    vector<int> cs;
    cs.reserve(N);
    transform(
        begin(Hs), end(Hs) - 1,
        begin(Hs) + 1, back_inserter(cs),
        [cont = 0](auto a, auto b) mutable {
            cont = (a >= b) ? cont + 1 : 0;
            return cont;
        });

    cout << (cs.size() > 0 ? *max_element(begin(cs), end(cs)) : 0) << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


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

using namespace std;

bool isTheSame(string s, int i) {
    return s.at(i) == s.at(i + 1);
}

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    s.push_back('!');
    int count = 0;
    for (int i = 0; i < n; ++i) {
        if (isTheSame(s, i)) {
            // do nothing
        } else {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

const int max_n = 52;
const unsigned int mod = 1000000007;

char s[2][max_n + 1];
unsigned int memo[max_n + 1][0X40];
int n;

unsigned int patterns() {
	int i = 0;

	memo[0][0X0] = 1;
	while (i < n) {
		int length = 1;

		if (s[0][i] != s[1][i]) {
			length = 2;

			for (int used_mask = 0; used_mask < 0X40; used_mask++) {
				unsigned int x = memo[i][used_mask];

				if (x > 0) {
					for (int top = 0; top < 3; top++) {
						for (int bottom = 0; bottom < 3; bottom++) {
							if (top != bottom) {
								int selected_mask = ((1 << top) << 3) | (1 << bottom);

								if ((used_mask & selected_mask) == 0) {
									unsigned int &y = memo[i + length][selected_mask];

									y += x;
									y %= mod;
								}
							}
						}
					}
				}
			}
		}
		else {
			for (int used_mask = 0; used_mask < 0X40; used_mask++) {
				unsigned int x = memo[i][used_mask];

				if (x > 0) {
					for (int vertical = 0; vertical < 3; vertical++) {
						int selected_mask = ((1 << vertical) << 3) | (1 << vertical);

						if ((used_mask & selected_mask) == 0) {
							unsigned int &y = memo[i + length][selected_mask];

							y += x;
							y %= mod;
						}
					}
				}
			}
		}

		i += length;
	}

	unsigned int result = 0;
	for (int m = 0; m < 0X40; m++) {
		result += memo[n][m];
		result %= mod;
	}

	return result;
}

int main() {

	cin >> n >> s[0] >> s[1];
	cout << patterns() << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define pb push_back
typedef vector<int> vi;
#define mod 1000000007
#define maxn 100005
int dp[101][maxn];
int32_t main() {
   int n,W;
   cin>>n>>W;
   for(int i=0;i<101;i++)
   for(int j=0;j<maxn;j++)
   dp[i][j]=INT_MAX;
   for(int i=0;i<101;i++)
   dp[i][0]=0;
   vi wt(n+1),val(n+1);
   for(int i=1;i<=n;i++)
   cin>>wt[i]>>val[i];
   int ans=INT_MIN;
   for(int i=1;i<=n;i++)
   {   
       for(int j=1;j<maxn;j++)
       {
           if(val[i]>j)
           dp[i][j]=dp[i-1][j];
           else
           {
            dp[i][j]=min(dp[i-1][j-val[i]]+wt[i],dp[i-1][j]);
           }
        if(dp[i][j]<=W)
        ans=max(ans,j);
       }
   }
   cout<<ans;
    return 0;
}


Measured memory_bytes: 82516
N = int(input())
* A, = map(int, input().split())


def judge(A):
    for a in A:
        if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
            return False
    return True


R = judge(A)
if R:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 2940
n,m,q=map(int,input().split())
lis=[]
for i in range(q):
    a,b,c,d=map(int,input().split())
    lis.append((a,b,c,d))
    
from itertools import combinations_with_replacement

co=list(combinations_with_replacement(range(1,m+1),n))

ans=0
for status in co:
    tmp_score=0
    for a,b,c,d in lis:
        if status[b-1]-status[a-1]==c:
            tmp_score+=d
    ans=max(ans,tmp_score)
print(ans)


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

int main()
{
    ll a;
    cin>>a;
    ll c=0;
    ll x=100;
    while(x<a)
    {
        x+=(x*1/100);
        c++;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

/////////////         qsortのラッピング

int qsort_int_compare_ascend(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int qsort_int_compare_descend(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
void ascendOrder(int size, int *array) {//昇順
	qsort(array, size, sizeof(int), qsort_int_compare_ascend);
}
void descendOrder(int size, int *array) {//降順
	qsort(array, size, sizeof(int), qsort_int_compare_descend);
}
int qsort_long_compare_ascend(const void *a, const void *b) {//long型
	long c = *(long*)a - *(long*)b;
	if (c > 0) { return 1; }
	else if (c < 0) { return -1; }
	return 0;
}
int qsort_long_compare_descend(const void *a, const void *b) {//long型
	long c = *(long*)b - *(long*)a;
	if (c > 0) { return 1; }
	else if (c < 0) { return -1; }
	return 0;
}
void ascendOrder(int size, long *array) {//昇順
	qsort(array, size, sizeof(long), qsort_long_compare_ascend);
}
void descendOrder(int size, long *array) {//降順
	qsort(array, size, sizeof(long), qsort_long_compare_descend);
}

int main() {
	long N; cin >> N;
	long *A = new long[N];
	long *B = new long[N];

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

	ascendOrder(N, A);

	B[0] = A[0];
	for (int i = 1; i < N; i++) {
		B[i] = B[i - 1] + A[i];
	}

	int n = 1;
	for (int i = N - 1; i > 0; i--) {
		if (B[i - 1] * 2 < A[i]) {
			cout << n << endl;
			return 0;
		}
		n++;
	}

	cout << N << endl;

	return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  if(S.at(0)=='R' || S.at(1)=='R' || S.at(2)=='R'){
    cnt =1;
  }
  if(S.at(0)=='R'&&S.at(1)=='R'||S.at(1)=='R'&&S.at(2)=='R'){
    cnt = 2;
  }
  
  if(S.at(0)=='R'&&S.at(1)=='R'&&S.at(2)=='R'){
    cnt = 3;
  }
  
  cout << cnt << endl;
}

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

typedef long long ll;

int main() {
  int n; cin >> n;
  vector<int> A(n);
  map<int, int> counter;

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

  ll total = 0;
  for (auto iter = counter.begin(); iter != counter.end(); iter++) {
    total += (ll)(iter->second / 2.0 * (iter->second - 1));
  }

  for (int i = 0; i < n; i++){
    cout << total - counter[A[i]] + 1 << endl;
  }
}

Measured memory_bytes: 8320
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;

class Dice {
    public:
        int s1, s2, s3, s4, s5, s6, tmp;
        Dice(int array[6]){
            s1 = array[0];
            s2 = array[1];
            s3 = array[2];
            s4 = array[3];
            s5 = array[4];
            s6 = array[5];
        }
        
        void N(){
            tmp = s1;
            s1 = s2;
            s2 = s6;
            s6 = s5;
            s5 = tmp;
        }   
        void E(){
            tmp = s1;
            s1 = s4;
            s4 = s6;
            s6 = s3;
            s3 = tmp;
            
        }
        void W(){
            tmp = s1;
            s1 = s3;
            s3 = s6;
            s6 = s4;
            s4 = tmp;
        }
        void S(){
            tmp = s1;
            s1 = s5;
            s5 = s6;
            s6 = s2;
            s2 = tmp;
        }
        int show_top(){
            return s1;
        }
};

int main(void){
    int nums[6];
    string order;
    for(int i = 0; i<6;i++ ){
        cin >> nums[i];
    }
    Dice dice(nums);
    cin >> order;
    for(int i = 0; i < order.size(); i++){
        if(order[i] == 'N') dice.N();
        if(order[i] == 'E') dice.E();
        if(order[i] == 'W') dice.W();
        if(order[i] == 'S') dice.S();
    }
    cout << dice.show_top() << endl;
    return 0;
}


Measured memory_bytes: 3184
#include <complex>
#include <vector>
#include <cstdio>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

typedef vector<P> G;

struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};

int main(){
	double x,y;
	int q;
	scanf("%lf%lf",&x,&y);P p0(x,y);
	scanf("%lf%lf%d",&x,&y,&q);P p1(x,y);
	for(;q--;){
		scanf("%lf%lf",&x,&y);P p(x,y);
		P t=(p1-p0)*dot(p1-p0,p-p0)/norm(p1-p0)+p0;
		printf("%.9f %.9f\n",real(t),imag(t));
	}
}

Measured memory_bytes: 1112
#include<cstdio>
#define M 100005
int A[M];
int main(){
	long long sum=0;
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]),sum+=A[i];
	for(int i=2;i<=n;i+=2)sum-=2*A[i];
	printf("%lld ",sum);
	for(int i=1;i<n;i++){
		long long ans=A[i]*2-sum;
		printf("%lld ",ans);
		sum=ans;
	}
	return 0;
}

Measured memory_bytes: 1664
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int tm=scan.nextInt();
		String stmp=scan.nextLine();
		Queue<Integer> q=new LinkedList<>();
		Queue<String> qstr=new LinkedList<>();
		
		for(int i=0;i<n;i++){
			String string=scan.nextLine();
			String[] str=string.split(" ");
			qstr.offer(str[0]);
			q.offer(Integer.parseInt(str[1]));
		}
		int round=0;
		int sum=0;
		while(!q.isEmpty()){
			int tmp=q.poll();
			if(tmp<=tm){
				sum+=tmp;
				System.out.print(qstr.poll()+" ");
				//System.out.println(round*tm+tmp%tm-com);
				System.out.println(sum);
			}
			else {
				q.offer(tmp-tm);
				qstr.offer(qstr.poll());
				sum+=tm;
			}
			round++;
		}
	}

}



Measured memory_bytes: 106776
let () = Scanf.scanf "%d\n%d %d\n" @@ fun n t a ->
  let hs = Array.init n @@ fun i -> Scanf.scanf "%d " @@ fun h -> i, h in
  Printf.printf "%d\n" @@ succ @@ fst @@
  Array.fold_left (fun (i, hi) (j, hj) ->
    if abs (1000 * a - 1000 * t + hi * 6) <= abs (1000 * a - 1000 * t + hj * 6)
    then (i, hi)
    else (j, hj)) hs.(0) hs



Measured memory_bytes: 4608
from sys import stdin


def fun(n, l):
    a = 0
    for i in range(l):
        a += n * (10**i)

    return a


N = stdin.readline().rstrip()

if int(N[0]) < 9:
    a = fun(int(N[0]), len(N))
    if (a >= int(N)):
        print(a)
    else:
        a = fun(int(N[0]) + 1, len(N))
        print(a)
else:
    a = fun(9, len(N))
    if (a >= int(N[0])):
        print(a)
    else:
        a = fun(1, len(N) + 1)
        print(a)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] c = new int[100010];
		for (int i = 0; i < N; i++) {
			int A = sc.nextInt();
			c[A]++;
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < c.length; i++) {
			if (c[i] > 0) {
				cnt++;
			}
		}
		int ans = (cnt % 2 == 0) ? cnt - 1 : cnt;
		System.out.println(ans);
	}
}


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

int main()
{
	int n;
	char str[100000], out[100000];
	char tmp[100000];

	while (cin >> n, n){
		cin >> str;
		for (int i = 0; i < n; i++){
			int cnt = 1;
			out[0] = '\0'; // clean
			for (int j = 0; j < strlen(str); j++){
				if (str[j] == str[j + 1]){
					cnt++;
				}
				else {
					sprintf(tmp, "%d%c", cnt, str[j]);
					strcat(out, tmp);
					cnt = 1;
				}
			}
			strcpy(str, out);
		}
		cout << out << endl;
	}

	return (0);
}

Measured memory_bytes: 1296
let input = require("fs").readFileSync("/dev/stdin", "utf8")

function main({ input, load, yesno, math_sum }) {

    const [N] = load()
    const A = load(N)

    let Ai_max = 1e6
//     for(const a of A) if(a > Ai_max) Ai_max = a

    const nums = new Array(Ai_max + 1).fill(0)

    for(const a of A) nums[a]++

    for(let i = 1; i <= Ai_max; i++) {
        if(!nums[i]) continue
        for(let j = i * 2; j <= Ai_max; j += i) {
            nums[j] = 0
        }
    }

    console.log(nums.filter(n => n === 1).length)
}

let inputs = input.split(/[\s\n]/)
main({
    input,
    yesno: value => value ? 'Yes' : 'No',
    load(rows = 1, cols = 1, is_number = true) {
        const length = rows * cols
        let result = inputs.splice(0, length)
        if(is_number) result = result.map(Number)
        if(cols > 1) {
            const arrays = new Array(cols)
            for(let col = 0; col < cols; col++) {
                arrays[col] = new Array()
                for(let row = 0; row < rows; row++) {
                    arrays[col].push(result[row * cols + col])
                }
            }
            result = arrays
        }
        return result
    },
    inifinite_loop_preventer() {
        throw new Error("Infinite loop")
    },
    math_sum(numbers) {
        return numbers.reduce((acc, cur) => acc + cur, 0)
    },
})


Measured memory_bytes: 66548
import sys


def sum(tree, i):
    s = 0
    while i > 0:
        s += tree[i]
        i -= i & -i
    return s


def add(tree, size,  i, x):
    while i <= size:
        tree[i] += x
        i += i & -i


def range_sum(tree, l, r):
    return sum(tree, r) - sum(tree, l)


def main():
    n, q = map(int, sys.stdin.buffer.readline().split())

    bit = [0] + list(map(int, sys.stdin.buffer.readline().split()))
    for i in range(1, n+1):
        if i + (i & -i) < n + 1:
            bit[i + (i & -i)] += bit[i]

    for y in sys.stdin.buffer.readlines():
        q, p, x = map(int, y.split())
        if q:
            print(range_sum(bit, p, x))
        else:
            add(bit,n, p+1, x)


if __name__ == "__main__":
    main()


Measured memory_bytes: 172576
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int a,b,c;


signed main(void) {
    cin >> a >> b >> c;

    if((a<c && b>c)||(a>c && b <c)){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000000007;
ll INF = 1000000099;

signed main(){
    ll n,m,ans=0;
    cin>>n>>m;

    priority_queue<pair<ll,ll>> q;//値、個数の順で入れておけば値順にソートされる

    for(ll i=0;i < n;i++)
    {
        ll x;
        cin>>x;
        q.emplace(x,1);
    }

    for(ll i=0;i < m;i++)
    {
        ll x,y;
        cin>>x>>y;
        q.emplace(y,x);
    }
    ll cnt=0;
    for(int i=0;i < n;i++)
    {
        ll a=q.top().fi,b=q.top().se;
        q.pop();
        
        ans+=a*min(b,n-cnt);
        cnt+=b;
        if(n-cnt<=0){
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 6512
#include<iostream>
using namespace std;
#include<stdio.h>

int main()
{
    int n, m, i, j, a, w;
    int* adj[100];
    int* dist[100];
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d %d", &i, &m);
        adj[i] = new int [m + 1];
        dist[i] = new int [m + 1];
        for(j = 0; j < m; j++){
            scanf("%d %d", &a, &w);
            adj[i][j] = a;
            dist[i][j] = w;
        }
        adj[i][m] = -1;
        dist[i][m] = -1;
    }
    int *d, *prev, *Q;
    d = new int [n];
    prev = new int [n];
    Q = new int [n];
    for(i = 0; i < n; i++){ d[i] = 200000; prev[i] = -1; Q[i] = i; }
    int rest = n;

    int u, v, min;
    d[0] = 0;
    while(rest > 0){
        min = 200000;
        for(i = 0; i < n; i++){
            if(min > d[i] && Q[i] >= 0){ min = d[i]; u = i; }
        }
        Q[u] = -1;
        rest--;

        for(j = 0; adj[u][j] >= 0; j++){
            v = adj[u][j];
            if(d[v] > d[u] + dist[u][j]){
                d[v] = d[u] + dist[u][j];
                prev[v] = u;
            }
        }
    };
    for(i = 0; i < n; i++){ printf("%d %d\n", i, d[i]); }
    for(i = 0; i < n; i++){
        delete adj[i]; delete dist[i]; }
    delete d;
    delete prev;
    delete Q;
 
    return 0;
}

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


int main(){
  int n,m; cin>>n>>m;
  vector<ll> dp(n+1,0);
  rep(i,m){
    int a; cin>>a;
    dp[a]=-1;
  }
  dp[0]=1;
  for(int i=1;i<=n;i++){
    if(dp[i]<0) continue;
    if(0<=i-1&&0<=dp[i-1])
    dp[i]+=dp[i-1];
    if(0<=i-2&&0<=dp[i-2])
    dp[i]+=dp[i-2];
    dp[i]%=INF;
  }
  cout<<dp[n]<<endl;
  // rep(i,n+1){
  //   cout<<dp[i]<<(i==n?"\n":" ");
  // }

}


Measured memory_bytes: 1024
let n = read_int ()
let cs, a_s = Array.(make (n + 1) 0, init n @@ fun _ -> Scanf.scanf " %d" (+) 0)
let _ = for i = n downto 1 do for k = 2 to n / i do cs.(i) <- cs.(i) lxor cs.(k * i) done; cs.(i) <- cs.(i) lxor a_s.(i - 1) done; Array.(print_int (fold_left (+) 0 cs); iteri (fun i c -> if c = 1 then Printf.printf (if i = 1 then "\n%d" else " %d") i) cs); print_newline ()

Measured memory_bytes: 6912