akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
  char op;
  int a,b;
  scanf("%d %c %d",&a,&op,&b);
  while(op != '?'){
    switch(op){
      case '+':
        printf("%d\n",a+b);
        break;
      case '-':
        printf("%d\n",a-b);
        break;
      case '*':
        printf("%d\n",a*b);
        break;
      case '/':
        printf("%d\n",a/b);
        break;
    }
    scanf("%d %c %d",&a,&op,&b);
  }
  return 0;
}



Measured memory_bytes: 1980
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

char grid[8][8];

void rotate(){

  char tmp[8][8];
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
      tmp[i][j]=grid[7-j][i];

  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
      grid[i][j]=tmp[i][j];
}

void print(){

  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      cout << grid[i][j];
    }
    cout << endl;
  }
}

int main(void){

  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
      cin >> grid[i][j];

  cout << 90 << endl;
  rotate();
  print();

  cout << 180 << endl;
  rotate();
  print();

  cout << 270 << endl;
  rotate();
  print();

  return 0;
}

Measured memory_bytes: 1144
N,M=map(int,input().split())
gate=[list(map(int,input().split())) for _ in range(M)]

a=gate[0][0]
b=gate[0][1]
for i in range(1,M):
    a=max(a,gate[i][0])
    b=min(b,gate[i][1])

if b>=a:
    print(b-a+1)

else:
    print(0)

Measured memory_bytes: 27336
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int x, y, z;
int main(int argc, char const *argv[])
{
    cin >> x >> y >> z;
    cout << (x - z) / (y + z) << endl;

    return 0;
}

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

namespace A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            string line = RSt();
            Console.WriteLine(line.Where(x => x == '2').Count());
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 13268
#include <stdio.h>
int main(void){
    int N,M,C,i,j,counter=0;
    scanf("%d",&N);
    scanf("%d",&M);
    scanf("%d",&C);
    int A[N][M],B[M],sum=C;
    for(i=0;i<M;i++) scanf("%d",&B[i]);
    for(i=0;i<N;i++) {
        for(j=0;j<M;j++) scanf("%d",&A[i][j]);
    }
    
    for(i=0;i<N;i++){
        for(j=0;j<M;j++){
            sum += A[i][j]*B[j];
        }
        if(sum>0) counter++;
        sum = C;
    }
    
    printf("%d",counter);
    
    return 0;
}


Measured memory_bytes: 128
n = int(input())
a_li = list(map(int,input().split()))
a_li.append(0)
dum = 0
ans = 0
for i in range(n+1):
    ans += abs(a_li[i]-dum)
    dum = a_li[i]
dum = 0
for i in range(n):
    if dum <= a_li[i] <= a_li[i+1]:
        print(ans)
    else:
        print(ans-(abs(dum-a_li[i]) + abs(a_li[i]-a_li[i+1]))+abs(dum-a_li[i+1]))
    dum = a_li[i]


Measured memory_bytes: 14048
#include<iostream>  
#include<cmath>  
#include<cstdio>  
#include<cstring>  
#include<algorithm>  
using namespace std;
const int maxx = 1410;
int dp[maxx][maxx], G[maxx][maxx];

int getLargestSquare(int H, int W) {
	int maxWidth = 0;
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++) {
			dp[i][j] = (G[i][j] + 1) % 2;
			maxWidth |= dp[i][j];
		}

	for (int i = 1; i < H; i++)
		for (int j = 1; j < W; j++) {
			if (G[i][j]) {
				dp[i][j] = 0;
			}else {
				dp[i][j] = min(dp[i - 1][j - 1], 
					min(dp[i][j - 1], dp[i - 1][j]) ) + 1;
				maxWidth = max(maxWidth, dp[i][j]);
			}
		}
	return maxWidth * maxWidth;
}
int main()
{
	int H, W;
	scanf("%d %d", &H, &W);
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			scanf("%d", &G[i][j]);

	printf("%d\n", getLargestSquare(H, W));
	return 0;
}


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

vector<int> totientTable(int n){
	vector<int> ret(n + 1);
	for(int i = 0;i <= n;i++) ret[i] = i;
	for(int i = 2;i <= n;i++){
		if(ret[i] != i) continue;
		for(int j = i;j <= n;j += i) ret[j] -= ret[j] / i;
	}
	return ret;
}

int totient(int n){
	int ret = n,n_ = n;
	for(int i = 2;i * i <= n;i++){
		if(n_ % i == 0){
			while(n_ % i == 0) n_ /= i;
			ret -= ret / i;
		}
	}
	if(n_ > 1) ret -= ret / n_;
	return ret; 
}

