akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n)  for(int i = 0; i < (n); i++)
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;
#define MP make_pair

int main(){
    using pii=pair<int,int>;
    while(1){
        int n,t;
        cin>>t>>n;
        if(t==0&&n==0)break;
        vii b(266,vi(266,0));
        vii used(266,vi(266,0));
        int cnt=0,sx=0,sy=0;
        rep(i,n){
            int x,y;
            cin>>x>>y;
            b[x+100][y+100]=1;

        }
        cin>>sx>>sy;
        queue<array<int,3>> q;
        q.push({sx,sy,0});
        b[sx+100][sy+100]=1;
        used[sx+100][sy+100]=1;
        cnt=1;
        int dx[6]={1,1,0,-1,-1,0};
        int dy[6]={1,0,-1,-1,0,1};
        while(q.size()){
            auto pr=q.front();
            q.pop();
            int x=pr[0];
            int y=pr[1];
            int tt=pr[2];
            //cerr<<x<<" "<<y<<endl;
            if(tt>=t)continue;
            rep(d,6){
                int nx=x+dx[d];
                int ny=y+dy[d];
                if(used[nx+100][ny+100]==0&&b[nx+100][ny+100]==0){
                    q.push({nx,ny,tt+1});
                    used[nx+100][ny+100]=1;
                    cnt++;
                }
            }
        }
        cout<<cnt<<endl;     

    }
}



Measured memory_bytes: 3436
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var [n,k]= input.trim().split(" ").map(Number);
var takasa=0;
var w=0;
var cnt=0;
while(true){
   if(n==0)break;
   n--;
   cnt++;
   if(w<=k*cnt){
      takasa++;
      w+=cnt;
      cnt=0;
   }
}
console.log(takasa);


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


int main(){
  int W,H,x,y;
  char a;
  cin>>W>>H>>x>>y;
  double ans,gx,gy;
  gx=(double)W/2;
  gy=(double)H/2;
  if(abs(gx-x)<0.0000000001&&abs(gy-y)<0.0000000001){
    a='1';
  }else{
    a='0';
  }
  ans = (double)H*(double)W/2;
  cout<<setprecision(10)<<ans<<" "<<a<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define flu(i, a, b) for(ll i = a; i < b; i++)
#define blu(i, a, b) for(ll i = a; i >= b; i--)
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define Unique(X) (X).erase(unique(all(X)), (X).end())
#define all(v) v.begin(), v.end()
#define ull unsigned long long
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';

ll MOD = 1e9 + 7;

ll i, j, le;

int sv(int x)
{
    int n = 200000;
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));

    for (int p = 2; p * p <= n; p++)
    {
       
        if (prime[p] == true)
        {
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    if (prime[x])
        return 1;
    else
        return 0;
}

int main()
{
    IOS;
    int t;
    //cin >> t;
     t=1;
    while (t--)
    {
        ll x,y,a,b;
        cin>>x>>y>>a>>b;
        ll u= b-y;
        ll r= a-x;
        flu(i,0,u)cout<<'U';
        flu(i,0,r)cout<<'R';
        flu(i,0,u)cout<<'D';
        flu(i,0,r)cout<<'L';
        cout<<'L';
        flu(i,0,u+1)cout<<'U';
        flu(i,0,r+1)cout<<'R';
        cout<<'D';
        cout<<'R';
        flu(i,0,u+1)cout<<'D';
        flu(i,0,r+1)cout<<'L';
        cout<<'U';
    }
    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
typedef pair<ll, ll > P;

ll N, M, K;
ll ookisa[20000];
ll dp[20000][1001];

P get(int a,int b) {
	P res;
	res.first = *max_element(ookisa + a, ookisa + b + 1);
	res.second = *min_element(ookisa + a, ookisa + b + 1);
	return res;
}

int main() {
	cin >> N >> M >> K;
	for (int i = 0; i < N; i++)cin >> ookisa[i];
	for (int i = 0; i < N; i++)for (int j = 0; j < M; j++)dp[i][j] = 1145141919810893;

	dp[0][0] = K;

	for (int i = 1; i < N ; i++) {

		P minmax;
		minmax.first = ookisa[i], minmax.second = ookisa[i];

		for (int j = 1; j < M; j++) {
			if (i - j >= 0) {
				minmax.first = max(minmax.first, ookisa[i - j]);
				minmax.second = min(minmax.second, ookisa[i - j]);
				dp[i][j] = min(dp[i][j], dp[i - j][0] + (j + 1) * (minmax.first - minmax.second));
			}
			
		}

		for (int j = 0; j < M; j++) {
			dp[i][0] = min(dp[i][0], dp[i - 1][j] + K);
		}

	}

	ll ans = 1145141919810893;

	for (int i = 0; i < M; i++)ans = min(ans, dp[N - 1][i]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 159652
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<long,long>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	ll a,b;
    cin >> a >>b ;
    cout <<a*b << endl;
}

Measured memory_bytes: 3588
#include <stdio.h>

bool echo(int N, char S[]) {
  for(int i = 0; i < N/2; i++) {
    if(S[i] != S[i + N/2]) {
      return false;
    }
  }

  return true;
}

int main() {
  int N;
  char S[102];
  scanf("%d %s", &N, S);
  (N % 2 == 0 && echo(N, S)) ? puts("Yes") : puts("No");
  
  return 0;
}

Measured memory_bytes: 1660
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
typedef long long ll;
const int maxn = 1e5+10;
int a[maxn],b[maxn];

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    ll res=0;
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i],&b[i]);
        if((a[i]&k)==a[i])  res+=(ll)b[i];
    }
    for(int i=30;i>=0;i--){
        int tmp=1<<i;
        if(k&tmp){
            int f=(k^tmp)|(tmp-1);
            // cout<<k<<" "<<tmp<<" "<<(k^tmp)<<" "<<tmp-1<<" "<<f<<endl;
            ll ans=0;
            for(int j=0;j<n;j++){
                if((a[j]&f)==a[j])    ans+=(ll)b[j];
            }
            res=max(res,ans);
        }
    }
    printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>
