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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int a,b,c,d,e;
  string s,ss;
  cin>>a>>b;
  if(b>=a)
  cout<<a<<endl;
  else
    cout<<a-1<<endl;
  return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int sum = 0;
		if(a > b) {
			sum += a--;
			sum += Math.max(a, b);
		}else {
			sum += b--;
			sum +=Math.max(a, b);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
   int A,B,M;
   cin>>A>>B>>M;
   int Mini_a=200000;
   int Mini_b=200000;
   vector<int> a(A),b(B);
   for(int i=0;i<A;i++){
      cin>>a[i];
      Mini_a=min(Mini_a,a[i]);
   }
   for(int i=0;i<B;i++){
      cin>>b[i];
      Mini_b=min(Mini_b,b[i]);
   }
   vector<int> x(M),y(M),c(M);
   for(int i=0;i<M;i++){
      cin>>x[i]>>y[i]>>c[i];
   }
   int ans=1000007;
   for(int i=0;i<M;i++){
      int sum=a[x[i]-1]+b[y[i]-1]-c[i];
      ans=min(ans,sum);
   }
   cout<<min(ans,Mini_a+Mini_b)<<endl;
   return 0;
}


Measured memory_bytes: 5060
#define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iterator>
#include <vector>
#include <string>
#include <string.h>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <map>
#include <regex>
#include <sstream>
#include <utility>
#include <list>
#include <unordered_set>
#include <unordered_map>
#define endl	'\n'
#define MOD 1000000

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
int dx[] = { 0,1,0,-1 };
int dy[] = { -1,0,1,0 };
int dz[] = { 0,0,0,0,1,-1 };
const int INF = 1000000000;

vector<int> pos[30];

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



	string a, b;
	cin >> a >> b;

	for (int i = 0; i < a.size(); i++) {
		pos[a[i] - 'a'].push_back(i + 1);
	}

	for (int i = 0; i < 30; i++) sort(pos[i].begin(), pos[i].end());

	ll ans = 0;

	if (pos[b[0] - 'a'].empty()) {
		cout << -1;
		return 0;
	}

	int cur = pos[b[0] - 'a'].front();

	for (int i = 1; i < b.size(); i++) {
		int idx = b[i] - 'a';

		if (pos[idx].empty()) {
			cout << -1;
			return 0;
		}

		auto it = upper_bound(pos[idx].begin(), pos[idx].end(), cur);
		if (it == pos[idx].end()) {
			ans += a.size();
			cur = pos[idx][0];
		}
		else cur = (*it);
	}

	ans += cur;
	cout << ans;
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

const int MAX_N = 2000;
int N, K;
vector<int> G[MAX_N];
int d[MAX_N][MAX_N];
pii e[MAX_N - 1];

void dfs(int v, int par, int root, int dist) {
    d[root][v] = dist;
    for (int c:G[v]) {
        if (c == par)continue;
        dfs(c, v, root, dist + 1);
    }
}

void distance() {
    rep(i, N) {
        dfs(i, -1, i, 0);
    }
}

signed main() {
    cin >> N >> K;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
        e[i] = pii(a, b);
    }
    distance();
    int ans = INF;
    if (K % 2 == 0) {
        rep(i, N) {
            int tmp = 0;
            rep(j, N) {
                if (d[i][j] > K / 2)tmp++;
            }
            ans = min(ans, tmp);
        }
    } else {
        rep(i, N - 1) {
            int a = e[i].first;
            int b = e[i].second;
            int tmp = 0;
            rep(j, N) {
                if (d[a][j] > (K - 1) / 2 && d[b][j] > (K - 1) / 2)tmp++;
            }
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int n;
  cin >> n;
  vector<vector<int>> data(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> data.at(i).at(j);
    }
  }
  vector<int> dec(n);
  rep(i,n) {
    if (data.at(i).at(0) == data.at(i).at(1)) {
      dec.at(i) = 0;
    } else {
      dec.at(i) = 1;
    };
  };
  
  int a = 1;
  
  rep(i,n-2) {
    if (dec.at(i) == 0 && dec.at(i+1) == 0 && dec.at(i+2) == 0) {
      a = 0;
      break;
    };
  };
  
  if (a == 0 ) {
    cout << "Yes";
  } else if (a == 1) {
    cout << "No";
  }
}

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

int main() {
	int q;
	cin >> q;
	int g = 0;
	if (q == 2) {
		cout << 2 << endl;
		return 0;
	}
	for (q; q < 10000001; q++) {
		for (int i = 2; i < q; ++i) {
			if (q % i == 0) {
				break;
			}
			if (q - 1 == i) { g = 1; }
		}
		if (g == 1) {
			cout << q << endl;
			return 0;
		}
	}
}

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

#define yes "yes"
#define Yes "Yes"
#define no "no"
#define No "No"

namespace mydef
{
  void say(string some){
    cout << some << "\n";
  }
} // namespace mydef
using namespace mydef;
using P = pair<int,int>;
typedef long long ll;
const int INF = 1001001001;
const long double PI=3.14159265358979323846;

