akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,M;
  cin>>N>>M;
  vector<bool>oks(N+1,true);
  rep(i,M){
    int a;
    cin>>a;
    oks[a]=false;
  }
  vector<ll>dp(N+1);
  dp[0]=1;
  rep(now,N){
    FOR(next,now+1,min(N,now+2)+1){
      if(oks[next]){
        dp[next]+=dp[now];
        dp[next]%=mod;

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


}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

using namespace std;

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

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	string s;
	bool ans = false;
	int a, b, c;
	cin >> s;
	map<char, int>m;
	for (auto ss : s)m[ss]++;
	a = m['a'];
	b = m['b'];
	c = m['c'];
	int sum = a + b + c,sl = s.size();
	if (sl == 2) {
		if (a != 2 && b != 2 && c != 2)ans = true;
	}
	else if (sl == 3) {
		if (a != 0 && b != 0 && c != 0)ans = true;
	}else{
		if (abs(a - b) < 2 && abs(a - c) < 2 && abs(b - c) < 2)ans = true;
	}

	if (ans) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}



Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin>>N>>K;
  vector<int> prices(N);
  for (int i=0; i<N; i++){
    cin>>prices.at(i);
  }
  sort(prices.begin(), prices.end());
  int sum=0;
  for (int i=0; i<K; i++){
    sum+=prices.at(i);
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3572
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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



int main(){
    int n, q; cin >> n >> q;
    vector<priority_queue<int>> A(n);
    REP(i, q){
        int op; cin >> op;
        int d, x;
        switch(op){
            case 0:
                cin >> d >> x;
                A[d].push(x);
                break;
            case 1:
                cin >> d;
                if(!A[d].empty())
                    cout << A[d].top() << "\n";
                break;
            case 2:
                cin >> d;
                if(!A[d].empty())
                    A[d].pop();
        }
    }
    return 0;
}



Measured memory_bytes: 4100
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]

a_ = [0]

for i in range(n):
    a_.append(a_[i] + a[i])

cnt = 0

def sum(i):
    return i * (i-1) // 2

for i in Counter(a_).values():
    cnt += sum(i)

print(cnt)

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

using namespace std;

vector< vector<int> > ice(90, vector<int>(90));

int m, n;

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

int dfs(int i, int j, int count) {
	if (i < 0 || n <= i || j < 0 || m <= j || ice[i][j] == 0) return 0;
	ice[i][j] = 0;
	int ret = count;
	for (int k=0; k<4; ++k) {
		ret = max(ret, dfs(i + dy[k], j + dx[k], count + 1));
	}
	ice[i][j] = 1;
	return ret;
}

int main() {
    ios::sync_with_stdio(false);
	while (cin >> m >> n && m && n) {
		for (int i=0; i<n; ++i) {
			for (int j=0; j<m; ++j) {
				cin >> ice[i][j];
			}
		}
		int ans = 0;
		for (int i=0; i<n; ++i) {
			for (int j=0; j<m; ++j) {
				ans = max(ans, dfs(i, j, 1));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int d;
    cin >> d;
    int c[26],s[370][26];
    for (int i = 0;i < 26;++i) cin >> c[i];
    for (int i = 0;i < d;++i) for (int j = 0;j < 26;++j) cin >> s[i][j];
    for (int i = 0;i < d;++i) cout << i%26+1 << newl;
}

Measured memory_bytes: 3668
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
// ----GCC ONLY---- //
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// ----        ---- //
#define ll long long
#define MOD 10000007
#define PB push_back

using namespace std;



int main(){

    ll a,b,k;
    cin >> a >> b >> k;

    if(a >= k){
        cout << a - k << " " << b <<endl;
    }else if(a < k && a + b >= k){
        cout << 0 << " " << b - (k - a) <<endl;
    }else {
        cout << 0 <<" "<< 0 <<endl;
    }

}

Measured memory_bytes: 256
import os
import sys
from collections import Counter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
A = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

A = np.array(A, dtype=int)
idx = np.zeros(N, dtype=int)
used = np.zeros(M + 1, dtype=bool)

ans = INF
for _ in range(M):
    k, cnt = Counter(A[np.arange(N), idx]).most_common(1)[0]
    ans = min(ans, cnt)
    used[k] = True
    for i in range(N):
        while idx[i] < M and used[A[i, idx[i]]]:
            idx[i] += 1
print(ans)


Measured memory_bytes: 13912
n=int(input())
v=input()
d=input()
v=v.split()
d=d.split()
for i in range(n):
    v[i]=int(v[i])
    d[i]=int(d[i])
ans=0
for j in range(n):
   if v[j]-d[j]>0:
     ans=ans+v[j]-d[j]
print(ans)

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", (a - 1) * (b - 1));
}


Measured memory_bytes: 4352
import java.util.*;

class Main{

    public static int gyo,retu;
    //yªô©ï©ÉæÁÄdx,dyÍÏíé
    //(1,1)ÌyÍïÈÌÅdx[1][],dy[1][]ðg¤
    //±ÌÆ«Édx[0][],dy[0][]ðgÁÄµÜ¤Æ(2,2)ðÝÈ¢Å(0,2)ðÝÄµÜ¤
  
    public static int[][] dx={{1,0,-1,0,-1,-1},{1,0,-1,0,1,1}};
    public static int[][] dy={{0,1,0,-1,1,-1},{0,1,0,-1,-1,1}};
    public static int[][] map = new int[105][105]; 

    public static void main(String[] args){

	Scanner in = new Scanner(System.in);

	retu = in.nextInt();
	gyo = in.nextInt();

	for(int i=0;i<=gyo+1;i++){
	    for(int j=0;j<=retu+1;j++)map[i][j]=0;
	}
	
	//System.out.println("Hello, World!");
	for(int i=1;i<=gyo;i++){
	    for(int j=1;j<=retu;j++)map[i][j]=in.nextInt();
	}		

	System.out.println(dfs(0,0));

    }

    public static int dfs(int x,int y){
	map[y][x]=9; //fobOÅ©â·¢æ¤É9Æµ½
	int nx,ny,ans=0;
	/*
	for(int f=0;f<10;f++){
	    for(int g=0;g<10;g++)System.out.print(map[f][g] + " ");
	    System.out.printf("\n");
	}
	*/

	for(int i=0;i<6;i++){
	    nx = x + dx[y%2][i];
	    ny = y + dy[y%2][i];
	    if(nx > retu+1 || ny > gyo+1 || nx<0 || ny<0)continue;

	    if(map[ny][nx] == 1)ans++;
	    else if(map[ny][nx] == 0)ans += dfs(nx,ny);

	}

	return ans;
    }



}

Measured memory_bytes: 13000
function ChangeshortText(text) {
    var sendText = '';
	switch (text) {
      case 'A':
        sendText = 'a';
   	 	break;
      case 'B':
        sendText = 'b';
   	 	break;
      case 'C':
        sendText = 'c';
   	 	break;
      default:
    }
	return sendText;
}

function strIns(str, idx, val){
  var res = str.slice(0, idx) + val + str.slice(idx);
  return res;
}

function strDel(str, idx){
  var res = str.slice(0, idx) + str.slice(idx + 1);
  return res;
}

function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	var number = tmp[0];
    var number2 = tmp[1];

	var String = input[1];
  	var changeChar = ChangeshortText(String.charAt(number2 - 1));
  	var inputText = strDel(String, number2 - 1);
	inputText = strIns(inputText, number2 - 1, changeChar);
	//出力
	console.log(inputText);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
int main() {
	int k;
	cin >> k;
	string s;
	cin >> s;
	if (s.size() <= k) {
		cout << s << endl;
	}
	else{
		cout << s.substr(0, k) << "..."<< endl;
	}
	
	return 0;
}



Measured memory_bytes: 3632
#include <bitset>
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);

const int N = 85;
int a[N][N];
int n, m;

void init() {
    scanf(II,&n,&m);
    rep (i,n) rep (j,m) scanf(I,&a[i][j]);
    rep (i,n) rep (j,m) a[i][j] -= sc.nextInt();
    rep (i,n) rep (j,m) a[i][j] = abs(a[i][j]);
}

const int M = 6500;
bitset < M*2 > r[N][N];

void solve() {
    r[0][0] |= (bitset<M*2>(1)<<(a[0][0]+M));
    r[0][0] |= (bitset<M*2>(1)>>(a[0][0]+M));
    repa (i,m-1) r[0][i] = ((r[0][i-1] << a[0][i]) | (r[0][i-1] >> a[0][i]));
    repa (i,n-1) rep (j,m) {
        if (j) r[i][j] |= ((r[i][j-1] << a[i][j]) | (r[i][j-1] >> a[i][j]));
        r[i][j] |= ((r[i-1][j] << a[i][j]) | (r[i-1][j] >> a[i][j]));
    }
    int ans = M;
    rep (i,M*2) if (((r[n-1][m-1] >> i) & bitset < M*2 > (1)) != bitset<M*2>(0)) checkMin(ans, abs(M-i));
    printf(IN,ans);
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
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; }

int n, m, q;
vector<int> a(55, 0);
vector<int> b(55, 0);
vector<int> c(55, 0);
vector<long long> d(55, 0);
vector< vector<int> > ansvec;

void dfs(int pre, int now, vector<int> &vec) {
    long long ans = 0;
    if(now == n) {
        ansvec.emplace_back(vec);
        return ;
    }
    for(int i = pre; i <= m; ++i) {
        vec.at(now) = i;
        dfs(i, now+1, vec);
    }
}


int main() {
    cin >> n >> m >> q;
    for(int i = 0; i < q; ++i) {
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
        a.at(i)--; b.at(i)--;
    }

    vector<int> A(10, 0);
    dfs(1, 0, A);
    
    long long mans = 0;
    for(int i = 0; i < ansvec.size(); ++i) {
        long long ans = 0;
        for(int j = 0; j < q; ++j) {
            if(ansvec.at(i).at(b.at(j)) - ansvec.at(i).at(a.at(j)) == c.at(j)) ans += d.at(j);
        }
        chmax(mans, ans);
    }
    cout << mans << endl;
}

Measured memory_bytes: 9776
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		
		int count_s=0; 
		int count_t=0;
		int ans=0;
		for(int i=0;i<x.length();i++){
			if(x.charAt(i)=='S')count_s++;
			
			if(count_s>0){
				if(x.charAt(i)=='T'){
					count_s--;
				}
			}else{
				if(x.charAt(i)=='T'){
					ans++;
				}
			}
		}
		System.out.println(ans*2);
	}
}


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