signed main(){
	const int limit = 10000000;
	vector<int> tot = totientTable(limit);
	int n;
	cin >> n;
	if(n <= limit) cout << tot[n] << endl;
	else cout << totient(n) << endl;
}



Measured memory_bytes: 41732
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;


int n, d;
int x[100][100];
int cal(int a, int b){
	int tot = 0;
	for(int i = 0; i < d; ++i){
		tot += (x[a][i] - x[b][i]) * (x[a][i] - x[b][i]);
	}
	return tot;
}

signed main()
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	cin >> n >> d;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < d; ++j){
			cin >> x[i][j];
		}
	}
	int res = 0;
	for(int i = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j){
			int t = cal(i, j);
			int dist = sqrt(t + 0.5);
			if(dist * dist == t) {
				++res;
			}
		}
	}
	cout << res << endl;



    
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    ll sum=n*(n+1)/2;
    ll l1=n%3;
    l1=n-l1;
    ll l2=n%5;
    l2=n-l2;
    ll l3=n%15;
    l3=n-l3;
    ll n1=(l1-3)/3+1;
    ll n2=(l2-5)/5+1;
    ll n3=(l3-15)/15+1;
    //cout<<n1<<n2<<n3<<l1<<l2<<l3;
    ll s1=n1*(3+l1);
    s1=s1/2;
    ll s2=n2*(5+l2);
    s2=s2/2;
    ll s3=n3*(15+l3);
    s3=s3/2;
    //cout<<s1<<" "<<s2<<" "<<s3;
    cout<<sum-s1-s2+s3;
    return 0;
}


Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

//Yanagi's Comic
public class Main{

	class R implements Comparable<R>{
		int id, read;
		boolean f;
		int[][] p;//0: right-up 1:right-down 2:left-up 3:left-down
		public R(int ID, int x1, int y1, int x2, int y2) {
			id = ID;
			p = new int[4][2];
			if(x1<x2){
				if(y1<y2){
					p[0][0] = x1;p[0][1] = y1;
					p[1][0] = x1;p[1][1] = y2;
					p[2][0] = x2;p[2][1] = y1;
					p[3][0] = x2;p[3][1] = y2;
				}
				else {
					p[0][0] = x1;p[0][1] = y2;
					p[1][0] = x1;p[1][1] = y1;
					p[2][0] = x2;p[2][1] = y1;
					p[3][0] = x2;p[3][1] = y2;
				}
			}
			else{
				if(y1<y2){
					p[0][0] = x2;p[0][1] = y1;
					p[1][0] = x2;p[1][1] = y2;
					p[2][0] = x1;p[2][1] = y1;
					p[3][0] = x1;p[3][1] = y2;
				}
				else{
					p[0][0] = x2;p[0][1] = y2;
					p[1][0] = x2;p[1][1] = y1;
					p[2][0] = x1;p[2][1] = y2;
					p[3][0] = x1;p[3][1] = y1;
				}
			}
		}
		public int compareTo(R o) {
			return p[0][0]!=o.p[0][0]?p[0][0]-o.p[0][0]:p[0][1]-o.p[0][1];
		}
	}

	int num;