//ここからいじる
signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x, n;
  cin >> x >> n;
  vector<int> d(102);
  rep(i, n){
    int p;
    cin >> p;
    d[p] = 1;
  }
  P ans(99999, -1);
  for (int i = 0; i <= 101; i++)
  {
    if (d[i] == 1) continue;
    int dif = abs(x-i);
    ans = min(ans, P(dif, i));
  }
  cout << ans.second << "\n";
  

  return 0;
}




Measured memory_bytes: 3636
#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 n,l;
  cin >> n >> l;
  string s[100];
  rep(i,n) cin >> s[i];
  sort(s,s+n);
  rep(i,n) cout << s[i];
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // Input
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        HashSet<Integer> s = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            s.add(scanner.nextInt());
        }

        int q = scanner.nextInt();
        int result = 0;
        for (int i = 0; i < q; i++) {
            int t = scanner.nextInt();
            if (s.contains(t)) {
                result++;
            }
        }
        System.out.println(result);
        scanner.close();
    }
}



Measured memory_bytes: 91788
#include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = int(l), __border_right##i = int(r); i < __border_right##i; i++)
#define STRUCT3(v1, v2, v3, name) struct name \
        {   \
            int v1, v2, v3; \
            name(int v1 = 0, int v2 = 0, int v3 = 0) : v1(v1), v2(v2), v3(v3) {} \
            friend bool operator < (const name& athis, const name& other) \
            {   \
                if (athis.v1 != other.v1) return athis.v1 < other.v1;   \
                if (athis.v2 != other.v2) return athis.v2 < other.v2;   \
                return athis.v3 < other.v3;   \
            }\
        }
#define PB push_back
#define LS (((k) << 1) + 1)
#define RS (((k) << 1) + 2)
#define LM ((l) + (r) >> 1)
#define RM (LM + 1)
#define LOG(x) tb[(UI(x) * (UI)263572066) >> 27]
#define FST first
#define SCD second
#define retunr return
#define modp 1000000007
#define EPS 1e-7
#define INF 0x3f3f3f3f
#define MAX2 113
#define MAX3 1013
#define MAX4 10013
#define MAX5 100013
#define MAX6 1000013
#define MAXN 2 * MAX5
#define MANX MAXN
using namespace std;
typedef long long LL;
typedef unsigned int UI;
//typedef pair<int, int> P;
const UI tb[32] = {13, 0, 27, 1, 28, 18, 23, 2, 29, 21, 19, 12, 24, 9, 14, 3, 30, 26, 17, 22, 20, 11, 8, 13, 25, 16, 10, 7, 15, 6, 5, 4};
typedef pair<LL,int> PAL;
typedef pair<int,int> PA;

int n,m;

const int N = 1e6 + 7;
char s[N], exts[N << 1];
//int p[N << 1], len;
//int ans[N << 1];
//
//void manacher() {
//    int mx = 0, id = 0;
//    len = n;
//    for (int i = 0; i < len; ++ i) {
//        exts[2 * i + 1] = '#';
//        exts[2 * i + 2] = s[i];
//    }
//    exts[0] = '$', exts[2 * len + 1] = '#', exts[2 * len + 2] = '\0';
//    for (int i = 1; i <= 2 * len + 1; ++ i) {
//        if (mx > i) {
//            p[i] = min(p[2 * id - i], mx - i);
//        } else {
//            p[i] = 1;
//        }
//        while (exts[i + p[i]] == exts[i - p[i]]) {
//            p[i] ++;
//        }
//        if (i + p[i] > mx) {
//            mx = i + p[i];
//            id = i;
//        }
//    }
//}

int cnt[30];

int main()
{
#ifndef ONLINE_JUDGE
    // freopen("in.txt", "r", stdin);
    // freopen("out1.txt", "w", stdout);
#endif
    int T;
    // scanf("%d", &T);
    scanf("%s",s);
    n=strlen(s);
    LL ans = (LL)n*(n+1)>>1;
    ++ans;
    LL k=0;
    for (int i=0;i<n;++i) {
        ++cnt[s[i]-'a'];
        k+=cnt[s[i]-'a'];
    }
    cout<<ans-k<<endl;
    return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int N; scanf("%d", &N);
	int A[100], B[100], C[100];
	for (int i = 0; i < N; i++){
		scanf("%d", A + i);
	}
	for (int i = 0; i < N; i++){
		scanf("%d", B + i);
	}
	for (int i = 0; i < N-1; i++){
		scanf("%d", C + i);
	}

	int ret = B[A[0] - 1];
	for(int i = 1; i < N; i++){
		ret += B[A[i] - 1];
		if (A[i - 1] + 1 == A[i]){
			ret += C[A[i - 1]-1];
		}
	}
	printf("%d", ret);
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

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

	alphabet := make([]int, 26)
	for _, a := range s {
		alphabet[a-'a']++
	}

	ans := 1
	for _, a := range alphabet {
		ans = (ans * (a + 1)) % 1000000007
	}

	ans = ans - 1
	fmt.Println(ans)
}