char s[5];
int main(){
	int cnt;
	scanf("%s",s+1);
	if(s[2]=='R'&&s[1]==s[2]&&s[2]==s[3])cnt=3;
	else if(s[2]=='R'&&s[1]==s[2])cnt=2;
	else if(s[2]=='R'&&s[2]==s[3])cnt=2;
	else if(s[1]=='R'||s[2]=='R'||s[3]=='R')cnt=1;
	else cnt=0;
	printf("%d\n",cnt);
	return 0;
}

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

ll gcd(ll a, ll b) {
  if (a<b) swap(a,b);
  while (1) {
    if (a%b == 0) return b;
    ll r = a%b;
    a = b;
    b = r;
  }
}

int main() {
  ll A, B;
  cin >> A >> B;
  ll G = gcd(A,B);
  ll pat = 1;
  for (ll i = 2; i <= sqrt(G); i++) {
    if (G%i != 0) continue;
    pat += 1;
    while (G%i == 0) G /= i;
  }
  if (G != 1) pat+=1;
  cout << pat << endl;
}

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

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

    for (int n = 1; n <= 100000; n++) {
        int a = n * 0.08;
        int b = n * 0.1;
        if (a == A && b == B) {
            cout << n << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


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

int main(){
  int x,n,ans=0,min=1e9;cin>>x>>n;
  vector<int> p(n,0);
  REP(i,n) cin>>p.at(i);
  for(int i=0;i<=101;i++){
    bool f=0;
    REP(j,n) if(i==p.at(j)) f=1;
    if(f) continue;
    if(abs(x-i)<min) {
      min=abs(x-i);
      ans=i;
    }
  }

  cout<<ans;
}

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



int main(){
    int length, n;
    cin >> length >> n;
    vector<int> vec(n);
    rep(i,n) cin>>vec.at(i);
    vector<int> nagasa(n);
    priority_queue<int> pq;

    rep(i,n){
        if(i==0){
            continue;
        }
        else{
            pq.push(vec.at(i)-vec.at(i-1));
        }
    }
    pq.push(length-vec.at(n-1)+vec.at(0));
    pq.pop();


    int sum=0;
    rep(i,n-1){
        sum+=pq.top();
        pq.pop();
    }
    cout << sum << endl;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, P;
    cin >> A >> P;
    cout << (A * 3 + P) / 2 << "\n";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int k = in.nextInt();
			int[] x = in.nextIntArray(n);

			int sum = 0;
			for (int i = 0; i < n; i++) {
				sum += Math.min(x[i], k-x[i]);
			}
			out.println(sum*2);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

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

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

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

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

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

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

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

}


Measured memory_bytes: 21076
n = gets.to_i
num = Array.new(n, 0)
n.times{|i| num[i] = gets.to_i}

sum, carry = num[0].divmod(2)
for i in 1...n
    sum += (carry + num[i]) / 2
    carry = num[i].zero? ? 0 : (num[i] - carry) % 2
end
puts sum


Measured memory_bytes: 2812
n = int(input())
a = []
for i in range(n):
  b = input()
  if b in a:
    print("No")
    exit()
  a.append(b)
mae = a[0][-1]
for i in range(1,n):
  if mae != a[i][0]:
    print("No")
    exit()
  mae = a[i][-1]
print("Yes")
  
  

Measured memory_bytes: 3060
x,n = map(int,input().split())
p = list(map(int,input().split()))
a = x-1
b = x+1

if x not in p:
    ans = x

else:
    while 1:
        if a not in p:
            ans = a
            break

        if b not in p:
            ans = b
            break

        a -= 1
        b += 1
    
print(ans)

Measured memory_bytes: 9192
N,M = map(int,input().split())

As = input().split()
A = [0]*N

for n in range(N): 
  A[n] = float(int(As[n]))+0.1
A.sort()

tid = [0]*M
ct = -1
cid = -1
ms = 0

for m in range(M):
  if ct==-1:
    A[N-1] = A[N-1]/2.0
    tid[0] = N-1
    ct = 1
    cid = 0
  else:
    if N-1-m+ms<0 or A[tid[cid]]>A[N-1-m+ms]:
      A[tid[cid]] = A[tid[cid]]/2.0
      tid[ct] = tid[cid]
      ct += 1
      cid += 1
      ms+=1
    else:
      A[N-1-m+ms] = A[N-1-m+ms]/2.0
      tid[ct] = N-1-m+ms
      ct += 1

Asum = 0
for n in range(N):
  Asum += int(A[n])
print(Asum)

Measured memory_bytes: 66800
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').mapIndexed { idx, value -> idx+1 to value.toInt() }.sortedBy { it.second }
    var res = StringBuilder()
    a.forEach { res.append("${it.first} ") }
    println(res.trim())
}


Measured memory_bytes: 82388
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

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

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

	int ans = 0;

	for(int i = 0; i < k; i++) ans += v[i];

	cout << ans;
	
	return 0;
}