Measured memory_bytes: 3588
fn main() {
    proconio::input! {
        a: i32,
        b: i32,
        c: i32,
        d: i32,
    }
    let f = |x,y| (x+y-1)/y;
    println!("{}",if f(a,d)<f(c,b) {"No"} else {"Yes"});
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class T> void print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec); } }
const int INF = 1e9;
const int MOD = 1e9+7;

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

	int h, w; cin >> h >> w;
	if (h==1 || w==1) {
		cout << 1 << endl;
		return 0;
	}

	ll odd = (w+1LL)/2LL , even = w/2LL;
	ll ans = (odd+even) * (h/2LL);
	if (h%2!=0) ans += odd;

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int N;
    cin >> N;


    int ans = 0;
    FOR(i, 1, N) {
        if (i % 2 == 0) continue;
        int cnt = 0;
        FOR(j, 1, i) {
            if (i % j == 0) cnt++;
        }
        if (cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;


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

   int N;
   cin>>N;

   vector<bool>era(N+1,true);
   era[0] = era[1] = false;
   for(int i=0;i<=N;i++){
      if(era[i]){
         for(int j=i*2;j<=N;j+=i)era[j] = false;
      }
   }

   vector<int>prime;
   for(int i=0;i<=N;i++){
      if(era[i])prime.push_back(i);
   }

   map<int,int>e;
   for(int i=2;i<=N;i++){
      int n = i;
      for(auto it:prime){
         while(n%it == 0){
            n/=it;
            e[it]++;
         }
         if(n==1)break;
      }
   }

   //for(auto it:e)cout<<it.second<<endl;

   ll two = 0;
   ll three = 0;
   ll four = 0;
   ll one_four = 0;
   ll two_four = 0;
   ll seven_four = 0;
   ll ans = 0;
   for(auto it:e){
     if(it.second >= 2)two++; 
     if(it.second >= 3)three++; 
     if(it.second >= 4)four++;
     if(it.second >= 14)one_four++; 
     if(it.second >= 24)two_four++; 
     if(it.second >= 74)seven_four++; 
   }

   vector<vector<ll> >nCr(N+1,vector<ll>(N+1,0));
   for(int i=0;i<=N;i++){
      for(int j=0;j<=i;j++){
         if(i==j)nCr[i][j] = 1;
         else if(j==0)nCr[i][j] = 1;
         else nCr[i][j] = nCr[i-1][j-1] + nCr[i-1][j];
      }
   }

   /*
   for(int i=0;i<=N;i++){
      for(int j=0;j<=i;j++){
         cout<<nCr[i][j]<<" ";
      }
      cout<<endl;
   }
   */
   //4 4 2
   if(four>=2&&two-2>0)ans += nCr[four][2]*(two-2);
   //24 2
   if(two_four>0&&two-1>0)ans += two_four*(two-1);
   //14 4
   if(one_four>0&&four-1>0)ans += one_four*(four-1);
   //74
   if(seven_four>0)ans += seven_four;

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


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

int main() {
  ll l, r;
  cin >> l >> r;
  r = min(r, l+2019);
  int ans = 2020;
  for (ll i=l; i <= r; i++) {
    for (ll j=i+1; j <= r; j++) {
      int x = i*j%2019;
      ans = min(ans, x);
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
N = int(input())
TS = []
for _ in range(N):
    X,L = map(int, input().split())
    TS.append([X,L])

mlist=[]
for i in range(N):
    mlist.append([TS[i][0] + TS[i][1], TS[i][0] - TS[i][1]])

mlist.sort()

cur = -10**10
ans=0
for i in range(N):
    if mlist[i][1] >= cur:
        ans+=1
        cur = mlist[i][0]
print(ans)


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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, P;
    cin >> N >> P;

    if(N==1){
        cout<<P<<endl;
        return 0;
    }

    ll n = 1;
    ll tmp = 2;
    while( pow(tmp,N) <= P*2 ){
        ll c = 0;
        while(P%tmp==0){
            c++;
            P/=tmp;
        }
        if(c>=N){
            for(ll i=0;i<(c/N);i++) n*= tmp;
        }
        tmp++;
        if(tmp%2==0) tmp++;
    }
    cout<<n<<endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define  _CRT_SECURE_NO_DEPRECATE
using namespace std;
#define maxv 100005
#define che 1LL<<32
#define modi 1000000007
int main()
{
    ll w,h,x,y;
    cin>>w>>h>>x>>y;
    if(x*2==w&&y*2==h)
    {
        cout<<fixed<<setprecision(15)<<(double)(w*h)/2.0<<" 1"<<endl;
    }
    else
        cout<<fixed<<setprecision(15)<<(double)(w*h)/2.0<<" 0"<<endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long ull;
typedef long long ll;

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

using namespace std;

typedef pair<int ,int > P;


int main()
{
	int n;

	while(cin>>n)
	{
		int m=100000;

		rep(i,n)
		{
			m*=1.05;
			if(m%1000!=0)
			{
				m-=m%1000;
				m+=1000;
			}

		}
		cout<<m<<endl;

	}
	


	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int n,g[100][100],c[100],f[100],e[100],t=1;
void dfs(int now){
  c[now]=1;
  f[now]=t;
  t++;
  for(int i=0;i<n;i++) if(g[now][i]&&c[i]!=1){
      dfs(i);
      t++;
    }
  e[now]=t;
}
int main(){

  int a,b,tmp;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    for(int j=0;j<b;j++){
      cin>>tmp;
      g[a-1][tmp-1]=1;
    }
  }
  for(int i=0;i<n;i++) if(c[i]!=1){
      dfs(i);
      t++;
    }

  for(int i=0;i<n;i++) cout<<i+1<<" "<<f[i]<<" "<<e[i]<<endl;

  return 0;

}

Measured memory_bytes: 3088
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

import bisect
rui=[0]
sm=0
for mid in b:
    ind = bisect.bisect_left(c,mid+1)
    sm+= (n-ind)
    rui.append(sm)

ans=0
for top in a:
    ind = bisect.bisect_left(b,top+1)
    tmp = rui[-1] - rui[ind]
    ans+=tmp
print(ans)

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

using namespace std;
int main(void){
    // Your code here!
  long long n;
  cin>>n;
  vector<long long>moji(n);
  for(long long i=0;i<n;i++){
      cin>>moji.at(i);
  }
  long long sum=0;
  for(long long i=1;i<n;i++){
      if(moji.at(i-1)>moji.at(i)){
          sum+=moji.at(i-1)-moji.at(i);
          moji.at(i)=moji.at(i-1);
      }
  }
  cout<<sum<<endl;
}


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

x = 1
ans = 1
while A[x-1] != 2:
    x = A[x-1]
    ans += 1
    if ans == 10**5:
        ans = -1
        break
    
print(ans)

Measured memory_bytes: 7084
#include<stdio.h>
 typedef long long ll;

 ll a, b;

 ll f(ll x) //从0开始（包括0），每连续的4个数的 异或和 为0
 {
     if(x % 4 == 0)  //位于4个数中的第一位
         return x;
     else if(x % 4 == 1) //位于4个数中的第二位
         return 1;
     else if(x % 4 == 2) //位于4个数中的第三位
         return x + 1;
     else if(x % 4 == 3) //位于4个数中的第四位
         return 0;
 }

 int main()
 {
     scanf("%lld%lld", &a, &b);
     printf("%lld\n", f(b) ^ f(a - 1));
     return 0;
 }

Measured memory_bytes: 1708
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int N = Integer.parseInt(line[0]),
            K = Integer.parseInt(line[1]);
 
        int paint = K;//first ball: K colors
        for(int n=1;n<N;n++) paint *= (K-1);//the others: K-1 colors
        System.out.println(paint);
    }
}

Measured memory_bytes: 8148
#![allow(non_snake_case,unused_imports,dead_code)]
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Reverse,Ordering};
use std::time::{Duration, Instant};
use rand::Rng;
 
use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn main() {
    input!{
        N:usize,
        A:[usize;N],
    }

    let mut all_gcd = A[0];
    for &a in &A[1..]{
        all_gcd = gcd(all_gcd,a);
    }
    if all_gcd != 1{
        println!("not coprime");
        return;
    }

    let mut facs = HashSet::new();
    for &a in &A{
        let mut a = a;
        for i in 2..1_010{
            if a==1 { break;}
            if i*i > a{
                if facs.contains(&a){
                    println!("setwise coprime");
                    return;
                }
                facs.insert(a);
                break;
            }
            if a%i == 0{
                if facs.contains(&i){
                    println!("setwise coprime");
                    return;
                }
                facs.insert(i);
                while a%i == 0{
                    a /= i;
                }
            }
        }

    }

    println!("pairwise coprime");

}

fn gcd(x:usize,y:usize) -> usize{
    if y==0{return x;}
    gcd(y,x%y)
}

fn get_primes(n:usize)->HashSet<usize>{
    //n以下の素数のHashSetを返す
        let mut ret = HashSet::new();
        let mut checked = vec![false;n+1];
        for i in 2..=n{
            if checked[i] {continue;}
            ret.insert(i);
            for j in 1..=(n/i){
                checked[i*j] = true;
            }
        }
        ret
    }


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

int main() {
  int N;
  cin >> N;
  int x;
  x=N%1000;
  
  if(x==0 ||
     x==111 ||
    x==222 ||
    x==333 ||
    x==444  ||
    x==555  ||
    x==666  || 
    x==777  ||
    x==888  ||
    x==999  ){
    cout << "Yes";}
   else if(N%1110 < 10){
     cout << "Yes";}
   else {
     cout << "No";}
           
     
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  private static long f(long val) {
    if (val % 2 == 0) {
      return ((val / 2) % 2) ^ val;
    } else {
      return ((val + 1L) / 2) % 2;
    }
  }
  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long a = Math.max(0L, sc.nextLong() - 1L);
    long b = sc.nextLong();
    System.out.println(f(a) ^ f(b));
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    if(a%b==0) return b;
    else return gcd(b,a%b);
}
int main(){
    
    int n;
    int a[100005];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int l[100005]={},r[100005]={};
    for(int i=0;i<n-1;i++){
        if(i==0){
            l[i] = gcd(a[i],a[i+1]);
        }
        else l[i] = gcd(l[i-1],a[i+1]);
    }
    reverse(a,a+n);
    for(int i=0;i<n-1;i++){
        if(i==0){
            r[i] = gcd(a[i],a[i+1]);
        }
        else r[i] = gcd(r[i-1],a[i+1]);
    }
    reverse(r,r+n-1);
    reverse(a,a+n);
    
    if(n==2){
        cout<<max(a[0],a[1])<<endl;
    }
    else if(n==3){
        cout<<max(gcd(a[0],a[2]),max(l[0],r[1]))<<endl;
    }
    else{
        int ans=0;
        for(int i=0;i<n;i++){
            if(i==0) ans = max(ans,r[1]);
            else if(i==1) ans = max(ans,gcd(a[0],r[2]));
            else if(i==n-2) ans = max(ans,gcd(a[n-1],l[i-2]));
            else if(i==n-1) ans = max(ans,l[i-2]);
            else ans = max(ans,gcd(l[i-2],r[i+1]));
        }
        cout<<ans<<endl;
    }
    
    
    return 0;
}





Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <string>
#include <vector>

using namespace std;
const int MAXN = 100100;

int N, M;
int p[MAXN];
vector <int> edge[MAXN];
int ud[MAXN];
bool seen[MAXN];
int ns;

int ans;
void upd (int x)
{
    if (ud[x] / 10 == ns)
    {
        ud[x]++;
        ans++;
    }
    else
        ud[x] = ns * 10 + 1;
}

void flood (int cloc)
{
    if (seen[cloc])
        return;
    seen[cloc] = true;
    upd(cloc);
    upd(p[cloc]);

    for (int i = 0; i < edge[cloc].size(); i++)
    {
        int neigh = edge[cloc][i];
        flood (neigh);
    }
}

int main()
{
    cin >> N >> M;
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
        p[i]--;
    }

    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    ns = 0;
    for (int i = 0; i < N; i++)
    {
        seen[i] = false;
        ud[i] = -1;
    }

    ans = 0;
    for (int i = 0; i < N; i++)
        if (!seen[i])
        {
            ns++;
            flood (i);
        }

    cout << ans << "\n";
}

Measured memory_bytes: 8576
#include<stdio.h>

int main()
{
	int n[3][3], tc;
	int ctr[9] = {0};
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			scanf("%d", &n[i][j]);
		}
	}
	scanf("%d", &tc);
	int b;
	int temp;
	for(int i = 0; i < tc; i++){
		temp = 0;
		scanf("%d", &b);
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				if(b == n[j][k]){
					++ctr[temp];
				}
				++temp;
			}
		}
	}
	int flag = 0;
	for(int i = 0; i < temp; i++){
		if(ctr[0] > 0 && ctr[1] > 0 && ctr[2] > 0){
			flag = 1;
		}else if(ctr[0] > 0 && ctr[3] > 0 && ctr[6] > 0){
			flag = 1;
		}else if(ctr[3] > 0 && ctr[4] > 0 && ctr[5] > 0){
			flag = 1;
		}else if(ctr[6] > 0 && ctr[7] > 0 && ctr[8] > 0){
			flag = 1;
		}else if(ctr[1] > 0 && ctr[4] > 0 && ctr[7] > 0){
			flag = 1;
		}else if(ctr[2] > 0 && ctr[5] > 0 && ctr[8] > 0){
			flag = 1;
		}else if(ctr[0] > 0 && ctr[4] > 0 && ctr[8] > 0){
			flag = 1;
		}else if(ctr[2] > 0 && ctr[4] > 0 && ctr[6] > 0){
			flag = 1;
		}
	}
	if(flag == 1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

Measured memory_bytes: 1636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

string a;
ll num[27] = { 0 };

int main() {
	cin >> a;
	for (int i = 0; i < a.length(); i++) {
		num[a.at(i) - 'a']++;
	}
	ll res = 0;
	for (int i = 0; i < 26; i++) res += num[i] * (num[i] - 1) / 2;
	cout << 1 + a.length()*(a.length() - 1)/2 - res << endl;
	return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <iomanip>
#include <algorithm>

int n, t[105], v[105];
long double maxv[40005];
int main() {
	std::cin >> n;
	for (int i = 0; i < n; ++i) {
		std::cin >> t[i];
		if (i != 0)
			t[i] += t[i - 1];
	}

	for (int i = 0; i < n; ++i)
		std::cin >> v[i];

	{
		long long tmp = 1;
		for (long long i = 0; i < n; i++) {
			while (tmp < 2 * t[i]) {
				maxv[tmp] = v[i];
				tmp++;
			}
			maxv[tmp] = std::min(v[i], v[i + 1]);
			tmp++;
		}
	}

	for (long long i = 0; i < 2 * t[n - 1]; ++i)
		maxv[i + 1] = std::min(maxv[i] + 0.5, maxv[i + 1]);

	for (long long i = 2 * t[n - 1]; i > 0; --i)
		maxv[i - 1] = std::min({ maxv[i - 1], maxv[i] + 0.5 });

	long double ans = 0;
	for (long long i = 0; i < 2 * t[n - 1]; ++i)
		ans += (maxv[i] + maxv[i + 1]) / 4;

	std::setprecision(15);
	std::cout << std::fixed << ans << std::endl;
	return 0;
}


Measured memory_bytes: 896
#ifndef ONLINE_JUDGE
  #include "Debug.h"
#else
  #define debug(...) 42
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
using ldb = long double;
using pa = pair < int, int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;
int modpow(int x, int y){
    int ans=1;
    if(y==1){
        return x%MOD;
    }
    x=x % MOD;
    y=y % (MOD-1);
    while(y>0){
        if(y & 1){
            ans = (ans*x) %MOD;
        }
        x *= x;
        x = x % MOD;
        y >>= 1;
    }
    return ans;
}

int modinv(int x){
    return modpow(x,MOD-2);
}
int sub(int x, int y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
int add(int x, int y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
int multiply(int a,int b){
    a %= MOD;
    b %= MOD;
    return (a*b)%MOD;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ans = modpow(10ll,n);
    debug(ans);
    ans = sub(ans,modpow(9ll,n));
    debug(ans);
    ans = sub(ans,modpow(9ll,n));
    debug(ans);
    ans = add(ans,modpow(8ll,n));
    cout << ans << "\n";  
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

#define INF (1 << 30)
#define MAX_E 10000
#define MAX_V 1000

struct edge{
	int from;
	int to;
	int cost;
};

edge es[MAX_E];
int d[MAX_V];
int V, E;// V???????????°???E????????°

// O(VE)??§????????????????????????????????§??????

void shortest_path(int s){
	for(int i = 1; i <= V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	while(true){
		bool update = false;
		for(int i = 0; i < E; i++){
			edge e = es[i];
			if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(!update){
			break;
		}
	}
}

int main(){
	
	int n, p;
	
	cin >> n;
	
	int from_, num, to_, length;
	
	V = n;
	
	E = 0;
	
	for(int i = 0; i < n; i++){
		cin >> from_ >> num;
		for(int j = 0; j < num; j++){
			cin >> to_;
			es[E].from = from_;
			es[E].to = to_;
			es[E].cost = 1;
			E++;
		}
	}
	
	cin >> p;
	
	for(int i = 0; i < p; i++){
		cin >> from_ >> to_ >> length;
		shortest_path(from_);
		if(d[to_] < length){
			printf("%d\n", d[to_] + 1);
		}else{
			printf("NA\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1156
H, W, M = map(int, input().split())
R = [0] * H
C = [0] * W
B = []
for i in range(M):
    hi, wi = map(lambda s: int(s) - 1, input().split())
    R[hi] += 1
    C[wi] += 1
    B.append((hi, wi))

Rmax = max(R)
Cmax = max(C)
ans = Rmax + Cmax
if R.count(Rmax) * C.count(Cmax) == sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]):
    ans -= 1

print(ans)


Measured memory_bytes: 56316
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int n;
  cin >> n;
  int a[n + 5];
  rep(i,n){
    cin >> a[i];
  }
  sort(a,a +n);
  int sum = 0, count = 1;
  reps(i,n - 1){
    if(a[i] != a[i - 1]){
      if(count % 2 == 1){
	sum ++;
      }
      count = 1;
    } else {
      count ++;
    }
  }
  if(count % 2 == 1){
    sum ++;
  }
  cout << sum << '\n';
  return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple> 
#include <memory>

using namespace std;

int main() {
	int N, D, X;
	cin >> N >> D >> X;

	vector<int> eatTimes;

	for (int i = 0; i < N; i++) {
		int time = 0;
		cin >> time;
		eatTimes.emplace_back(time);
	}

	int chokoNum = X;

	for (auto& time : eatTimes) {
		for (int i = 0; i < D; i+=time) {
			chokoNum += 1;
		}
	}

	cout << chokoNum;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    int n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    int index = 1;
    while(s.size() != index){
        if(s.at(index - 1) == s.at(index)){
            s.erase(index, 1);
            --index;
        }

        ++index;
    }

    std::cout << s.size() << std::endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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;}
 
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}
void pv(vector<int>&v){
	for(int i = 0;i<v.size();i++){
		if(i)cout<<' ';
		cout<<v[i];
	}
	cout<<endl;
}



signed main()
{
	//IOS();
	int N;
	vector<int>ans;
	while(cin>>N){
		if(N==0)break;
		int ma = -INF,mi = INF,sum = 0;
		rep(i,0,N){
			int t;
			cin>>t;
			chmin(mi,t);
			chmax(ma,t);
			sum+=t;
		}
		ans.push_back((sum-mi-ma)/(N-2));
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}



Measured memory_bytes: 3048
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>

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

using namespace std;

char data[55][55];
char ch[55][55];
int N, M;

bool check(int x, int y){
	for(int i = 0; i < M; i++){
		for(int k = 0; k < M; k++){
			if(data[x + i][y + k] != ch[i][k]) return false;
		}
	}
	return true;
}

int main(){
	bool flag = true;

	cin >> N >> M;
	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			cin >> data[i][k];
		}
	}
	for(int i = 0; i < M; i++){
		for(int k = 0; k < M; k++){
			cin >> ch[i][k];
		}
	}

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			if(data[i][k] == ch[0][0] && check(i, k)){
				cout << "Yes" << endl;
				flag = false;
				break;
			}
		}
		if(!(flag)) break;
	}
	if(flag) cout << "No" << endl;

/*	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			cout << data[i][k];
		}
		cout << endl;
	}
	for(int i = 0; i < M; i++){
		for(int k = 0; k < M; k++){
			cout << ch[i][k];
		}
		cout << endl;
	}*/


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int N;
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout); 
    cin>>N;
    if(N>0&&N<10)
    {
		cout<<N;
		return 0;
	}
    if(N>=10&&N<1000)
    {
    	int y=max(0,N-99);
    	y+=9;
    	cout<<y;
    	return 0;
	}
	if(N>=1000&&N<100000)
	{
		int x=max(0,N-9999);
		x+=909;
		cout<<x;
		return 0;
	}
	if(N==100000)
	{
		cout<<"90909"<<endl;
		return 0; 		
	}
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int sum=0;

  int x;
  for(int i=0;i<m;i++)
  {
    cin>>x;
    sum += x;
  }
 if(sum>n)
   cout<<-1<<endl;
  else
    cout<<n-sum<<endl;
  return 0;
}


Measured memory_bytes: 3624
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

void stmax(string &a,string b){
    if(a.size()<b.size()) a=b;
    else if(a.size()==b.size()){if(a<b){a=b;}}
    else a=a;
}

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

    ll n,m;
    cin>>n>>m;
    vll a(m);
    rep(i,m) cin>>a[i];
    vector<int> num(10);
    num={2,5,5,4,5,6,3,7,6};
    
    vec<string> dp(10000);
    rep(i,10000) dp[i]="0";
    dp[0]="";
    for(int i=0;i<=n;i++){
        if(dp[i]=="0")continue;
        for(auto c:a){stmax(dp[i+num[c-1]],dp[i]+(char)(c+'0'));}
    }

    cout<<dp[n]<<endl;
    return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int n, w;
vector<vector<int>> dp(500, vector<int>(10500, -1));

vector<int> wv;
vector<int> vv;


int dfs(int step, int maxw)
{
  int res = 0;
  if(dp[step][maxw] != -1) return dp[step][maxw];
  if(step == n) res = 0;
  else if(wv[step] > maxw) res = dfs(step+1, maxw);
  else res = max(dfs(step+1, maxw), dfs(step+1, maxw - wv[step]) + vv[step]);
  return dp[step][maxw] = res;
}

int main(){
  cin >> n >> w;
  for (int i = 0; i < n; i++) {
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    vv.push_back(tmp1);
    wv.push_back(tmp2);
  }

  cout << dfs(0, w) << endl;
}



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

int main()
{
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	if s[0] != 'A' {
		fmt.Println("WA")
		return
	}
	var count int
	for _, c := range s[2 : len(s)-1] {
		if c == 'C' {
			count++
		}
	}
	if count != 1 {
		fmt.Println("WA")
		return
	}

	var upperCount int
	for i := 0; i < len(s); i++ {
		if strings.ToUpper(string(s[i])) == string(s[i]) {
			upperCount++
		}
	}

	if upperCount != 2 {
		fmt.Println("WA")
		return
	}
	fmt.Println("AC")
}


Measured memory_bytes: 1844