Measured memory_bytes: 1280
x, y = map(int, input().split())
if x >= 0 and y >= 0 and x <= y:
  ans = y - x
elif x >= 0 and y > 0 and x >= y:
  ans = x -  y + 2
elif x <= 0 and y <= 0 and x <= y:
  ans = y - x
elif x < 0 and y <= 0 and x >= y:
  ans = x - y + 2
elif x >= 0 and y <= 0:
  ans = abs(x - abs(y)) + 1
elif x <= 0 and y >= 0 and abs(x) <= y:
  ans = y - abs(x) + 1
elif x <= 0 and y >= 0 and abs(x) > y:
  ans = abs(x) - y + 1
print(ans)

Measured memory_bytes: 9132
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define mod 1000000007
#define pie 3.141592653589793238462643383279
#define prique priority_queue
using namespace std;
P p[510];
signed main(){
	int n,sum=0;
	cin>>n;
	f(i,n){
		cin>>p[i].F;
		p[i].S=i+1;
	}
	sort(p,p+n);
	f(i,n){
		if(sum+p[i].S>p[i].F||n*(n-1)/2+1-sum+i*(n+1)<p[i].F){
			puts("No");
			return 0;
		}
		sum+=p[i].S;
	}
	puts("Yes");
	int cnt=1;
	f(i,n){
		f(j,p[i].S-1){
			if(cnt==p[lower_bound(p,p+n,make_pair(cnt,(int)(0)))-p].F){
				cout<<p[lower_bound(p,p+n,make_pair(cnt,(int)(0)))-p].S<<" ";
				j--;
			}
			else cout<<p[i].S<<" ";
			cnt++;
		}
	}
	f(i,n){
		f(j,n-p[i].S){
			if(cnt==p[lower_bound(p,p+n,make_pair(cnt,(int)(0)))-p].F){
				cout<<p[lower_bound(p,p+n,make_pair(cnt,(int)(0)))-p].S<<" ";
				j--;
			}
			else cout<<p[i].S<<" ";
			cnt++;
		}
	}
	for(int i=cnt;i<=n*n;i++){
		cout<<p[lower_bound(p,p+n,make_pair(cnt,(int)(0)))-p].S<<" ";
	}
    return 0;
}


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

int main() {
    int N; cin >> N;
    auto f = [&](auto &&f, int64_t n, int used) -> int {
        if(n > N) return 0;
        int res = used == 7;
        res += f(f, 10 * n + 3, used | 1);
        res += f(f, 10 * n + 5, used | 2);
        res += f(f, 10 * n + 7, used | 4);
        return res;
    };
    cout << f(f, 0, 0) << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    ll n, x;
    cin >> n >> x;
    ll a[n];
    rep(i,n) cin >> a[i];

    ll cnt = 0;
    for (int i=0; i < n-1; i++){
        ll tmp = a[i] + a[i+1] - x;
        if (a[i] + a[i+1] <= x){
            ;
        }
        else if (tmp <= a[i+1]){
            a[i+1] -= tmp;
            cnt += tmp;
        }
        else {
            tmp -= a[i+1];
            cnt += a[i+1];
            a[i+1] = 0;
            a[i] -= tmp;
            cnt += tmp;
        }
    }


    cout << cnt << endl;

}





//              g++ -std=c++1z


Measured memory_bytes: 1024
import collections
n = int(input())
dic = {}
for i in range(n):
    S = input()
    S_col = collections.Counter(S)
    if  i == 0:
        dic = S_col
    else:
        for key,val in dic.items():
            if key in S_col:
                dic[key] = min(dic[key],S_col[key])
            else:
                dic[key] = 0
s = ''
for key,val in dic.items():
    s += key*val
print(''.join(sorted(s)))

Measured memory_bytes: 9332
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = [A[i]-B[i] for i in range(N)]
if sum(A) < sum(B):
    print(-1)
    exit()
C.sort()
d = 0
ans = 0
for c in C:
    if c >= 0:
        break
    d += c
    ans += 1
C.reverse()
for i in range(N):
    if d >= 0:
        break
    d += C[i]
    ans += 1
print(ans)

Measured memory_bytes: 83888
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()

fa = []

for i in range(10**6+1):
  if i % 3 != 0 and i % 5 !=0:
    fa.append(i)

sum = 0
for i in fa:
  if i <= n:
    sum += i

print(sum)

Measured memory_bytes: 30128
N, L = list(map(int, input().split()))

aji = []
for i in range(1, N + 1):
    aji.append(L + i - 1)

a = sum(aji)

ans = 0
diff = 10**9
for i in range(N):
    s = sum(aji) - aji[i]
    t = abs(a - s)
    if t < diff:
      diff = t
      ans = s

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
 
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    ld pi=3.14159265359;
    ld r;
    cin>>r;
    cout<<fixed<<setprecision(10);
    cout<<(2.0*pi*r)<<endl;
    return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF 2000000000