Measured memory_bytes: 3568
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		
		int k = sc.nextInt();
		int n = sc.nextInt();
		
		if(k*500>=n)
			System.out.println("Yes");
		else	
			System.out.println("No");
	}
}

Measured memory_bytes: 22996
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    cin >> n >> k;
    int p[n];
    for(int i = 0;i < n;i++){
        
        cin >> p[i];
        
    }
    for(int t = 0;t < n;t++){
    for(int j = 0;j < n;j++){
        
        if(p[j] > p[j+1]) swap(p[j],p[j+1]);
        
    }}
    int a = 0;
    for(int y = 0;y < k;y++) {a += p[y];}
    cout << a << endl;
    
}

Measured memory_bytes: 3608
#include <cstdio>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int xr = 0;
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    while (a > b && a % b != 0) {
      int q = a / b;
      int l = -1, r = 1'000'000'009;
      while (r - l > 1) {
        int s = (l + r) / 2;
        if ((a - (long long)(q + 1) * s) / b == q) {
          l = s;
        } else {
          r = s;
        }
      }
      if ((a - (q + 1) * l) % b != 0) {
        ++l;
      }
      a -= (q + 1) * l;
    }
    xr ^= a / b;
  }
  puts(xr != 0 ? "Takahashi" : "Aoki");
}


Measured memory_bytes: 128
#include<math.h>
#include<string.h>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<sstream> //istringstream stm(string); stm >> x;
#define INF 2139062143
#define inf -2139062144
#define ll long long
using namespace std;
int f;
int w[3];
int dp[3005];
double Mina;
int a,b,e;
int pack(int shui,int rongliang) {
	int ret = 0;
	for(int i=1; i<=2; i++) {
		for(int j=w[i]; j<=rongliang; j++) {
			dp[j] = max(dp[j-w[i]]+w[i], dp[j]);
			if(dp[j] + shui <= f)
				ret = max(ret,dp[j]);
		}
	}
	return ret;
}
int main() {

	cin>>a>>b>>w[1]>>w[2]>>e>>f;
	int ans;
	Mina = -9999999.0;
	int answ = 0,anst = 0;
	for(int i = 0; i<=f / (a*100); i++) {
		for(int j=0; j<=f/ (b*100); j++) {
			memset(dp,0,sizeof(dp));
			int shui = i * 100 * a + j * 100 * b;
			if(shui <= f) {
				int rongliang = i * a * e + j * b * e;
				ans = pack(shui,rongliang);
				if(shui != 0) {
					double temp = (double) ans / (double)(shui + ans);
					if(temp > Mina) {
						Mina = temp;
						answ = shui + ans;
						answ+=1;
						anst = ans;
						answ-=1;
					}
				}
			}
		}
	}
	cout<<answ<<" "<<anst<<endl;
	return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll maxdonut = 100 / 7 + 1;
  ll maxcake = 100 / 4;

  ll n;
  cin >> n;

  bool ans = false;
  REP(i, maxdonut+1){
    REP(j, maxcake+1){
      if(i*7+j*4==n)
        ans = true;
    }
  }

  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if(a >= b) {
        rep(i,a) {
        cout << b;
    }
    } else {
        rep(i,b) cout << a;
    }
    cout << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n,k=map(int,input().split())
G=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1; b-=1
    G[a].append(b)
    G[b].append(a)

class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod
    
    def per(self, n, r):
        if ( r<0 or r>n ): return 0
        return self.fac[n] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 2*10**5)
