akhauriyash/Code-Regression huggingface dataset:
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val c = (0 until 3).map { sc.next() }
    println(problem090a(c))
}

fun problem090a(c: List<String>): String {
    return c[0][0].toString() + c[1][1] + c[2][2]
}

Measured memory_bytes: 31132
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

P divisor(ll x){
    P ret;
    for(ll i=1;i<=1e9;i++){
        if(x%i==0 && x/i<=1e9){
          ret.fi=i;
          ret.se=x/i;
          break;
        }
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll s;
    cin>>s;
    ll now=pow(s,0.5);
    if(now<1e9) now++;
    ll x1=now,y1,x2,y2=now;
    P ret=divisor(now*now-s);
    x2=ret.fi;
    y1=ret.se;
    cout<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<' '<<0<<' '<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define DEBUGM(d,n,m,i,j) printf("DEBUGM :\n"); rep(i,n){ rep(j,m) if(inf==d[i][j]) printf("inf "); else printf("%d ", d[i][j]); printf("\n");} printf("DEBUGM END LINE\n")

typedef long long ll;

const ll INF =1LL << 62;
const int inf =1 << 29;

void dfs(vector<vector<pair<int,int> > > &g, vector<bool> &c,vector<ll> &a,int cur,ll dist){
    a[cur-1]=dist;
    c[cur-1]=true;
    rep(i,g[cur-1].size()){
        if(!c[g[cur-1][i].first-1]){
            dfs(g,c,a,g[cur-1][i].first, dist+g[cur-1][i].second);
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<bool> c(n);
    vector<ll>  a(n);
    vector<vector<pair<int,int> > > g(n);
    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >> c;
        g[a-1].push_back(mp(b,c));
        g[b-1].push_back(mp(a,c));
    }
    rep(i,n) {a[i] = -1; c[i] = false;}
    int q,k;
    cin >> q >> k;
    a[k-1] = 0; c[k-1] = true;
    dfs(g,c,a,k,0);
    rep(i,q){
        int x,y;
        cin >> x >> y;
        cout << a[x-1]+a[y-1]<<endl;
    }

    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#define N 100005
using namespace std;
typedef long long ll;
const ll mod = 1000000007LL;
int n, m;
ll x[N], y[N];
int main() {
	cin>>n>>m;
	ll totx = 0;
	ll toty = 0;
	for (int i = 0; i < n; ++i) {
		cin>>x[i];
		if (i> 0) {
			totx = (totx + (x[i]-x[i-1])*(ll)i%mod*(ll)(n-i)%mod) % mod;
		}
	}
	for (int j = 0; j < m; ++j) {
		cin>>y[j];
		if (j > 0) {
			toty = (toty + (y[j]-y[j-1])*(ll)j%mod*(ll)(m-j)%mod) % mod;
		}
	}
	cout<<totx*toty%mod<<endl;
	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int n,l, r;
  cin >> n;
  vector<int> x(n);
  vector<int> co;
  vector<int> so;
  for (int i = 0; i<n; i++){
    cin >> x[i];
  }
  
  so =x;
  sort(so.begin(), so.end());
  l = so[n/2-1];
  r = so[n/2 ];
  for (int i = 0; i<n; i++){
    if (x[i]<=l){
      cout << r << endl;
    }
    else{
      cout << l << endl;
    }
  }
}

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

int main(){
    int N;
    double ans=0;
    vector<int> v(50);
    cin >>N;
    for(int i=0;i<N;i++){
        cin >> v.at(i);
    }
    sort(v.begin(),v.end()-50+N);
    reverse(v.begin(),v.end()-50+N);
    for(int i=0;i<N-1;i++){
        double p=pow(2,i+1);
        ans+=v.at(i)/p;
    }
    ans+=v.at(N-1)/pow(2,N-1);
    cout <<ans<<endl;
}




Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.TreeMap;

public class Main {

    private int n;
    private int[] a;
    private TreeMap<Integer,Integer> s;
    
    public static void main(String[] args) {
	Main m = new Main();
	m.solve();
    }

    private void set() {
	try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
	    n = Integer.parseInt(br.readLine());
	    a = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	    s = new TreeMap<>();
	} catch(IOException e) {
	    e.printStackTrace();
	}
    }

    private void solve() {
	set();
	int ng = 0;
	int ok = n;
	while (ok-ng > 1) {
	    int k = (ng+ok)/2;
	    if (isPossible(k)) {
		ok = k;
	    } else {
		ng = k;
	    }
	}
	System.out.println(ok);
    }

    private boolean isPossible(int k) {
	s.clear();
	int current = 0;
	for (int ai : a) {
	    if (ai <= current) {
		if (k == 1) return false;
		while (!s.isEmpty() && s.lastKey() >= ai) s.pollLastEntry();
		int p = ai-1;
		while (true) {
		    if (p < 0) return false;
		    int sp = s.getOrDefault(p,0) + 1;
		    s.put(p,sp);
		    if (sp == k) {
			s.remove(p);
			p--;
		    } else {
			break;
		    }
		}
	    }
	    current = ai;
	}
	return true;
    }
}

Measured memory_bytes: 106308
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    something_on_it()
}

fn something_on_it() {
    let mut s: String = read();
    let mut cs = s.chars().collect::<Vec<char>>();
    cs.retain(|&c| c == 'o');
    let len = Vec::len(&cs);
    println!("{}", 700 + 100 * len);
}

Measured memory_bytes: 4352
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(let ((line (mapcar #'parse-integer (splitat #\space (read-line nil nil)))))
  (format t "~A~%" (* (car line) (cadr line))))


Measured memory_bytes: 24384
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    h,w = LI()
    t = [LI() for _ in range(10)]
    a = [LI() for _ in range(h)]
    e = collections.defaultdict(list)
    for i in range(10):
        for j in range(10):
            e[i].append((j,t[j][i]))

    def search(s):
        d = collections.defaultdict(lambda: inf)
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv, ud in e[u]:
                if v[uv]:
                    continue
                vd = k + ud
                if d[uv] > vd:
                    d[uv] = vd
                    heapq.heappush(q, (vd, uv))

        return d

    d = search(1)
    r = 0
    for b in a:
        for c in b:
            if c*c == 1:
                continue
            r += d[c]

    return r



print(main())




Measured memory_bytes: 7084
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what
 
using namespace std;
 
const int N = (int) 1e5 + 10;
const int M = (int) 101;
const ll big =  (1LL << 51);
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const int INF1 = (int) 1e9 + 3;
const double EPS = (double) 1e-6;
const double PI =  3.14159265359;
 
int n;
 
int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    srand(time(0));
    cin >> n;
    int ans = 0;
    while (n--) {
        int x;
        cin >> x;
        ans ^= x % 2;
    }
    cout << (!ans ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  
  long long x = 0;
  for (int i = 1; i < 2000000; i++) {
    x = (x*10 + 7)%k;
    if(x == 0){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
    
  }

 



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

using namespace std;

int main(void){
    // Your code here
    int N; string S;
    int i;
    long r=0,g=0,b=0;
    int x=0,y=0,z=0;

    cin >> N >> S;

    for(i=0;i<N;i++){
        if(S.at(i)=='R')r++;
        if(S.at(i)=='G')g++;
        if(S.at(i)=='B')b++;   
    }

    long long all = r*g*b;

    for(x=0;x<N;++x){
        for(y=x+1;y<N;++y){
            if(S.at(x)==S.at(y))continue;
            z=y*2-x;
            if(z>N-1||S.at(x)==S.at(z)||S.at(y)==S.at(z))continue;
            all--;
        }
    }


    cout << all << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;

static const auto do_fast_io = [] {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main() {
    int n;
    cin >> n;
    vector<double> p(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
    }
    vector<vector<long double>> dp(n + 1, vector<long double>(n + 1));
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) {
            dp[i][j] += dp[i - 1][j] * (1 - p[i]);
            if (j - 1 >= 0) {
                dp[i][j] += dp[i - 1][j - 1] * p[i];
            }
        }
    }

    long double ans = 0;
    for (int i = n / 2 + 1; i <= n; ++i) {
        ans += dp[n][i];
    }
    cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 142680
#include <iostream>
#include <vector>
#include <algorithm>
#define INF (1<<30)
using namespace std;


int main(){
    int N,Q;cin>>N>>Q;
    
    vector<int> nos(N);
    for(int i=0;i<N;i++) cin>>nos[i];
    reverse(nos.begin(),nos.end());
    
    vector<pair<int,int>> queries(Q);
    for(int i=0;i<Q;i++) cin>>queries[i].first;
    for(int i=0;i<Q;i++) queries[i].second = i;
    sort(queries.begin(),queries.end());

    vector<pair<int,int>> intervals;
    for(int i=0;i<nos.size();i++){
        int l = -INF, r = INF;
        if(2*i < nos.size()) l = (nos[i] + nos[2*i])/2 + 1;
        if(i%2 == 0) r = (nos[i/2] + nos[i])/2;
        intervals.push_back(make_pair(l,nos[i]));
        intervals.push_back(make_pair(r+1,-nos[i]));
    }
    sort(intervals.begin(), intervals.end());
    
    long long total = 0;
    vector<long long> ans(Q);
    for(int i=0,j=0;i<queries.size();i++){
        int x = queries[i].first;
        while(intervals[j].first <= x) total += intervals[j++].second;
        ans[queries[i].second] = total;
    }

    total = 0;
    for(int i=0;i<N;i++) total += nos[i];
    for(int i=0;i<Q;i++) cout<<total - ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
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 FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

typedef vector<string> VS;
#define INF 1e9

int main() {
    int n;
    cin >> n;
    VVI a(n, VI(n));
    REP(i,n){
        string s;
        cin >> s;
        REP(j,n) a[i][j] = (s[j] == '#');
    }

    REP(i,n){
        bool f = true;
        REP(j,n) f &= a[i][j];
        if (f){
            int ans = 0;
            REP(j,n){
                bool g = 1;
                REP(k,n) g &= a[k][j];
                ans += !g;
            }
            cout << ans << endl;
            return 0;
        }
    }

    int ans = INF;
    REP(i,n){
        int x = 0;
        REP(j,n) x += (a[i][j] == 0);
        bool f = false;
        REP(k,n) f |= a[k][i];
        if ((x == n) && !f) continue;
        if (!a[i][i] && !f) x++; 
        REP(j,n){
            bool g = 1;
            REP(k,n) g &= a[k][j];
            x += !g;
        }
        ans = min(ans, x);
    }
    cout << (ans == INF ? -1 : ans) << endl;

    // VS s(n);
    // REP(i,n) REP(j,n) s[i] += (a[i][j] ? '#' : '.');
 
    // queue<VS> que;
    // que.push(s);
    // map<VS, int> mp;
    // mp[s] = 1;
    // while (!que.empty()){
    //     VS a = que.front();
    //     int d = mp[a];
    //     que.pop();
    //     REP(i,n) REP(j,n){
    //         VS b(a);
    //         string x;
    //         REP(k,n) x += a[i][k];
    //         REP(k,n) b[k][j] = x[k];
    //         if (mp[b] > 0) continue;
    //         mp[b] = d + 1;
    //         que.push(b);
    //     }
    // }
    // VS goal(n);
    // REP(i,n) REP(j,n) goal[i] += '#';
 
    // int ans2 = mp[goal];
 
    // cout << (ans2 == 0 ? -1 : ans2 - 1) << endl;

    return 0;
}

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

int main(){
  string S; cin >> S;
  int k=S.size();
  vector<char> SS(k);
  for(int i=0;i<k;i++){
    SS.at(i)=S.at(i);
  }
  sort(SS.begin(),SS.end());
  for(int i=0;i<k-1;i++){
    if(SS.at(i)==SS.at(i+1)){
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
}


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

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

    if(s.size() <= k){
        cout << s << endl;
    }else{
        s = s.substr(0,k);
        cout << s << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] lineValue = line.split(" ");
        int N = Integer.parseInt(lineValue[0]);
        int s = Integer.parseInt(lineValue[1]);
        
        if(s == 2 * N - 1 || s == 1) {
            System.out.println("No");
            return;
        }
        
        System.out.println("Yes");
        
        int outputCount = 1;
        StringBuilder sb = new StringBuilder();
        
        for(int i = 0; i < 2 * N - 1; i++) {
            if(i == N - 2) {
                sb.append(s - 1);
                sb.append("\r\n");
            } else if(i == N - 1) {
                sb.append(s);
                sb.append("\r\n");
            } else if(i == N) {
                sb.append(s + 1);
                sb.append("\r\n");
            } else {
                if(outputCount == s - 1) outputCount += 3;
                sb.append(outputCount++);
                sb.append("\r\n");
            }
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 25556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		if(N == 1) {
			System.out.println(1);
		} else if(N % 2 == 1) {
			System.out.println((N/2)+1);
		} else {
			System.out.println((N/2));
		}
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,l;
	cin>>n;
	k=n%100;
	l=k%10;
	if(l==2 || l==4 || l==5 || l==7 || l==9)
	cout<<"hon"<<endl;

	if(l==0 || l==1 || l==6 || l==8)
	cout<<"pon"<<endl;

	if(l==3)
	cout<<"bon"<<endl;

	return 0;
}

Measured memory_bytes: 3564
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class Main {

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

	public void run() throws Exception {
		FastIO file = new FastIO();
		long n = file.nextLong();
		long k = file.nextLong();
		double ans = 0.0;
		for (long i = 1; i <= n; i++) {
			long c = 0;
			long j = i;
			while (j < k) {
				j *= 2;
				c++;
			}
			ans += 1.0 / n * Math.pow(1.0 / 2.0, c);
		}
		System.out.printf("%.10f%n", ans);
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}


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

m = [0] * (10 ** 5 + 10)

for i in range(n):
  m[a[i]] += 1

ans = sum(a)
# print(ans)

q = int(input())
for i in range(q):
  b, c = map(int, input().split())
  count = m[b]
  ans -= b * count
  ans += c * count
  m[c] += count
  m[b] = 0
  print(ans)

Measured memory_bytes: 83748
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]


n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
uf = UnionFind(n)
b = []
for i in a:
    uf.union(i[0]-1,i[1]-1)
for i in range(n):
  b.append(uf.find(i))
print(len(list(set(b))))


Measured memory_bytes: 96728
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {
 
  public static void Main (string[] args) {
    var N = long.Parse(Console.ReadLine());
    decimal ans = 0;
    for(var i = 0; i < N; i++){
      var temp = Console.ReadLine().Split(' ');
      ans += temp.ElementAt(1) == "JPY" ? decimal.Parse(temp.ElementAt(0)) :  decimal.Parse(temp.ElementAt(0)) * 380000;
    }
    
    Console.WriteLine(ans);
  }
  public static long Euclidean(long a, long b){
    if(a % b == 0){return b;}
    return Euclidean(b, a % b);
  }
}

Measured memory_bytes: 11220
(function(input) {
  var p = input.replace(/\n$/, '').split('\n');
  while (true) {
    var a = p.shift().split(' ').map(Number);
    var n = a.shift();
    var s = a.shift();
    if (n === 0 && s === 0) {
      return;
    }
    console.log(count(n, s));
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function count(n, s) {
  return loop(0, n, s);
}

function loop(i, n, s) {
  //console.log(i, n, s);
  var c = 0;
  for (var j = i; j < 10; j++) {
    var sm = s - j;
    if (n === 1) {
      if (sm === 0) {
        c++;
      }
    } else {
      c += loop(j + 1, n - 1, sm);
    }
  }
  return c;
}

Measured memory_bytes: 8436
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
# define rep(i,n) for(int i=0;i<n;i++)
void solve(){
    string s,t;
    cin>>s>>t;
    int n2 =t.length();
    int ans =0;
    int x= s.length();
    for(int i=0;i<x-n2 +1;i++){ 
        int cnt =0;
        int k=0;
    
        for(int j=i;j<i+n2;j++){
            if(s[j] == t[k]){
                cnt++;
            }
            k++;
        }
        ans = max(ans,cnt);
    }
    cout<<t.length() - ans <<endl;


}
int main()
{
    int t;
    //cin>>t;
    
    t=1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3632
m,i,j,k,t[16],c[16],p,d;main(n){for(*t=1;++i<16;)t[i]=n*=3;for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j)){for(k=3;k--;)for(scanf("%d",&i);i--;c[j]=k)scanf("%d",&j);for(p=j=k=0;k++<n;p=i%2*2+p&3)j+=t[n-k]*abs(i=p-c[k]);j=fmin(j,t[n]+~j);}}

Measured memory_bytes: 0
pie = input()

sum_B = 0
wum = 0
num = 0

for i in range(0,len(pie)):
    if (pie[i]=='W'):
        wum+=1
        fl = i
        flag=i
for i in range(i-1,-1,-1):
    if (pie[i]=='B'):
        if (wum>0):
            sum_B+=(flag-i-num)
            num+=1
        else:
            break

print(sum_B)

Measured memory_bytes: 3500
def e_count_median():
    N = int(input())
    # Intervals = [[int(i) for i in input().split()] for j in range(N)]
    Min, Max = [], []
    for _ in range(N):
        a, b = [int(i) for i in input().split()]
        Min.append(a)
        Max.append(b)

    Min.sort()
    Max.sort()
    if N % 2 == 0:
        median_min, median_max = Min[N // 2] + Min[N // 2 - 1], Max[N // 2] + Max[N // 2 - 1]
    else:
        median_min, median_max = Min[N // 2], Max[N // 2]
    return median_max - median_min + 1

print(e_count_median())

Measured memory_bytes: 25396
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);

    long long D,N;
    cin >> D >> N;
    if(N==100) N++;
    if(D == 0) cout << N << endl;
    if(D == 1) cout << N << "00" << endl;
    if(D == 2) cout << N << "0000" << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int ansA = -1;
		int ansB = -1;
		int ansC = -1;

		for (int a = 0; a <= N ; a++) {
			for (int b = 0; a + b <= N; b++) {

				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;

				if(total == Y) {
					ansA = a;
					ansB = b;
					ansC = c;
				}
			}
		}

		System.out.println(ansA);
		System.out.println(ansB);
		System.out.println(ansC);
	}

}


Measured memory_bytes: 22736
def balling(balls, left, right):
    if len(balls) == 0:
        return True
    elif balls[0] <= left and balls[0] <= right:
        return False
    else:
        complete = False
        if balls[0] > left:
            complete = balling(balls[1:], balls[0], right)
        if not complete and balls[0] > right:
            complete = balling(balls[1:], left, balls[0])
        return complete

for _ in range(int(input())):
    balls  = [int(x) for x in  input().split()]
    print("YES" if balling(balls, 0, 0) else "NO")



Measured memory_bytes: 5600
use std::f64::consts::PI;

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


fn main() {
    let r = read::<f64>();
    println!("{} {}", r * r * PI, 2.0 * r * PI);
}



Measured memory_bytes: 5060
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Dubious Document 2
            var S = Console.ReadLine();
            var T = Console.ReadLine();
            var words = new List<string>();

            for(int i = 0; i < S.Length; i++)
            {
                int count = 0;

                for (int j = 0; j < T.Length; j++)
                {
                    if (i + j < S.Length)
                    {
                        if (S[i + j] == T[j] | S[i + j] == '?')
                        {
                            count++;
                        }
                        else
                        {
                            break;
                        }
                    }                    
                }

                if (count == T.Length)
                {
                    var s = S.Substring(0, i) + T + S.Substring(i + T.Length, S.Length - (i + T.Length));
                    words.Add(s.Replace('?', 'a'));
                }
            }

            if (words.Count == 0)
            {
                Console.WriteLine("UNRESTORABLE");
            }
            else
            {
                Console.WriteLine(words.OrderBy(x => x).First());
            }
        }
    }
}

Measured memory_bytes: 13536
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
#define inf 1<<30
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
il void readl(ll &x){
    x=0;ll f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
il void read(int &x){
    x=0;int f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
using namespace std;
/*===================Header Template=====================*/
int main(){
	int a,b;;
	in2(a,b);
	printf("%d",a+1-b);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

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

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

using namespace std;

int main(void){
  int n,i;
  cin >> n;
  vector<int> v(2*n);
  REP(i,2*n) scanf("%d",&v[i]);
  sort(v.begin(), v.end());
  int res =0;
  REP(i,2*n) if(i%2==0) res+=v[i];
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = tuple(map(int, input().split()))

judge = True
for i in range(N):
  if (A[i] % 2) == 1:
    continue
  if (A[i] % 3) != 0 and (A[i] % 5) != 0:
    judge = False
    break

print('APPROVED' if judge else 'DENIED')


Measured memory_bytes: 3060
N,M=map(int, input().split())
G=[list() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
ans=0
index=-1
for i in range(1,N):
    for p in G[i]:
        if index<p<i:
            ans+=1
            index=i-1
import time
time.sleep(1.5)
print(ans)


Measured memory_bytes: 21424
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

#include<iomanip>
using std::setprecision;

int main()
{
  int r;
  cin >> r;
  
  const double pi = 3.1415926535;
  
  cout << setprecision(18) << r * 2 * pi << endl;
  return 0;
}


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

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    int ans = 0;
    vector<int> bs(m);
    for (int i = 0; i < m; i++) {
        cin >> bs[i];
    }
    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int a;
            cin >> a;
            sum += a * bs[i];
        }
        if (sum + c > 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>

using namespace std;

int main(){
    long long int a, b, n, buf, ans;
    cin >> a >> b >> n;
    buf = min(b-1, n);
    cout << buf*a/b << endl;
    return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define mem(x,n) memset(x,n,sizeof(x))
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define foreach(it,l) for(auto it=(l).begin();it!=(l).end();it++)
#define pnl printf("\n")
#define endl '\n'
#define len(x) (x).length()

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<int> VI;
const double EPS=1e-10;
//const double PI=acos(-1.0);
const int INF=1<<30;
const LL LLINF=1ll<<60;
const int MOD=1e9+7;
const int xx[8]={1,0,-1,0,1,-1,1,-1};
const int yy[8]={0,1,0,-1,-1,1,1,-1};

void fastio(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }

/***********************************\
     _____ _             _
    /  __ \ |           (_)
    | /  \/ | __ _ _ __  _  ___
    | |   | |/ _` | '_ \| |/ _ \
    | \__/\ | (_| | |_) | |  __/
     \____/_|\__,_| .__/|_|\___|
                  | |
                  |_|
\***********************************/

int asd[100005];

int main(){
	int tc;
	scanf("%d",&tc);
	int gj=0,gp=0;
	for(int i=0;i<tc;i++){
		scanf("%d",&asd[i]);
		if(asd[i]%2==0) gp++;
		else gj++;
	}
	
	if(gp%2==0&&gj%2==0){
		printf("YES\n");
	}
	else if(gj%2==0){
		gp+=gj/2;
		if(gp%2==0) printf("YES\n");
		else printf("NO\n");
	}
	else if(gp+gj%2==0){
		printf("YES\n");
	}
	else printf("NO\n");
	
	return 0;
}


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

using namespace std;

const int N = 100000 + 77 , Mod = 1000000007;
int n , k , a[N] , dp[N] , ps[N];
int main(){
   ios::sync_with_stdio(0);cin.tie(0);
   cin >> n >> k;
   dp[0] = 1;
   for(int i = 0;i <= k;++ i)
      ps[i] = 1;
   for(int i = 1;i <= n;++ i){
      cin >> a[i];
      for(int j = k;j >= 0;-- j){
         dp[j] = ps[j];
         if(j - a[i] - 1 >= 0){
            dp[j] = (dp[j] - ps[j - a[i] - 1] + Mod) % Mod;
         }
      }
      ps[0] = dp[0];
      for(int j = 1;j <= k;++ j)
         ps[j] = (ps[j - 1] + dp[j]) % Mod;
   }
   cout << dp[k];
   return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

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

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

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

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

int main()
{
	ll a;
	string b;
	cin >> a >> b;
	int c = b[0] - '0';
	int d = b[2] - '0';
	int e = b[3] - '0';
	ll r = a * c;
	r += a * d / 10;
	int k = (a * d) % 10;
	r += a * e / 100;
	int j = (a * e) % 100;
	if (k + j / 10 >= 10)
		r++;
	printf("%lld", r);
	return 0;
}


Measured memory_bytes: 3260
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> D(K);
  for (auto &&Di : D) {
    cin >> Di;
  }
  vector<int> S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  set<int> T;
  set_difference(ALL(S), ALL(D), inserter(T, T.end()));

  FOR(i, N, 100000) {
    set<int> U;
    auto t = i;
    while (t) {
      U.emplace(t % 10);
      t = t / 10;
    }
    if (all_of(ALL(U), [&T](const int u) { return T.count(u) > 0; })) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        x -= i + 1;
        a[i] = x;
    }
    sort(a.begin(), a.end());
    ll b = a[(n % 2 == 1 ? (n - 1) / 2 : n / 2 - 1)];
    ll ans = 0;
    for (int i : a) {
        ans += abs(i - b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
/*Program from Luvwgyx*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
char s[10];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(int x){print(x);puts("");}
void query(ll  x){printf("? %lld\n",x);fflush(stdout);scanf("%s",s);}
int main(){
    int x=1e9;query(x);
    if(s[0]=='Y'){
        for(int i=9;i;i--){
            query(x-1);
            if(s[0]=='N')break;
            x/=10;
        }printf("! %d\n",x);
        return 0;
    }
    for(int i=9;i;i--){
        x/=10;query(x);
        if (s[0]=='Y')break;
    }int l=x+1,r=x*10-1,ans;
    while(l<=r){
        ll mid=(l+r)>>1;query(mid*10);
        if(s[0]=='Y')r=mid-1,ans=mid;
        else l=mid+1;
    }printf("! %d\n",ans);
    return 0;
}


Measured memory_bytes: 504
//ABC146 A - Can't Wait for Holiday 
#include<stdio.h>
#include<string.h>

int main(void){
    char day[3];
    int i = 7;
    scanf("%s",day);
    if(strcmp(day,"SUN")==0){
        printf("%d",i);
    }else if(strcmp(day,"MON")==0){
        printf("%d",i-1);
    }else if(strcmp(day,"TUE")==0){
        printf("%d",i-2);
    }else if(strcmp(day,"WED")==0){
        printf("%d",i-3);
    }else if(strcmp(day,"THU")==0){
        printf("%d",i-4);
    }else if(strcmp(day,"FRI")==0){
        printf("%d",i-5);
    }
    else if(strcmp(day,"SAT")==0){
        printf("%d",i-6);
    }
    return 0;

}

Measured memory_bytes: 128
x, k, d = map(int, input().split())

if abs(x) > k * d:
    print(abs(x) - (k * d))
else:
    a = abs(x) // d
    b = abs(x) - (a * d)
    c = k - a
    if c % 2 == 1:
        print(abs(b - d))
    else:
        print(b)

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

#define ll long long
#define ar array

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)

#define E_ACH2(x, a) for (auto& x: a)
#define E_ACH3(x, y, a) for (auto& [x, y]: a)
#define E_ACH4(x, y, z, a) for (auto& [x, y, z]: a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...) E_ACHC(__VA_ARGS__)(__VA_ARGS__)

int h, w, k, ans;
string g[6];

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

	cin >> h >> w >> k;
	FOR(h)
		cin >> g[i];
	FOR(1<<h) {
		FOR(j, 1<<w) {
			int c=0;
			FOR(i2, h)
				FOR(j2, w)
				if(i>>i2&1&&j>>j2&1&&g[i2][j2]=='#')
					++c;
			if(c==k)
				++ans;
		}
	}
	cout << ans;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	vector<long long> a(n);
	map<long long, int> mp;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		mp[a[i]]++;
	}
	sort(a.rbegin(), a.rend());
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		if(mp[a[i]] <= 0) {
			continue;
		}
		mp[a[i]]--;
		for(long long j = 1; j <= 2 * 1e9 + 1; j <<= 1) {
			if(mp.count(j - a[i])) {
				if(mp[j - a[i]] > 0) {
					mp[j - a[i]]--;
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;	
}


Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <set>

#define rep0(i, n) for (i = 0; i < n; i++)
#define rep(s, i, n) for (i = s; i < n; i++)
using namespace std;

struct UnionFind
{
    vector<int> r;
    UnionFind(int N)
    {
        r = vector<int>(N, -1);
    }
    int root(int x)
    {
        if (r[x] < 0)
            return x;
        return r[x] = root(r[x]);
    }
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (r[x] > r[y])
            swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
    int size(int x)
    {
        return -r[root(x)];
    }
    int find(int x)
    {
        return r[x];
    }
};

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


    UnionFind UF(N);
    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        A -= 1;
        B -= 1;
        UF.unite(A, B);
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(ans, UF.size(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

vi G[100005];
pi e[100005];

ll n, par[100005], sz[100005], m;

void init() {
	for(int i=1;i<=n;i++) {
		par[i] = i;
		sz[i] = 1;
	}
}

int find(int x) {
	if (par[x] == x)
		return x;
	return par[x] = find(par[x]);
}

void unite(int x, int y) {
	int rx = find(x), ry = find(y);
	if(rx == ry)
		return;
	par[ry] = rx;
	sz[rx] += sz[ry];
}

bool same(int x, int y) {
	return find(x) == find(y);
}

int main()
{
	IO_OP;
	
	cin >> n >> m;
	init();
	for(int i=0;i<m;i++) {
		int a, b;
		cin >> a >> b;
		e[i] = {a, b};
	}
	ll ans = 0;
	vector<ll> v;
	for(int i=m;i>=0;i--) {
		int a = e[i].F, b = e[i].S;
		int rx = find(a), ry = find(b);
		if(rx != ry)
			ans += sz[rx] * sz[ry];
		unite(a, b);
		v.PB(n*(n-1)/2 - ans);
	}
	for(int i=v.size()-2;i>=0;i--)
		cout << v[i] << endl;
}



Measured memory_bytes: 6900
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = sc.nextInt();
            }
        }
        int[][] dp = new int[n][3];
        dp[0][0] = arr[0][0];
        dp[0][1] = arr[0][1];
        dp[0][2] = arr[0][2];
        for (int i = 1; i < n; i++) {
            dp[i][0] = arr[i][0] + Math.max(dp[i - 1][1], dp[i - 1][2]);
            dp[i][1] = arr[i][1] + Math.max(dp[i - 1][0], dp[i - 1][2]);
            dp[i][2] = arr[i][2] + Math.max(dp[i - 1][0], dp[i - 1][1]);
        }
        int max = Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2]));
        System.out.println(max);
        sc.close();
    }
}


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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);


int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector<int> v(n);
    int cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        if( i % 2 == 0 && v[i] % 2 != 0){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3576
# import sys
# input = sys.stdin.readline
s = input()
t = input()
m = len(s)
n = len(t)

D = [[0] * n for i in range(m)]
D[0][0] = int(s[0] == t[0])

for i in range(1, m):
    D[i][0] = D[i-1][0] | int(s[i] == t[0])
for i in range(1, n):
    D[0][i] = D[0][i-1] | int(s[0] == t[i])

for i in range(1, m):
    for j in range(1, n):
        mx = max(D[i-1][j-1],D[i-1][j],D[i][j-1])
        D[i][j] = max(mx, D[i-1][j-1]+1) if s[i] == t[j] else mx
# print(D)

maxl = max([max(D[i]) for i in range(m)])
# print(maxl)

ans = []
for i in range(m):
    for j in range(n):
        if D[i][j] == maxl:
            r = i
            c = j
            break

while maxl > 0:
    while c >= 1 and D[r][c-1] == maxl:
        c -= 1
    while r >= 1 and D[r-1][c] == maxl:
        r -= 1
    # print(r,c,maxl)
    ans.append(t[c])
    c -= 1
    r -= 1
    maxl -= 1
print("".join(ans[::-1]))

Measured memory_bytes: 145128
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion



int main() {
	int k, t; put k >> t;
	vi a(t);
	rep(i, t) {
		put a[i];
	}
	int mx = 0;
	int other = 0;
	rep(i, t) {
		mx = max(mx, a[i]);
	}
	other = k - mx;
	putans(max(0,mx - other - 1));
END: 
	return 0;
}



//
//vi v;
//vi w; ;
//ll nz1() {
//	return 0;
//}
//
//ll nz2() {
//	ll dp[201][1000*200+1];
//
//}
//
//ll nz3() {
//
//}
//	int n, wkazu; put n >> wkazu;
//	v.resize(200); 
//	w.resize(200);
//	rep(i, n) {
//		put v[i] >> w[i];
//	}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
char s[] = "1001010111001010";
int main()
{
    long long i,n,x,y,c1=0,c2=0;
    ios::sync_with_stdio(0),cin.tie(0);
    cin>>i>>n>>x;
    if(i+n>=x)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;

int main() {
    int N;
    cin >> N;
    int a[N];

    rep(i,0,N) {
        cin >> a[i];
    }

    int ans = 0;
    rep(i,0,N) {
        bool tmp = true;
        while(tmp) {
            if (a[i]%2==0) {
                ans++;
                a[i]/=2;
            }
            else {
                tmp = false;
            }
        }
    }
    cout << ans << endl;

 }



Measured memory_bytes: 256