#define INFLL 9000000000000000000
using namespace std;
int main(void)
{
	int n, a;

	cin>>n>>a;

	cout<<n*n-a<<endl;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main() {
    int x; cin >> x;
    cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

Measured memory_bytes: 256
n=int(input())
X=[list(map(int,input().split())) for _ in range(n)]
X.sort(key=lambda x:x[2])
a,b,c=X[-1]
for px in range(101):
    for py in range(101):
        H=abs(px-a)+abs(py-b)+c
        if all(h==max(H-abs(x-px)-abs(y-py),0) for x,y,h in X):
            print(px,py,H)
            break

Measured memory_bytes: 3064
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

struct Jewel {
    int value;
    int cost;
};
int main()
{
  ll N, K;
  cin>>N>>K;
  vector<ll> P;
  for(int i=0;i<N;i++){
    ll ai;
    cin>>ai;
    P.push_back(ai);
  }
  sort(P.begin(), P.end());
  ll ans=INT_MAX;
  for(int i=0;i<=N-K;i++){
   ans=min(ans, P[i+K-1]-P[i]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4224
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
int s[200000];
int t[200000];
int q[200000];
signed main(){
  int a,b,Q;
  cin >> a >> b >> Q;
  s[0] = -INF;
  t[0] = -INF;
  REP(i,a) cin >> s[i+1];
  REP(i,b) cin >> t[i+1];
  s[a+1] = INF;
  t[b+1] = INF;
  REP(i,Q){
    int now;
    cin >> now;
    int ah = s[lower_bound(s,s+a+2,now)-s-1];
    int am = *lower_bound(s,s+a+2,now);
    int bh = t[lower_bound(t,t+b+2,now)-t-1];
    int bm = *lower_bound(t,t+b+2,now);
    int ans = min(max(abs(now-ah),abs(now-bh)),max(abs(now-am),abs(now-bm)));
    ans = min({ans,abs(now-ah)*2+abs(now-bm),abs(now-am)*2+abs(now-bh),abs(now-bh)*2+abs(now-am),abs(now-bm)*2+abs(now-ah)});
    cout << ans << endl;
  }
  return 0;
}


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

int main(){
	map <int,int> arr;
	int a,b,c,d,count=0;
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>b;
		arr[b]=b;
	}
	cin>>c;
	for(int i=0;i<c;i++){
		cin>>d;
		if(arr.count(d))count++;
	}
	cout<<count<<endl;
	return 0;
}



Measured memory_bytes: 7696
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	double a, b, x;
	cin >> a >> b >> x;
	if(x * 2 >= a * a * b){
		b -= x / (a * a);
		printf("%.10f\n", atan2(2 * b, a) * 180 / M_PI);
	}else{
		x /= a;
		double c = x * 2 / b;
		printf("%.10f\n", atan2(b, c) * 180 / M_PI);
	}
	return 0;
}

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

const int maxn=100010;
int n,m,a[maxn],b[maxn],ac,pe;
char c[5];

int main()
{
	int i,p;
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++)
	{
		scanf("%d%s",&p,c+1);
		if (a[p])
			continue;
		if (c[1]=='A')
		{
			ac++;
			pe+=b[p];
			a[p]=1;
		}
		else
			b[p]++;
	}
	printf("%d %d\n",ac,pe);
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    string s = "";
    int cnt = 0;
    char c;
    bool isint = false;
    bool minus = false;
    while((c = getchar()) != EOF) {
        if (c >= '0' && c <= '9') {
            if (isint) {
                s += c;
                isint = true;
            }else if (!minus) {
                s = "";
                s += c;
                isint = true;
            }
        }else if (isint) {
            cnt += stoi(s);
            s = "";
            isint = false;
            if (c == '-') {
                minus = true;
            }else {
                minus = false;
            }
        }else {
            isint = false;
            if (c == '-') {
                minus = true;
            }else {
                minus = false;
            }
        }
    }
    if (s != "") {
        cnt += stoi(s);
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3076
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class APayment {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      n %= 1000;
      if (n == 0) {
        cout << 0 << endl;
      } else {
        cout << 1000-n << endl;
      }
    }
};

signed main() {
  APayment solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main()
{
  string s;
  cin >> s;
  if (s == "AAA" || s == "BBB"){
       cout << "No" << endl;
  }else{
       cout << "Yes" << endl;
  }
    return 0;
}


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

int main(){
    string s;
    cin >> s;
    int num=0, ans=0;
    for(int i = 0; i < (int)s.size(); i++)
    {
        if(s[i]=='A' || s[i]=='C' || s[i]=='G'||s[i]=='T'){
            num++;
        }
        else{
            ans = max(ans, num);
            num=0;

        }
    }
    ans = max(ans, num);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
from collections import Counter


def solve(string):
    n, *a = map(int, string.split())
    table = [True] * (10**6 + 1)
    ma = max(a)
    for _a in a:
        if table[_a]:
            for i in range(2 * _a, ma + 1, _a):
                table[i] = False
    return str(sum(table[k] for k, v in Counter(a).items() if v == 1))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 44868
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    N, P = map(int, input().split())
    S = input().strip("\n")
    modSum = 0
    modDict = defaultdict(int)
    modDict[0] += 1
    ans = 0

    if P == 2 or P == 5:
        for i in range(N):
            if int(S[i]) % P == 0:
                ans += i + 1
        
    else:
        for i in range(N):
            modSum += int(S[N-i-1]) * pow(10, i, P)
            modSum %= P
            modDict[modSum] += 1

        for key in modDict:
            v = modDict[key]
            ans += v * (v - 1) // 2
    
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 10040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>Vl;
typedef pair<ll,ll>PII;
typedef vector<PII>Vll;
typedef vector<pair<ll,pair<ll,ll> > >Vlll;
typedef priority_queue<ll>PQL;
typedef map<ll,ll>MP;
#define S second;
#define F first;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end));i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mod 1000000009
#define MAX 100005
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define rf(i,a,b) for(int i=(a);i>=b;i--)
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
#define vpshVar() int main()

/* One********Day*****I*****WILLL*****TALK****HER************/

vpshVar(){
    ll N,K;
    sl(N);sl(K);
    pl(N-K+1);

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i< n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> state;
const int INF = 1 << 29;
const double EPS = 1e-10;

struct edge{
  int cost;
  int to;
  edge(){};
  edge(int to, int cost){
    this->to = to;
    this->cost = cost;
  }
};

vector<edge> G[200];
int memo[200][200];

int main(){
  int n, m, C;
  int f, t, c;
  while(cin >>n >> m >> C && (n || m || C)){
    int res = INF;
    fill(&memo[0][0], &memo[0][0] + 200 * 200, INF);
    rep(i, 200) G[i].clear();

    rep(i, m){
      cin >> f >> t >> c;
      f--, t--;
      G[f].push_back(edge(t, c));
    }
    priority_queue<state, vector<state>, greater<state> > que;
    memo[0][0] = 0;
    que.push(state(0, P(0, 0)));
    while(!que.empty()){
      state s=que.top(); que.pop();
      int cost = s.first;
      int pos = s.second.first;
      int cnt = s.second.second;
      if(cost > memo[pos][cnt]) continue;
      if(pos == n - 1 && cost <= C) res = min(res, cnt);
      rep(i, (int)G[pos].size()){
	int nxt = G[pos][i].to;
	int need = G[pos][i].cost;
	if(cnt < n && need + cost < memo[nxt][cnt]){
	  memo[nxt][cnt] = need + cost;
	  que.push(state(need + cost, P(nxt, cnt)));
	}
	if(cnt + 1 < n && cost < memo[nxt][cnt+1]){
	  memo[nxt][cnt+1] = cost;
	  que.push(state(cost, P(nxt, cnt + 1)));
	}
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1380
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = 0;
		String S = sc.next();
		for(int i=0;i<S.length();i++) {
			switch(S.charAt(i)){
				case '+':
					N++;
					break;
				case '-':
					N--;
					break;
				default:
						
			}
		}
		System.out.println(N);
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  ll n,k,cnt=0;
  cin>>n>>k;
  rep(i,k+1,n+1){
    ll b=i;
    ll cnt1=n/b;
    cnt+=(b-k)*cnt1;
    cnt+= max((n%b)-k+1,0LL);
    // cout<<i<<" "<<cnt<<" "<<cnt1<<endl;
  }
  if(k==0) cnt-=n;
  cout<<cnt<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);

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

    vector<int> dp(k + 1);
   
    for(int i = 0; i < a[0]; i++)
    {
        dp[i] = 2;
    }

    for(int i = a[0]; i <= k; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(i - a[j] >= 0)
            {
                if(dp[i - a[j]] == 2)
                {
                    dp[i] = 1;
                    break;
                }
                else
                {
                    dp[i] = 2;
                }          
            }
            else
            {
                dp[i] = 2;
            }
        }
    }

    // for(int i = 0; i <= k; i++)
    // {
    //     cout << dp[i] << " ";
    // }

    // cout << "\n";
    
    if(dp[k] == 1)
    {
        cout << "First";
    }
    else
    {
        cout << "Second";
    }
    
    
    return 0;
}

Measured memory_bytes: 3796
#include<stdio.h>
int main()
{
    int N;
    int tmp1,tmp2,x1,y1,x2,y2;
    int sum = 0;
    int flag=1;
    scanf("%d",&N);
    scanf("%d%d%d",&tmp1,&x1,&y1);
    if(tmp1>=x1+y1&&(tmp1-x1-y1)%2==0)flag=1;
    else flag=0;
        for(int i=1;i<N;i++)
        {
            x2 = x1;
            y2 = y1;
            tmp2 = tmp1;
            scanf("%d%d%d",&tmp1,&x1,&y1);
            if(flag==1){
            int X = x1-x2>0?x1-x2:x2-x1;
            int Y = y1-y2>0?y1-y2:y2-y1;
            if(tmp1-tmp2<X+Y||(tmp1-tmp2-X-Y)%2!=0)
               flag = 0;
            }
        }
    if(flag==1)printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int date(int y,int m,int d){
	int day=1,e=0,a;
	for(int i=1;i<1000;i++){
		if(i%3!=0){
			day+=195;
		}else{
			day+=200;
		}
	}
	for(int j=1;j<y;j++){
		if(j%3!=0){
			e+=195;
		}else{
			e+=200;
		}
	}
	if(y%3==0){
		e+=(m-1)*20+d;
	}else{
		for(int k=1;k<m;k++){
			if(k%2==0){
				e+=19;
			}else{
				e+=20;
			}
		}
		e+=d;
	}
	a=day-e;
	return a;
}


int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int y,m,d,x;
		cin>>y>>m>>d;
		x=date(y,m,d);
		cout<<x<<endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)

typedef long long ll;
const ll mod=998244353;

set<int> G[1<<18];
set<int> H[1<<18];
void solve(){
    int n;cin>>n;
    rep(i,n-1){
        int a,b;cin>>a>>b;a--;b--;
        G[a].insert(b);
        G[b].insert(a);
    }
    rep(i,n-1){
        int a,b;cin>>a>>b;a--;b--;
        H[a].insert(b);
        H[b].insert(a);
    }
    ll ans=(ll)n*n+6*n-7;
    ll c=0;
    rep(i,n){
        for(auto itr=G[i].begin();itr!=G[i].end();itr++){
            int z=*itr;
            if(i<z){
                c+=H[i].size();
                c+=H[z].size();
                if(H[i].count(z))c--;
            }
        }
    }
    ans-=c;
    ans=(ans%mod+mod)%mod;
    ll inv2=(mod+1)/2;
    rep(i,4){
        ans=ans*inv2%mod;
    }cout<<ans<<endl;


}
int main(){
    solve();
    return 0;
}


Measured memory_bytes: 65176
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;


int N, M, Q;

vector <int> A, B, C, D;
vector <vector <int>> cand;
vector <vector <int>> cond;

void make_list(int pos, int my_number, vector <int> result) {

	if (pos == N) {
		result.push_back(-1);
		for (int i = my_number; i <= M; i++) {
			result.pop_back();
			result.push_back(i);
			cand.push_back(result);
		}
		return;
	}
	else {
		result.push_back(my_number);
		make_list(pos + 1, my_number, result);

		if (my_number < M) {
			result.pop_back();
			make_list(pos, my_number + 1, result);
		}
	}
}


int main() {
	int i, j, k;
	ull score, max_score;
	int a, b, c, d;
	

	cin >> N >> M >> Q;

	for (i = 0; i < Q; i++) {
		cin >> a >> b >> c >> d;
		cond.push_back(vector<int> {a,b,c,d });
	}

	for (int k = 1; k <= M; k++) {
		vector <int> my_result;
		my_result.push_back(k);
		make_list(1, k, my_result);
	}

	max_score = 0;
	
	for (auto result : cand) {
		score = 0;
		int k = 0;
		for (auto v : cond) {
			int a, b, c, d;
			a =v.at(0);
			b = v.at(1);
			c = v.at(2);
			d = v.at(3);

			if (result.at(b) - result.at(a) == c) {
				// cout << result.at(a) << " " << result.at(b) << " " << c << " " << d << endl;
				score += d;
			}
		}


		if (max_score < score)
			max_score = score;
	}
	cout << max_score << endl;

}


Measured memory_bytes: 17308
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, K) = Slice2<long>();
            var Ai = Sarray();
            var dct = new Dictionary<long, long>();
            foreach (var a in Ai)
            {
                if (!dct.ContainsKey(a)) dct[a] = 0;
                ++dct[a];
            }
            WriteLine(dct.OrderBy(d => d.Value).Take((int)(dct.Count - K)).Sum(d => d.Value));
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 56916
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto S = readln.chomp;
    auto DP = new long[](2019);
    DP[0] = 1;
    int n, d = 1;
    foreach_reverse (c; S) {
        n = ((c - '0').to!int * d + n) % 2019;
        (d *= 10) %= 2019;
        DP[n] += 1;
    }
    long r;
    foreach (x; DP) r += x * (x-1) / 2;
    writeln(r);
}

Measured memory_bytes: 2788
p=[list(raw_input()) for i in range(8)]
plist=[p,[],[],[]]
for r in range(3):
	for j in range(8):
		plist[r+1].append([plist[r][i][j] for i in range(7,-1,-1)])
	print 90*(r+1)
	for i in range(8):
		print "".join(plist[r+1][i])

Measured memory_bytes: 4224
#include<stdio.h>
main(){
  int a,b[10],c,d,tmp,i;
  for(a=0;a<10;a++){
    scanf("%d",&b[a]);
  }
  for(c=0;c<9;c++){
    for(d=0;d<9;d++){
      if(b[d]<b[d+1]){
	tmp=b[d];
	b[d]=b[d+1];
	b[d+1]=tmp;
      }
    }
  }
  for(i=0;i<3;i++){
    printf("%d\n",b[i]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define x first
#define y second

using namespace std;

int solve()
{
	int x,y;
	cin >> x >> y;
	if(y%2 != 0)
		return 0;
	if(x*4 < y)
		return 0;
	if(x*2 > y)
		return 0;
	return 1;
}
int main() 
{
	// freopen("b.in","r",stdin);
	if(solve() == 0)
		cout << "No";
	else
		cout << "Yes";
	cout << endl;
	return 0;
}

Measured memory_bytes: 3596
# X, A  は 0 以上 9 以下の整数です。
# X が A 未満の時 0、
# A 以上の時 10 を出力してください。

input = gets.chomp.split
x = input[0].to_i
a = input[1].to_i

if x < a
  puts 0
else
  puts 10
end


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

int main(){
	int n,K;
	cin>>n>>K;
	vector<int> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i],v[i]--;
	}
	vector<int> cnt(100100);
	int c = 0;
	int p = 0;
	int ans = 1e9;
	for(int i=0;i<n;i++){
		while(p<n&&c<K){
			if(v[p]<K){
				cnt[v[p]]++;
				if(cnt[v[p]]==1) c++;
			}
			p++;
		}
		if(c==K){
			ans = min(ans, p-i);
		}
		if(v[i]<K){
			cnt[v[i]]--;
			if(!cnt[v[i]]) c--;
		}

	}
	cout<<(ans==1e9?0:ans)<<endl;
}

Measured memory_bytes: 3624
n=int(input())
a=list(map(int,input().split()))
ans=1
a.sort(reverse=True)
if a[-1]==0:
    print(0)
    exit()
for i in range(len(a)):
    ans*=a[i]
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

Measured memory_bytes: 21388
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> g(n+1);
    vector<pair<int, int>> vp;
    for(int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
        vp.emplace_back(a, b);
    }

    int k = 0;
    map<pair<int, int>, int> ans;
    vector<int> color(n+1);
    queue<int> q;
    vector<bool> is_checked(n+1, false);
    q.emplace(1);
    is_checked[1] = true;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        if(k < (int)g[v].size()) k = g[v].size();
        int cur = 1;
        for(auto x : g[v]){
            if(is_checked[x] == false){
                if(cur == color[v]) cur++;
                color[x] = cur;
                ans[make_pair(min(x, v), max(x, v))] = cur;
                cur++;
                is_checked[x] = true;
                q.emplace(x);
            }
        }
    }
    cout << k << endl;
    for(auto p : vp){
        cout << ans[p] << endl;
    }
    return 0;
}

Measured memory_bytes: 13428
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> s(n);
    cin >> s;
    if(all_of(s.begin(), s.end(), [](int x) { return x % 10 == 0; })) {
        cout << 0 << endl;
    } else {
        vector<int> not10;
        for(int x : s) {
            if(x % 10 != 0) {
                not10.push_back(x);
            }
        }
        int total = accumulate(s.begin(), s.end(), 0);
        cout << (total % 10 == 0 ? total - *min_element(not10.begin(), not10.end()) : total) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	char a[101];
  	int i,cm;
  	scanf("%s",&a);
	
  	cm  = strlen(a);
  	for(i = 0;i < cm;i++)
      printf("x");
  	printf("\n");
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}


struct Edge {
    ll a, b;
    int idx;
};

long long path[55][55];

vector<Edge> g[55];

void f(int a, ll bit, int prev, int start) {
    path[start][a] = bit;
    for (auto i : g[a]) {
        if (i.b == prev) continue;
        f(i.b, bit | (1ll << i.idx), a, start);
    }
}


void solve(long long N, std::vector<long long> a, std::vector<long long> b,
           long long M, std::vector<long long> u, std::vector<long long> v) {
    for (int i = 0; i < a.size(); i++) {
        a[i]--;
        b[i]--;
        g[a[i]].push_back({a[i], b[i], i});
        g[b[i]].push_back({b[i], a[i], i});
    }
    for (int i = 0; i < N; i++) {
        f(i, 0, -1, i);
    }
    long long ans = 0;
    for (int i = 0; i < (1 << M); i++) {
        long long merged = 0;
        for (int j = 0; j < M; j++) {
            if( i >> j & 1 ) {
                merged |= path[u[j] - 1][v[j] - 1];
            }
        }
        long long X = __builtin_popcountll(merged);
        ans += (1ll << (N - 1 - X)) * (__builtin_popcount(i) & 1 ? -1 : 1);
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N - 1);
    std::vector<long long> b(N - 1);
    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &a[i]);
        scanf("%lld", &b[i]);
    }
    long long M;
    scanf("%lld", &M);
    std::vector<long long> u(M);
    std::vector<long long> v(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &u[i]);
        scanf("%lld", &v[i]);
    }
    solve(N, std::move(a), std::move(b), M, std::move(u), std::move(v));
    return 0;
}


Measured memory_bytes: 384
n=int(input())
a=list(map(int, input().split()))

print(2*n-1)
if abs(max(a))>=abs(min(a)):
    b=a.index(max(a))
    for i in range(n):
        print(b+1,i+1)
    for i in range(n-1):
        print(i+1,i+2)
  
else:
    b=a.index(min(a))
    for i in range(n):
        print(b+1,i+1)
    for i in range(n-1):
        print(n-i,n-1-i)

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

using namespace std;

struct Node {
    int at;
    double cost; 
    int prev;
    Node(int at, double cost, int prev) : at(at), cost(cost), prev(prev) {}
    bool operator>(const Node &s) const {
        if (cost != s.cost) return cost > s.cost;
        if (prev != s.prev) return prev > s.prev; //最短経路を辞書順最小にする(省略可)
        return at > s.at;
    }
};

struct Edge {
  int to;
  double cost;  
  Edge(int to, double cost) : to(to), cost(cost) {}  
};

typedef vector<vector<Edge> > AdjList; //隣接リスト

const double INF = 1e20;
const int NONE = -1;

AdjList graph;

//sは始点、mincは最短経路のコスト、Prevは最短経路をたどる際の前の頂点
void dijkstra(int s, vector<double> &minc, vector<int> &Prev){ 
    priority_queue<Node, vector<Node>, greater<Node> > pq;
    pq.push(Node(s, 0, NONE));
    while(!pq.empty()) {
        Node x = pq.top();
        pq.pop();
        if (minc[x.at] != INF) continue;
        minc[x.at] = x.cost;
        Prev[x.at] = x.prev;
        for(int i = 0; i < (int)graph[x.at].size(); i++) {
        	Edge e = graph[x.at][i];
            if (minc[e.to] == INF) {
            	pq.push(Node(e.to, x.cost + e.cost, x.at));
            }
        }
    }
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	double xs, ys, xt, yt;
	int n;
	cin >> xs >> ys >> xt >> yt >> n;
	vector<double> x(n), y(n), r(n);
	graph = AdjList(n + 2);
	double cost;
	cost = sqrt((xs - xt) * (xs - xt) + (ys - yt) * (ys - yt));
	graph[n].emplace_back(n + 1, cost);
	graph[n + 1].emplace_back(n, cost);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		cost = max(0.0, sqrt((xs - x[i]) * (xs - x[i]) + (ys - y[i]) * (ys - y[i])) - r[i]);
		graph[i].emplace_back(n, cost);
		graph[n].emplace_back(i, cost);
		cost = max(0.0, sqrt((xt - x[i]) * (xt - x[i]) + (yt - y[i]) * (yt - y[i])) - r[i]);
		graph[i].emplace_back(n + 1, cost);
		graph[n + 1].emplace_back(i, cost);
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j < i; j++) {
			cost = max(0.0, sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) - r[i] - r[j]);
			graph[i].emplace_back(j, cost);
			graph[j].emplace_back(i, cost);
		}
	}

	vector<double> minc(n + 2, INF);
	vector<int> Prev(n + 2, NONE);

	dijkstra(n, minc, Prev);
	cout << fixed << setprecision(15) << minc[n + 1] << endl;
	return 0;
}