	void read(List<R> list){
		if(list.isEmpty())return;
		Collections.sort(list);
		R top = list.get(0);
		top.f = true;
		top.read = num++;
		int left = 500;
		int bottom = top.p[3][1];
		for(int i=1;i<list.size();i++){
			R r = list.get(i);
			if(r.p[0][1]<bottom&&bottom<r.p[1][1])left = Math.min(left, r.p[0][0]);
		}
		List<R> L = new ArrayList<R>();
		for(int i=1;i<list.size();i++){
			R r = list.get(i);
			if(r.f)continue;
			if(r.p[3][0]<=left&&r.p[3][1]<=bottom)L.add(r);
		}
		read(L);
		List<R> next = new ArrayList<R>();
		for(int i=0;i<list.size();i++){
			if(!list.get(i).f)next.add(list.get(i));
		}
		read(next);
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		boolean f = true;
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			if(!f)System.out.println();
			num = 1;
			f = false;
			R[] r = new R[n];
			List<R> l = new ArrayList<R>();
			for(int i=0;i<n;i++){
				r[i] = new R(i, sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
				l.add(r[i]);
			}
			read(l);
			for(int i=0;i<n;i++)System.out.println(r[i].read);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <climits>
#include <cmath>
#include <algorithm>
#include <cassert>

#define TEST_ASSERT(msg, cond) do { if (cond) { cout << msg << " => pass" << endl;} else { cout << msg << " => failed" << endl;} } while(0)

using namespace std;

long long calcScore(const vector< vector<int> >& F, const vector< vector<int> >& P, const vector<int>& v) {
  long long score = 0;
  for (int i = 0; i < F.size(); i++) {
    int count = 0;
    for (int j = 0; j < v.size(); j++) {  
      if (F[i][j] > 0 && v[j] > 0) count++;
    }
    //cout << "i, count = " << i << ", " << count << endl;
    //cout << "P[i][count] = " << P[i][count] << endl;
    score += P[i][count];
  }
  return score;
}

void print(const vector<int>& v) {
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main() {

  int N;
  cin >> N;
  vector< vector<int> > F(N, vector<int>(10));
  vector< vector<int> > P(N, vector<int>(11));  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> P[i][j];
    }
  }

  long long maxScore = INT_MIN;
  vector<int> v(10);
  for (int i = 1; i <= 1023; i++) {
    for (int j = 0; j < 10; j++) {
      v[j] = (i >> j) & 0x1;
    }
    long long score = calcScore(F, P, v);
    if (score > maxScore) {
      //print(v);
      //cout << "score = " << score << endl;
      maxScore = score;
    }
  }

  cout << maxScore << endl;

  return 0;
}


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

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

	vector<int> odd;
	vector<int> even;

	for (int i = 0;i < N;i++) {
		int p;
		cin >> p;
		if (i % 2 == 0) even.push_back(p);
		else odd.push_back(p);
	}

	int ans = 0;

	sort(odd.begin(), odd.end());
	sort(even.begin(), even.end());

	int odds[2][2] = { {0,0},{0,0} };
	int evens[2][2] = { {0,0},{0,0} };

	int v = odd.at(0);
	int count = 0;
	for (int i = 0;i < N / 2;i++) {
		if (v == odd.at(i)) {
			count++;
			
		}

		else {
			if (count > odds[0][1]) {
				odds[1][1] = odds[0][1];
				odds[1][0] = odds[0][0];
				odds[0][1] = count;
				odds[0][0] = v;
			}

			else if (count > odds[1][1]) {
				odds[1][1] = count;
				odds[1][0] = v;
			}
			count = 1;
			v = odd.at(i);
		}

		if (i == (N / 2) - 1) {
			if (count > odds[0][1]) {
				odds[1][1] = odds[0][1];
				odds[1][0] = odds[0][0];
				odds[0][1] = count;
				odds[0][0] = v;
			}

			else if (count > odds[1][1]) {
				odds[1][1] = count;
				odds[1][0] = v;
			}
		}
	}

	v = even.at(0);
	count = 0;

	for (int i = 0;i < N / 2;i++) {
		if (v == even.at(i)) {
			count++;
		}

		else {
			if (count > evens[0][1]) {
				evens[1][1] = evens[0][1];
				evens[1][0] = evens[0][0];
				evens[0][1] = count;
				evens[0][0] = v;
			}

			else if (count > evens[1][1]) {
				evens[1][1] = count;
				evens[1][0] = v;
			}
			count = 1;
			v = even.at(i);

		}

		if (i == (N / 2) - 1) {
			if (count > evens[0][1]) {
				evens[1][1] = evens[0][1];
				evens[1][0] = evens[0][0];
				evens[0][1] = count;
				evens[0][0] = v;
			}

			else if (count > evens[1][1]) {
				evens[1][1] = count;
				evens[1][0] = v;
			}
		}
	}

	if (odds[0][0] != evens[0][0]) {
		ans = N - odds[0][1] - evens[0][1];
	}

	else {
		ans = N - max((odds[0][1] + evens[1][1]), (odds[1][1] + evens[0][1]));
	}

	//cout << "odds" << endl << odds[0][0] << ' ' << odds[0][1] << endl << odds[1][0] << ' ' << odds[1][1] << endl;
	//cout << "evens" << endl << evens[0][0] << ' ' << evens[0][1] << endl << evens[1][0] << ' ' << evens[1][1] << endl;
	cout << ans << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

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

    auto check = [&](ll x){
        if(x == 0)return false;
        return N / x == N % x;
    };

    ll ans = 0;
    for(ll i = 1; i * i <= N; i++){
        if(N % i == 0){
            if(check(i - 1))ans += i - 1;
            if(check(N / i - 1))ans += N / i - 1;
        }
    } 
    
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
int main()
{
	int n;
	scanf("%d", &n);
	long long int arr[n];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%lld", &arr[i]);
	}
	int count = 0;
	long long int min = 1000000000;
	for(i=0;i<n;i++)
	{
		if(arr[i]<0)
			count++;
		if(abs(arr[i])<min)
			min = abs(arr[i]);
	}
	long long int sum = 0;
	if(count%2==0)
	{
		for(i=0;i<n;i++)
		{
			sum = sum + abs(arr[i]);
		}
	printf("%lld", sum);
	}

	else 
	{
		for(i=0;i<n;i++)
		{
			sum = sum + abs(arr[i]);
		}
	printf("%lld", sum - min - min);
	}
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;



int n;
void dfs(string t,char mx) {
    if (t.size() == n) {
        cout << t << endl;
        return;
    }
    for (char i = 'a'; i <= mx+1; i++) {
        dfs(t+i, max(mx, i));
    }

}

int main() {
    cin >> n;
    dfs("",'a'-1);
    //cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <stdlib.h>

int top, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop() {
  top--;
  return S[top+1];
}

int main(void) {
  int a, b;
  top = 0;
  char s;

  while ( scanf("%s", &s) != EOF) {
    if (s == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if (s == '-') {
      b = pop();
      a = pop();
      push(a - b);
    } else if (s == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(&s));
    }
  }

  printf("%d\n", pop());

  return 0;
}



Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  int sum=0;
  for(int i=0;i<N;i++)
    sum+=A.at(i);
  sort(A.begin(),A.end());
  int x=sum;
  if(sum%10!=0)
    cout<<sum<<endl;
  else{
  for(int i=0;i<N;i++){
  if((A.at(i)%10)!=0){
  x=A.at(i); break;
  }
 }int ans=sum-x;
  cout<<ans<<endl;
   return 0;
}
}

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

int main() {
  vector<string> weather(3);
  weather = { "Sunny","Cloudy","Rainy","Sunny" };
  string s;
  cin >> s;
  for(int i=0;i<3;i++){
    if(s == weather.at(i)){
      cout << weather.at(i+1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a)      cout<<a<<" "
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c=0,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	fu(i,1,n)sc(A[i]);
	fu(i,1,n){
		if(A[i]>=c)ans++;
		maxize(c,A[i]);
	}
	pr(ans);


	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 4e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll n, a, b;
main() {
  file("threesum");
  ios;
  cin >> n >> a >> b;
  cout << (n / (a + b)) * a + min(a, n % (a + b));
  return 0;
}
/**

*/


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n,a;
  cin>>n>>a;
  vector<ll>x(n);
  for(i=0;i<n;i++)cin>>x[i];
  vector<vector<ll>>dp(n+1,vector<ll>(3000));
  dp[0][0]=1;
  for(i=0;i<n;i++){
    for(j=n-1;j>=0;j--){
      for(o=0;o<=2500;o++){
        if(o+x[i]<=2500){
        dp[j+1][o+x[i]]+=dp[j][o];
        }
      }
    }
  }
  for(i=1;i<=n;i++){
    res+=dp[i][a*i];
  }
  cout<<res<<endl;
  return 0;
}

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

int main()
{
	int n,ans;
	cin>>n;
	int a[n];
	for(int i=0;i<n-1;i++)
	cin>>a[i];
	ans=a[0]+a[n-2];
	for(int i=0;i<n-2;i++)
	{
		ans+=min(a[i],a[i+1]);
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    string s, t; cin >> s >> t;
    int ans = 0;
    rep(i,s.length()) {
        if (s[i] != t[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int x = n*800;
  int y = n/15*200;
  int ans = x-y;
  cout << ans << endl;
}

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

int main(){

  long long int N,M;  cin >> N >> M;
  long long int ab[50][2];
  long long int cd[50][2];

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

  for(int i = 0;i < M;i++){
    cin >> cd[i][0] >> cd[i][1];
  }

  int point;


  for(int i = 0;i < N;i++){
    long long int mn = 999999999;
    for(int j = 0;j < M;j++){
      if(mn > abs(ab[i][0] - cd[j][0])+abs(ab[i][1] - cd[j][1])){
        mn = abs(ab[i][0] - cd[j][0])+abs(ab[i][1] - cd[j][1]);
        point = j+1;
      }
    }

    cout << point << endl;
  }

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <bitset>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main()
{
    ll H, W, K;
    scanf("%lld %lld %lld\n", &H, &W, &K);

    vector<vector<bool>> inmap(H, vector<bool>(W));
    for (ll i = 0; i < H; i++)
    {
        for (ll j = 0; j < W; j++)
        {
            char c;
            scanf("%c", &c);
            if (c != '#' && c != '.')
                c = '?';
            inmap[i][j] = (c == '#');
        }

        scanf("\n");
    }

    const ll max = pow(2, H + W);
    ll ans = 0;
    for (ll k = 0; k < max; k++)
    {
        ll count = 0;
        //cout << bitset<12>(k);
        for (ll i = 0; i < H; i++)
        {
            if (((k >> i) & 1))
            {
                continue;
            }

            for (ll j = 0; j < W; j++)
            {
                /*printf(" ");
                cout << bitset<12>(k >> i);
                printf(" ");
                cout << bitset<12>(k >> (H + j));
                printf(" %lld %lld ", (k >> i) & 1, (k >> (H + j)) & 1);
                printf(" %lld %lld ", i, j);
                printf(" %lld ", inmap[i][j]);*/
                if (!((k >> (H + j)) & 1) && inmap[i][j])
                {
                    //printf(" (%lld,%lld)", i + 1, j + 1);
                    count++;
                }
            }
        }

        //printf(" %lld %lld", (k >> 0) & 1, (k >> (H + 0)) & 1);
        //printf(" %d", inmap[1][1] == true);
        //printf(" %d", inmap[2][1] == true);
        //printf(" %lld\n", count);
        if (count == K)
            ans++;
    }

    printf("%lld\n", ans);
}


Measured memory_bytes: 4236
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, m; cin >> n >> m;
    vector<int> cnt(m,0);
    rep(i,n){
        int k; cin >> k;
        rep(j,k){
            int a; cin >> a;
            cnt[a-1]++;
        }
    }
    int ans = 0;
    rep(i,m){
        if(cnt[i] == n) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
p = gets.split.map(&:to_i)
comp = p[0..k-1].inject(:+)
max = comp
(n-k).times.each{|i|
  comp = comp - p[i] + p[k+i]
  max = comp if comp > max
}
p (((max + k)*1.0)/2)


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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

s = int(input())
for i in range(N - 1):
    tmp = int(input())
    s = lcm(s, tmp)

print(s)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int x;
	cin >> x;
	cout << 360 / gcd(360, x) << '\n';
}

Measured memory_bytes: 3608
#include <iostream>
  using namespace std;
  //↑デフォルト文
  int main() {
    int r, g, b;

    cin >> r;
    cin >> g;
    cin >> b;

    int answer = (r * 100) + (g * 10) + b;

    if(answer % 4 == 0){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

int main() {
  ll n;
  string s;
  cin >> n >> s;
  if(s[0] != 'B' || s.back() != 'B') {
    cout << 0 << endl;
    return 0;
  }
  vl l(2 * n, 0);
  l[0] = 1;
  vb left(2 * n, false);
  left[0] = true;
  rep2(i, 1, 2 * n) {
    l[i] = l[i - 1];
    if(s[i - 1] == s[i])
      left[i] = !left[i - 1];
    else
      left[i] = left[i - 1];
    if(left[i]) l[i]++;
  }
  ll cnt = 0;
  rep(i, 2 * n) if(left[i]) cnt++;
  if(left.back() || cnt != n) {
    cout << 0 << endl;
    return 0;
  }
  mint ans = 1;
  ll j = 0;
  rep(i, 2 * n) {
    if(!left[i]) {
      ans *= l[i] - j;
      j++;
    }
  }
  rep2(i, 1, n + 1) ans *= i;
  cout << ans << endl;
}

Measured memory_bytes: 2180
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        long[] a = new long[n+1];
        long[] b = new long[m+1];
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextLong();
            a[i] += a[i-1];
        }
        for (int i = 1; i <= m; i++) {
            b[i] = sc.nextLong();
            b[i] += b[i-1];
        }
        int l = 0;
        int r = n+m+1;
        while(1 < r - l){
            int mid = (l + r) / 2;
            boolean able = false;
            for (int i = Math.max(0, mid-m); i <= n; i++) {
                int bi = Math.max(0, mid - i);
                if(a[i] + b[bi] <= k){
                    able = true;
                    break;
                }
            }
            if(able) l = mid;
            else r = mid;
        }
        System.out.println(l);
        sc.close();

    }

}


Measured memory_bytes: 62932
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if( ( (a>b) && (b>c) ) or ((a<b)&&(b<c))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;

  }
  return 0;
}


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

int main(){
    string s;
    cin>>s;

    vector<int> num(s.size(), 1);
    for(int i=0; i<s.size()-2; i++){
        if(s[i] == 'R' && s[i+1] == 'R'){
            num[i+2] += num[i];
            num[i] = 0;
        }
    }
    for(int i=s.size()-1; i>1; i--){
        if(s[i] == 'L' && s[i-1] == 'L'){
            num[i-2] += num[i];
            num[i] = 0;
        }
    }

    for(int i=0; i<s.size(); i++){
        cout<<num[i];
        if(i < s.size()-1){
            cout<<" ";
        }
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
#define NIL -1

struct Node{
    int p,l,r;
};

void setDepth(vector<Node> &T,vector<int> &D,int u,int p){
    D[u]=p;
    if(T[u].r!=NIL){
        setDepth(T,D,T[u].r,p);
    }
    if(T[u].l!=NIL){
        setDepth(T,D,T[u].l,p+1);
    }
}

void printChildren(vector<Node> &T,int u){
    int c=T[u].l;
    if(c!=NIL){
        cout<<c;
        c=T[c].r;
        while(c!=NIL){
            cout<<", "<<c;
            c=T[c].r;     
        }
    }
}

int main(){
    int n;
    cin>>n;
    vector<Node> T(100001);
    vector<int> D(100001);
    for(int i=0;i<n;i++){
        T[i].p=T[i].l=T[i].r=NIL;
    }
    for(int i=0;i<n;i++){
        int x,y,w;
        cin>>x>>y;
        for(int j=0;j<y;j++){
            int z;
            cin>>z;
            if(j==0){
                T[x].l=z;
            }
            else{
                T[w].r=z;
            }
            w=z;
            T[z].p=x;
        }
    }
    for(int i=0;i<n;i++){
        if(T[i].p==-1){
            setDepth(T,D,i,0);
        }
    }
    
    for(int i=0;i<n;i++){
        cout<<"node "<<i<<": parent = "<<T[i].p<<", depth = "
            <<D[i]<<", ";
        if(T[i].p==-1){
            cout<<"root";
        }
        else if(T[i].l==-1){
            cout<<"leaf";
        }
        else{
            cout<<"internal node";
        }   
        cout<<", [";
        printChildren(T,i);
        cout<<']'<<endl;
    }
}


Measured memory_bytes: 9016
#include <cstdio>
using namespace std;
int n;
int a[50];
bool solve(int i, int m) {
	if (m == 0)return true;
	if (i > n - 1)return false;
	bool res = solve(i + 1, m) || solve(i + 1, m - a[i]);
	return res;
}

int main() {
	int q;
	int m;
	scanf("%d", &n);
	int i;
	for (i = 0; i<n; i++)
		scanf("%d", &a[i]);
	scanf("%d", &q);
	for (i = 0; i<q; i++) {
		scanf("%d", &m);
		if (solve(0, m))printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


Measured memory_bytes: 2692
n = int(input())
d, x = map(int, input().split())
a_list = list(map(int, [input() for _ in range(n)]))

n_eaten = 0
for a_i in a_list:
    k = 0
    while k * a_i + 1 <= d:
        n_eaten += 1
        k += 1

print(n_eaten + x)

Measured memory_bytes: 3060
import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.IArray             as IA
import qualified Data.Array.IO                 as AI
import qualified Data.Array.MArray             as MA
import qualified Data.Array.ST                 as STA
import qualified Data.Array.Unboxed            as AU
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Graph                    as G
import           Data.Int
import qualified Data.IntMap                   as IM
import qualified Data.IntSet                   as IS
import           Data.List
import qualified Data.Map.Strict               as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence                 as SQ
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Tree                     as T
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO Int
readInt = fst . fromJust . BS.readInt <$> BS.getLine

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

readIntLists :: Int -> IO [[Int]]
readIntLists n = replicateM n readInts

readInteger :: IO Integer
readInteger = fst . fromJust . BS.readInteger <$> BS.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegerLists :: Int -> IO [[Integer]]
readIntegerLists n = replicateM n readIntegers

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n <$> readStrings

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putList :: Show a => [a] -> IO ()
putList [n     ] = print n
putList (n : ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n     ] = putStrLn n
putStrList (n : ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b | b         = putStrLn "YES"
             | otherwise = putStrLn "NO"

yesNo b | b         = putStrLn "Yes"
        | otherwise = putStrLn "No"

divCeiling x n | b == 0    = a
               | otherwise = a + 1
  where (a, b) = x `divMod` n

main = do
  n <- readInteger
  print
    $     (foldl1' (\acc x -> (acc * x) `mod` 1000000007) [1 .. n])
    `mod` 1000000007


Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

vvl G;
vl visited;
ll n, m;
ll ans = 0;

void dfs(ll v) {
    // 行きの処理はこのへんに書く
    visited[v] = 1;
    for(auto u : G[v]) { 
        if(visited[u]) {
            continue;
        }
        dfs(u);
        // 帰りの処理はこのへんに書く
    }
    bool ok = true;  // すべての頂点を訪れていたらtrue
    rep(v, n) {
        if(visited[v] == 0) {
            ok = false;
        }
    }
    if(ok) {
        ans++;
    }
    visited[v] = 0;
}

int main() {
    
    cin >> n >> m;    
    
    G.resize(n);
    visited.resize(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    
    dfs(0);

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define print(...) {for(auto x: __VA_ARGS__) cout<<x<<" ";}
#define debug(...) {cout<<#__VA_ARGS__": ";print(__VA_ARGS__);cout<<endl;}
using namespace std;

int x, a;

int main() {
    cin >> x >> a;

    cout << (x < a ? 0 : 10) << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
    void solve() throws IOException {
    	int n = in.nextInt();
    	TreeSet<Integer> set = new TreeSet<>();
    	for(int i = 0; i < n; i++) {
    		int a = in.nextInt();
    		if(set.contains(a)) set.remove(a);
    		else set.add(a);
    	}
    	System.out.println(set.size());
    }
 
}
 
@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}
 
class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

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

int main(){
    bool flag=false;
    int N,Y;
    cin >> N >>Y;
    int amax,bmax,cmax;
    amax=Y/10000;
    for(int a=0;a<=amax;a++){
        bmax=(Y-10000*a)/5000;
    for (int b=0;b<=bmax;b++){
        int c=N-a-b;
        if (10000*a+5000*b+1000*c==Y){
            if(! flag){
            cout << a << " " <<b << " " <<c <<endl;
            flag=true;
            break;
            }

        }
        
    }

    } 
    if (! flag)cout << -1 << " " <<-1 << " " <<-1 <<endl;

    
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<queue>
using namespace std;
const int N=200010;
struct tree{
	int l,r,ji,ou;
}tr[4*N];
int id[N];
int n,a[N];
bool se=0;
struct node{
	friend bool operator < (node a,node b){
        return a.x>b.x; 
    }
	int x,y,l,r;
	
}q,pu;
priority_queue<node> ans;
const int inf=1e9;
void update(int i)
{
	tr[i].ji=min(tr[i<<1].ji,tr[i<<1|1].ji);
	tr[i].ou=min(tr[i<<1].ou,tr[i<<1|1].ou);
}
void build(int i,int l,int r)
{
	tr[i].l=l;
	tr[i].r=r;
	if (l==r)
	{
		if (l&1)
			tr[i].ji=a[l],tr[i].ou=inf;
		else tr[i].ji=inf,tr[i].ou=a[l];
	//	cout<<l<<" "<<tr[i].ji<<" "<<tr[i].ou<<endl;
		return;
	}
	int mid=l+r>>1;
	build(i<<1,l,mid);
	build(i<<1|1,mid+1,r);
	update(i);
//	cout<<i<<" "<<" "<<l<<" "<<r<<" "<<tr[i].ji<<" "<<tr[i].ou<<endl;
	
}
int query(int i,int l,int r,int p)
{
//	cout<<l<<" "<<r<<" "<<p<<endl;
	int L=tr[i].l;
	int R=tr[i].r;
//	cout<<L<<" "<<R<<endl; 
	if (L>r||l>R) return inf;
	if (l<=L && R<=r)
	{
	//	cout<<p<<" "<<tr[i].ou<<endl;
		if (p) return tr[i].ji;
		else return tr[i].ou;
	}
	int ans=inf;
//	int mid=l+r>>1;
	ans=min(ans,query(i<<1,l,r,p));
	ans=min(ans,query(i<<1|1,l,r,p));
	return ans;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),id[a[i]]=i;
	build(1,1,n);
	int x=query(1,1,n,1);
	int y=query(1,id[x]+1,n,0);
	//cout<<x<<" "<<y<<endl;
	q.l=1;
	q.r=n;
	q.x=x;
	q.y=y;
	ans.push(q);
	for (int i=2;i<=n/2;i++)
	{
		q=ans.top();
		ans.pop();
		int ix=id[q.x];
		int iy=id[q.y];
		//cout<<ix<<" "<<iy<<endl;
		if (q.l<ix)
		{
			se=q.l&1;
			int x=query(1,q.l,ix-1,se);
			int y=query(1,id[x],ix-1,se^1);
			pu.l=q.l;
			pu.r=ix-1;
			pu.x=x;
			pu.y=y;
		//	cout<<"1"<<" "<<x<<" "<<y<<endl;
			ans.push(pu); 
		}
		if (ix+1<iy)
		{
			se=(ix+1)&1;
			int x=query(1,ix+1,iy-1,se);
			int y=query(1,id[x]+1,iy-1,se^1);
			//cout<<id[x]+1<<" "<<iy-1<<endl;
			pu.l=ix+1;
			pu.r=iy-1;
			pu.x=x;
			pu.y=y;
		//	cout<<"2"<<" "<<x<<" "<<y<<endl;
			ans.push(pu); 
		}
		if (iy<q.r)
		{
			se=(iy+1)&1;
			int x=query(1,iy+1,q.r,se);
			int y=query(1,id[x]+1,q.r,se^1);
			pu.l=iy+1;
			pu.r=q.r;
			pu.x=x;
			pu.y=y;
			//cout<<"3"<<" "<<x<<" "<<y<<endl;
			ans.push(pu); 
		}
		printf("%d %d ",q.x,q.y);
	}
	while (!ans.empty())
	{
		pu=ans.top();
		ans.pop();
		printf("%d %d ",pu.x,pu.y);
	}
}

Measured memory_bytes: 12532
import fractions
a,b,c,d = map(int, input().split())
print(b - b//c- b//d + b//(c*d//fractions.gcd(c,d)) - (a-1 - (a-1)//c- (a-1)//d + (a-1)//(c*d//fractions.gcd(c,d))))

Measured memory_bytes: 5048
'''ika tako
bit桁ごとに考える。「XORを取り、その後足し算」という計算過程では
他の桁が影響することはないので、桁毎に独立に考えて問題ない。
N = 5
A = {   1   2   3   4   5 }   ↓
    { 001 010 011 100 101 }
たとえば2桁目を取り出すと
       0   1   1   0   0
各ペアでXORを取ると、(0,1)は'1'となり、(0,0)(1,1)は'0'となる。 
0はいくら足しても0なので、(0,1)の数だけわかれば良い。
それは、(0の個数)×(1の個数)で計算できる。
    0が3個、1が2個
→  XORを取ったとき、2桁目について'1'が立っているペア
　　　　　　　　　　　=合計に足される回数は 3x2=6
→  2進数の2桁目は2を表すので、合計に足される値は6x2=12
これを各桁について足し合わせる。
'''
n = int(input())
aaa = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
ans = 0
m = 1
for i in range(60):#上限は2＾60なので、60が上限
    bit = sum(a & m for a in aaa)
    #＆演算子は論理積、両方のビットが1の場合に1が返る
    #L=[a for a in aaa]  与えられたN個の整数を全列挙
    #print(L)
    #bit //= m こっちが原文、下の行は、下のプログラムに合わせてみた
    bit >>= i
    #print(bit)
    non_bit = n - bit
    ans = (ans + bit * non_bit * m) % MOD
    #ｍは上記、2桁目を表す2と同様
    m <<= 1#ビットを１つずつ左シフト
print(ans)

'''
結局この計算は Ai のすべての組み合わせ(Ai 自身同士は含まない)の 
XOR の合計なので、Ai のあるビットの立っている数の合計を c とすると、
Ai のあるビットが0であった場合により計算結果に立つビットの数は 
c、Ai のあるビットが1であった場合により計算結果に立つビットの数は 
N - c になるので、あるビットに関する計算結果は c * (N -c) の
ビットシフトした値になる. 結果として以下の計算で解ける.

N = int(input())
A = list(map(int, input().split()))
 
result = 0
for bit in range(60):
    m = 1 << bit　すべてのビットを調べる
    c = sum(a & m for a in A) >> bit　
    ビット分、戻して、その桁に立っているビット数を算出
    result += (c * (N - c)) << bit　
    ビット分（上記の2桁目の2）調整、イメージとしては2のべき乗倍
    result %= 1000000007
print(result)
'''

Measured memory_bytes: 42156
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int N, K;
    cin >> N >> K;

    long long res = 1;

    for (int i = 0; i < N; ++i) {
        res = min(res * 2, res + K);
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3660
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ');

const gcd = (a: number, b: number): number => {
  if (b === 0) {
    return a;
  }
  return gcd(b, a % b);
};

const lcm = (a: number, b: number): number => {
  return (a / gcd(a, b)) * b;
};

const res: number = lcm(+input[0], +input[1]);

console.log(res);


Measured memory_bytes: 7372