# maxnum=10**6だとテーブル生成に200ms程かかるので
# 最大生成領域は問題ごとに要検討

def dfs(s,node,parent):
    if len(G[node])>=k: return 0
    elif len(G[node])-s==0: return 1
    # else: result=(invt.fac[k-1-s]*invt.Ifac[k-1-s-(len(G[node])-s)])%mod
    else: result=invt.per(k-1-s,len(G[node])-s)
    for i ,di in enumerate(G[node]):
        if di == parent: continue
        result*=dfs(1,di,node); result%=mod
    # print(node,result)
    return result

print((k*dfs(0,0,-1))%mod)


    



Measured memory_bytes: 121844
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
struct Edge {
  int from;
  int to;
  int cost;
  void init(int from,int to,int cost){
    this->from = from;
    this->to   = to;
    this->cost = cost;
  }
  void show(){
    cout<<from<<" "<<to<<" "<<cost<<endl;
  }
};

void Main(){
  int v,e;
  cin>>v>>e;
  vvi d(v,vi(v,INF));
  v(Edge) edge(e);
  rep(i,e){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    d[a][b] = c;
    d[b][a] = c;
    edge[i].init(a,b,c);
  }
  rep(i,v) d[i][i]=0;
  rep(k,v){
    rep(i,v){
      rep(j,v){
        chmin(d[i][j], d[i][k]+d[k][j]);  
      }
    }
  }
  int ans=e;
  for(auto side:edge){
    rep(s,v){
      bool f = false; 
      rep(t,v){
        if( d[s][side.from] + side.cost + d[side.to][t] == d[s][t] ){
          ans--;
          f = true;
          break;
        }
      }
      if(f) break;
    }
  }
  cout<< ans <<endl;
} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vi g[MAXN];

ll cnt[3];

ll cnt_e;

int fl;

int used[MAXN];

void dfs(int s, int col){
	used[s] = col;
	cnt[used[s]]++;
	cnt_e += SZ(g[s]);
	REP(i, 0, SZ(g[s])){
		int to = g[s][i];
		if (!used[to]){
			dfs(to, 3 - col);
		} else if (used[s] == used[to]){
			fl = 1;
		}
	}
}