Measured memory_bytes: 28792
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >>n>>k;
std::vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v.at(i);  
}
for(int i=k;i<n;i++){
if(v.at(i-k)<v.at(i)){
cout<<"Yes"<<endl;  
}else{
cout<<"No"<<endl;    
}
  
}
}



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

using namespace std;

int main()
{
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    vector<int> dist(N);
    long long int ans = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
        if (i > 0)
            dist.at(i) = A.at(i) - A.at(i - 1);
    }
    dist.at(0) = K - A.at(N - 1) + A.at(0);

    sort(dist.begin(),dist.end(),greater<int>());

    for (int i = 1; i < N; i++)
        ans += dist.at(i);
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
ll pow(ll a, ll b, ll m)
{
	if(b==0)
		return(1);
	ll sol=pow(a,b/2,m);
	sol=(sol*sol)%m;
	if(b%2==1)
		sol=(sol*a)%m;
	return(sol);
}
int a[10001];
void solve()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	cout<<a[n-1]-a[0];
}

int main()
{
    int t=1,num=1;
    //cin>>t;
    while(t--)
    {	
        solve();
        //printf("Case #%d: %s\n",num,s);
		//num++;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main(){
  ll a;
  double b;
  cin >> a >> b;
  b*=100;
  b+=0.2;
  ll c=ll(b);
  a*=c;
  cout << a/100 << endl;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int n;
   cin>>n;
   
   map<string,int>mp;
   
   for(int i=0;i<n;i++)
   {
       string str;
       cin>>str;
       
       mp[str]++;
   }
   
    int ma=INT_MIN;
   
   for(auto x:mp)
   ma = max(ma,x.second);
   
   for(auto it:mp)
   {
       if(it.second==ma)
       cout<<it.first<<endl;
   }
   
}


Measured memory_bytes: 23808