void solve(){
	int n, m, a, b;
	scanf("%d%d", &n, &m);
	REP(i, 0, m){
		scanf("%d%d", &a, &b);
		g[a].pb(b);
		g[b].pb(a);
	}
	ll ans = 0ll;
	REPN(i, 1, n){
		if (!used[i]){
			cnt[1] = cnt[2] = 0;
			fl = 0;
			cnt_e = 0;
			dfs(i, 1);
			cnt_e /= 2;
			
			if (fl){
				ans += (cnt[1] + cnt[2]) * (cnt[1] + cnt[2] - 1) / 2 - cnt_e;
			} else {
				ans += cnt[1] * cnt[2] - cnt_e;
			}
		}
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 7296
def power(a, b):
	if b == 0:
		return 1
	elif b == 1:
		return a % 1000000007
	elif b % 2 == 0:
		return (power(a, b//2) ** 2) % 1000000007
	else:
		return (power(a, b//2) ** 2 * a) % 1000000007
 
def divide(a, b):
	return (a * power(b, 1000000005)) % 1000000007

fac_lim = 200000
fac = [None]*(fac_lim+1)
fac[0] = 1
for i in range(fac_lim):
    fac[i+1] = fac[i] * (i+1)
    fac[i+1] = fac[i + 1] % 1000000007

fac_inv = [None]*(fac_lim+1)
fac_inv[fac_lim] = power(fac[fac_lim], 1000000005)
for i in range(fac_lim, 0, -1):
    fac_inv[i-1] = (fac_inv[i] * i)  % 1000000007

def conv(a, b):
    return (fac[a] * fac_inv[a-b] * fac_inv[b]) % 1000000007

MOD = 1000000007
N, M, K = (int(i) for i in input().split())
midN = 0
midM = 0
if N > 1:
    for i in range(1,N):
        midN += i*(N-i)*2
        midN % MOD
    midN = divide(midN, N**2)
else:
    midN = 0
if M > 1:
    for i in range(1,M):
        midM += i*(M-i)*2
        midM % MOD
    midM = divide(midM, M**2)
else:
    midM = 0
kt = (midN+midM)*(N*M)
kt = divide(kt, N*M-1)
pt = conv(N*M, K)
ans = kt*pt % MOD
ans = ans*K*(K-1) % MOD
ans = divide(ans, 2)
print(ans%MOD)

Measured memory_bytes: 18804
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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;
}
//

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

  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  int ans = 0;
  FOR(i, 1, n - 1) {
    if (p[i] < p[i + 1] && p[i] > p[i - 1])
      ans++;
    else if (p[i] < p[i - 1] && p[i] > p[i + 1])
      ans++;
  }

  cout << ans << endl;

  return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)

int N;

int main() {
	while (scanf("%d", &N), N) {		
		int ans = 1, f = 0;
		
		for_(i,0,N) {
			int k; scanf("%d", &k);
			if (k) ++ans;
			if (k >> 1) f = 1;
		}
		
		if (f) printf("%d\n", ans);
		else printf("NA\n");
	}
	
	return 0;
}

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

using namespace std;

int main()
{
	string s;
	getline(cin, s);

	int len = s.length();

	for (int i = 0; i < len; i++){
		if (isupper(s[i]))
			s[i] = tolower(s[i]);
		else if (islower(s[i]))
			s[i] = toupper(s[i]);
	}

	cout << s << endl;

	return 0;
}



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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define A first
#define B second
#define MOD 1000000007

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;
}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res, x);
        y = y >> 1;
        x = mulmd(x, x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a - b;
    if(ret < 0){
        ret += MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int invPow(ll a){
    return power(a, MOD - 2, MOD);
}

const int N = 1e5 + 5;

int arr[N];

/**
    Check out for boundary cases, (n = 1 or n = 0)
    check for integer overflow

**/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    if(b == 1){
        cout << 0;
        return 0;
    }
    int cnt = 1;
    int r = a;
    while(a < b){
        a += (r - 1);
        cnt++;
    }
    cout << cnt;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const ld INF=1e10;
typedef pair<int,int> PI;
PI point[100010][2];
struct Node{
	int x,y,idx;
};
inline bool cmp_inc(const Node& a,const Node& b){
	return a.x!=b.x?a.x<b.x:a.y<b.y;
}
inline bool cmp_dec(const Node& a,const Node& b){
	return a.x!=b.x?a.x>b.x:a.y>b.y;
}
vector<Node> bound_nd[4];
int R,C,N;
inline bool in_bound(PI& p){
	int x=p.first;
	int y=p.second;
	return x==0 || x==R || y==0 || y==C;
}
inline void push_nd(PI& p,int idx){
	int x=p.first;
	int y=p.second;
	Node tmp=(Node){x,y,idx};
	if(x==0) bound_nd[0].push_back(tmp);
	else if(x==R) bound_nd[2].push_back(tmp);
	else if(y==0) bound_nd[1].push_back(tmp);
	else if(y==C) bound_nd[3].push_back(tmp);
}
stack<int> dic;
int main(){
	scanf("%d%d%d",&R,&C,&N);
	for(int i=0;i<N;i++){
		scanf("%d%d%d%d",&point[i][0].first,&point[i][0].second,&point[i][1].first,&point[i][1].second);
		if(in_bound(point[i][0]) && in_bound(point[i][1])){
			push_nd(point[i][0],i);
			push_nd(point[i][1],i);
		}
	}
	for(int i=3;i>=0;i--){
		if(i==0 || i==3)
			sort(bound_nd[i].begin(),bound_nd[i].end(),cmp_inc);
		else
			sort(bound_nd[i].begin(),bound_nd[i].end(),cmp_dec);
		for(Node& d:bound_nd[i]){
			if(dic.empty() || dic.top()!=d.idx) dic.push(d.idx);
			else dic.pop();
		}
	}
	puts(dic.empty()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 5224
int main(void)
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(W < x+r||x-r < 0||x+r < 0||H < y+r||y-r < 0||y+r < 0)
		printf("No\n");
	else
		printf("Yes\n");
	
	return 0;
}

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

#define show(x) cout << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz=" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = 1e9 + 7;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<int> B = A;
    sort(B.begin(), B.end());
    B.erase(unique(B.begin(), B.end()), B.end());
    map<int, int> zip;
    for (int i = 0; i < B.size(); i++) {
        zip[B[i]] = i;
    }
    vector<int> num(B.size(), -1);
    for (int i = 0; i < N; i++) {
        A[i] = zip[A[i]];
        num[A[i]]++;
    }
    int cnt = (A.size() - B.size() + 1) / 2;
    cout << A.size() - 2 * cnt << endl;
    //    show(num);


    return 0;
}


Measured memory_bytes: 6144
import sys
input=sys.stdin.readline
N,W=map(int,input().split())
max_v=10**5
DP=[0]+[float('inf')]*max_v #DP[i]: 価値iを達成するための最小重量
for _ in range(N):
    w,v=map(int,input().split())
    for i in range(max_v,v-1,-1):
        DP[i]=min(DP[i],DP[i-v]+w)
ans=0
for v,w in enumerate(DP):
    if w<=W:
        ans=v
print(ans)

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

const int MAX_N = 51;
int mp[MAX_N][MAX_N];
ll X[MAX_N], Y[MAX_N];
pair<ll, ll> dot[MAX_N];
int N, K;

int minmp(int i, int j) {
    if(i >= 0 && j >= 0) return mp[i][j];
    else return 0;
}

int main()
{
    cin >> N >> K;
    for(int i = 0; i < N; ++i) {
        cin >> dot[i].first >> dot[i].second;
        X[i] = dot[i].first, Y[i] = dot[i].second;
    }
    
    sort(X, X + N);
    sort(Y, Y + N);

    /*
    for(int i = 0; i < N; ++i) {
        cout << X[i] << " ";
    }
    cout << endl;
    for(int i = 0; i < N; ++i) {
        cout << Y[i] << " ";
    }
    cout << endl;
    */

    for(int i = 0; i < N; ++i) {
        int nx = lower_bound(X, X + N, dot[i].first) - X;
        int ny = lower_bound(Y, Y + N, dot[i].second) - Y;
        ++mp[nx][ny];
    }

    /*
    cout << endl;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cout << mp[i][j] << " ";
        }
        cout << endl;
    }
    */

    //2次元累積和
    
    for(int i = 0; i < N; ++i) {
        for(int j = 1; j < N; ++j) 
            mp[i][j] += mp[i][j-1];
    }
    for(int i = 1; i < N; ++i) {
        for(int j = 0; j < N; ++j) 
            mp[i][j] += mp[i-1][j];
    }
    
    /*
    cout << endl;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cout << mp[i][j] << " ";
        }
        cout << endl;
    }
    */

    ll res = LLONG_MAX;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            for(int k = i + 1; k < N; ++k) {
                for(int l = j + 1; l < N; ++l) {
                    //累積和の取り方か、使い方がミスっていたらしい...
                    // num = の式に;が余分に入っていたらしい...
                    int num = minmp(k, l) - minmp(i-1, l)- minmp(k, j-1) + minmp(i-1, j-1);
                    
                    if(num >= K) {
                        /*
                        cout << i << " " << j << endl;
                        cout << k << " " << l << endl;
                        cout << endl;
                        */
                        ll S = 1LL * (X[k] - X[i]) * (Y[l] - Y[j]);
                        res = min(res, S);
                    }
                    
                    /*これだとAC
                    int num = 0;
                    ll lx = X[i], rx = X[k];
                    ll by = Y[j], uy = Y[l];
                    
                    for(int m = 0; m < N; ++m) {
                        if(lx <= dot[m].first && dot[m].first <= rx
                            && by <= dot[m].second && dot[m].second <= uy)
                                ++num;
                    }
                    if(num >= K) res = min(res, (rx - lx)*(uy - by));
                    */
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	string S; cin >> S;
	map<char, int> ch2NumMap;
	for (const char ch : S)
	{
		++ch2NumMap[ch];
	}
	bool isYes = true;;
	if (ch2NumMap.count('N') > 0 || ch2NumMap.count('S') > 0)
	{
		if (ch2NumMap.count('N') == 0 || ch2NumMap.count('S') == 0)
		{
			isYes = false;
		}
	}
	if (ch2NumMap.count('E') > 0 || ch2NumMap.count('W') > 0)
	{
		if (ch2NumMap.count('E') == 0 || ch2NumMap.count('W') == 0)
		{
			isYes = false;
		}
	}
	cout << (isYes ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
 int main()
 {
     ios_base::sync_with_stdio(false);
     int t;
     cin>>t;
     map<ll,ll> mp;
     while(t--)
     {
         ll l;
         cin>>l;
        
         if (!mp[l])
            mp[l]++;
         else
            mp[l]--;
     }
     ll ans=0;
     for(auto i:mp)
     {
         ans+=i.second;
     }
     cout<<abs(ans);
  return 0;   
 }
 

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define MAX 100005
#define INF 2e9
#define ll long long int
#define fastRead ios::sync_with_stdio(0);cin.tie(0);

using namespace std;
int n ,W;
ll v[200] , w[200] ,dp[200][MAX];

int main()
{
	fastRead;
	cin>>n>>W;

	for(int i =1 ; i<= n ; i++ ) cin>>w[i]>>v[i];

    for(int i = 1 ; i <= n ; i++ ) {

        for(int j =1 ; j <= W ; j++ ) {

            if(w[i] <= j ) {
                dp[i][j] = max(dp[i-1][j] , dp[i-1][j - w[i]]  + v[i]);
            }
            else dp[i][j] = dp[i-1][j];
        }
    }

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

}


Measured memory_bytes: 79360
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define repd(i,x,y) for(int i=x; i>=y; --i)
 
using namespace std;
const int N=2005,mod=1000000007;
typedef long long LL;
int n,k,c[N],ans;
LL flv[N*N],inv[N*N],f[N][N];
 
void dfs(int x,int tp)
{
    if(x>n*k) 
    {
        ans=(ans+1)%mod;
        return;
    }
    if(!tp) 
    {
        if(c[0]) --c[0],dfs(x+1,tp+1),++c[0];
        rep(i,1,n) if(c[i]!=k-1 && c[i]) --c[i],dfs(x+1,tp),++c[i];
    }
    else
    {
        if(c[0]) --c[0],dfs(x+1,tp+1),++c[0];
        rep(i,1,n) if(c[i]) --c[i],dfs(x+1,tp-(c[i]==k-2)),++c[i];
    }
}
 
void task1()
{
    c[0]=n;
    rep(i,1,n) c[i]=k-1;
    dfs(1,0);
    printf("%d\n",ans);
}
 
LL getmi(LL a,int x)
{
    LL rt=1;
    while(x)
    {
        if(x&1) rt=rt*a%mod;
        a=a*a%mod,x>>=1;
    }
    return rt;
}
 
LL C(int n,int m)
{
    return n<m?0:flv[n]*inv[m]%mod*inv[n-m]%mod;
}
 
void inc(LL &x,int y)
{
    if((x+=y)>=mod) x-=mod;
}
 
void task2()
{
	if(k==1) {puts("1"); return;}
    flv[0]=1;
    rep(i,1,n*k) flv[i]=flv[i-1]*i%mod;
    inv[n*k]=getmi(flv[n*k],mod-2);
    repd(i,n*k,1) inv[i-1]=inv[i]*i%mod;
    f[0][0]=1;
    rep(i,1,n)
        rep(j,0,i)
        {
            f[i][j]=f[i-1][j];
            if(j) f[i][j]=(f[i][j]+f[i][j-1]*C(n-i+(k-1)*(n-j+1)-1,k-2))%mod;
        }
    printf("%lld\n",flv[n]*f[n][n]%mod);
}
 
int main()
{
    scanf("%d%d",&n,&k);
    task2();
    return 0;
}

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

#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n" 
#define all(c) c.begin(),c.end()
#define present(c,element) (c.find(element)!=c.end())
#define cpresent(c,element) (find(c,element)!=c.end())
#define forr(i,a,b) for(int i=a;i<int(b);i++)
#define tr(i,a) for(auto i:a)
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
const double PI=acos(-1);
const ll mod=1e9+7;

// vector<int> adj[100005];
// vi dp(100005, 0);
// vector<bool> vis(100005, false);

// void dfs(int v)
// {
// 	vis[v]=true;
// 	for(int i=0;i<adj[v].size();i++)
// 	{
// 		if(!vis[adj[v][i]])
// 			dfs(adj[v][i]);
// 		dp[v]=max(dp[v], 1+dp[adj[v][i]]);
// 	}
// }

void add(ll &a, ll b)
{
    a+=b;
    if(a>=mod)a-=mod;
}
void sub(ll &a, ll b)
{
    a-=b;
    if(a<0)a+=mod;
}
ll mul(ll a, ll b)
{
    return ((a*b)%mod);
}



int32_t main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int test=1;
//cin>>test;
while(test--)
{
	int h, w, x, y;
	cin>>h>>w;
	char a[h][w];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>a[i][j];
		}
	}
	ll dp[h][w];
	dp[0][0]=1;
	for(int i=1;i<h;i++)
	{
		if(a[i][0]=='#')dp[i][0]=0;
		else dp[i][0]=dp[i-1][0];
	}
	for(int i=1;i<w;i++)
	{
		if(a[0][i]=='#')dp[0][i]=0;
		else dp[0][i]=dp[0][i-1];
	}
	
	for(int i=1;i<h;i++)
	{
		for(int j=1;j<w;j++)
		{
			if(a[i][j]=='#')
				dp[i][j]=0;
			// else if(a[i-1][j]=='#'&&dp[i][j-1]=='#')
			// 	dp[i][j]=0;
			// else if(dp[i-1][j]=='#')
			// 	dp[i][j]=dp[i][j-1];
			// else if(dp[i][j-1]=='#')
			// 	dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;

		}
	}
	// forr(i,0,h)
	// {
	// 	forr(j,0,w)
	// 	cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }
	cout<<dp[h-1][w-1]<<endl;

}
return 0;
}










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

int main(){
  array<int, 32> arr = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int a;
  cin >> a;
  cout << arr.at(a-1) << '\n';
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
AC

19
1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1
*/

long long modinv(long long a, long long mod) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a/b;
        a -= t*b; swap(a, b);
        u -= t*v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

template<typename T>
void polynomial_division(vector<T> a, const vector<T> &b, T mod, vector<T> &ans){
	int n = a.size(), m = b.size();
	ans.assign(n-m+1,0);
	for(int i=0; i+m-1<n; i++){
		if(a[n-1-i]==0)continue;
		T r = (a[n-1-i]/b[m-1])%mod;
		ans[n-m-i]=r;
		for(int j=0; j<m; j++){
			a[n-1-i-j]=(a[n-1-i-j]+mod-(r*b[m-1-j])%mod)%mod;
		}
	}
}

// LIBRARY END

ll p,a[3001],b[3001];
vector<ll> mot,ans;

void init(){
	cin>>p;
	rep(i,p)cin>>a[i];
	ans.assign(p,0);
	mot.assign(p+1,0);
	mot[p]=1; mot[1]=-1;
}

int main(void){
	init();
	rep(i,p){
		vector<ll> div_pol={-i,1};
		vector<ll> v;
		polynomial_division(mot,div_pol,p,v);
		rep(j,p)v[j] = ((v[j]%p)+p)%p;
		ll div=1;
		rep(j,p){
			if(j!=i){
				div=(div*(i-j))%p;
			}
		}
		div=((div%p)+p)%p;
		div = modinv(div,p);
		rep(j,p)ans[j]=(ans[j]+a[i]*v[j]*div)%p;
	}
	// Verification
	bool ok=true;
	rep(i,p){
		ll x=1,tmp=0;
		rep(j,p){
			tmp = (tmp+x*ans[j])%p;
			x=(x*i)%p;
		}
		if(tmp!=a[i])ok=false;
	}
	cerr<<(ok?"大丈夫":"ダメ")<<endl;
	// print the answer
	rep(i,ans.size())cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i=1; i<n-1; i++) {
    int count = 0;
    vector<char> c1(i);
    vector<char> c2(n-i);
    for(int j=0; j<i; j++) {
      c1.at(j) = s.at(j);
    }
    for(int j=0; j<n-i; j++) {
      c2.at(j) = s.at(i+j);
    }
    sort(c1.begin(), c1.end());
    sort(c2.begin(), c2.end());
    for(int j=0; j<i; j++) {
      if(j<i-1) {
        if(c1.at(j) == c1.at(j+1)) {
          continue;
        }
      }
      for(int k=0; k<n-i; k++) {
        if(k<n-i-1) {
          if(c2.at(k) == c2.at(k+1)) {
            continue;
          }
        }
        if(c1.at(j) == c2.at(k)) {
          count++;
        }
      }
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
}

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

int main()
{
  int n, tmp;
  double ave, var;

  cout << setprecision(10);
  for (;;) {
    cin >> n;
    if (n == 0) break;
    ave = var = 0;
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      ave += tmp;
      var += tmp*tmp;
    }
    ave /= n;
    var = var/n - ave*ave;
    cout << sqrt(var) << endl;
  }
  return 0;
}


Measured memory_bytes: 3240
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
long long a[10];
int main()
{
	long long ans=0;
	for(int i=1;i<=7;i++)
		scanf("%lld",&a[i]);
	ans=a[1]/2*2+a[2]+a[4]/2*2+a[5]/2*2;
	if(a[1]&&a[4]&&a[5])
	{
		a[1]--;
		a[4]--;
		a[5]--;
		ans=max(ans,3+a[1]/2*2+a[2]+a[4]/2*2+a[5]/2*2);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>

using namespace std;

int main()
{
    string tenki;
    cin >> tenki;
    if(tenki=="Sunny") { cout << "Cloudy" << endl; }
    else if(tenki=="Cloudy") { cout << "Rainy" << endl; }
    else { cout << "Sunny" << endl; } 
}

Measured memory_bytes: 256