akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N;
    cin >> N;
    int count = 0;
    if (N >= 105) count++;
    if (N >= 135) count++;
    if (N >= 165) count++;
    if (N >= 189) count++;
    if (N >= 195) count++;
    cout << count << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 1e5+10;

//head

int n, m;
vi G[N];
int dist[N];

int dfs(int i) {
	if(dist[i] != -1) return dist[i];
	int &res = dist[i] = 0;
	for(int ne:G[i]) {
		chmax(res, dfs(ne)+1);
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].emplace_back(b);
	}
	memset(dist, -1, sizeof(dist));
	rep(i, n) {
		dfs(i);
	}
	//rep(i, n) cout << dist[i] << endl;
	cout << *max_element(dist, dist+n) << endl;
}

Measured memory_bytes: 11432
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  string s,t;
  cin >> s >> t;
  lint len = s.size();
  lint ans = 0;
  
  for(lint i=0; i<len; i++){
    if(s[i]!=t[i]) ans++;
}
  cout << ans << endl;
}

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

int main(){
    int n,cnt,ans;
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        ans=0;
        for(int i=0;i<n/4;i++){
            cin >> cnt;
            ans += cnt;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String args[]){

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

		int a[] = new int[n];
		a[0] = sc.nextInt();

		int curentInt = a[0];
		int beforeCur = curentInt;
		for(int i = 1;i < (n - 1);i++) {
			curentInt = sc.nextInt();
			a[i] = (beforeCur > curentInt) ? curentInt :beforeCur;
			beforeCur = curentInt;
		}

		a[n - 1] = curentInt;

		long sum = java.util.Arrays.stream(a).sum();
		System.out.println(sum);
	}
}

Measured memory_bytes: 28244
#include<bits/stdc++.h>
using namespace std;
const int sz=1e6+7;
int n;
int low,ans;
char s[sz],t[sz];
int head[26],nxt[sz][26];
deque<int>q;
int main(){
	scanf("%d",&n);
	scanf("%s%s",s+1,t+1);
	bool flag=1;
	for(int i=1;i<=n;i++) if(s[i]!=t[i]) flag=0;
	if(flag) return printf("0\n"),0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<26;j++) nxt[i][j]=head[j];
		head[s[i]-'a']=i;
	}
	for(int j=0;j<26;j++) nxt[n+1][j]=head[j];
	int lst=n+1;
	for(int r=n,l;r>=1;r=l-1){
		l=r;
		while(t[l-1]==t[r]) l--;
		int now=nxt[min(l+1,lst)][t[r]-'a'];
		if(!now) return printf("-1\n"),0;
		low++;
		q.push_front(now+low);
		while(!q.empty()&&q.back()-low>=l) q.pop_back();
		ans=max(ans,(int)q.size()+1);
		lst=now;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 107904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));
ll m[26];

void solve(string S){
	bool flg = true;
	rep(i, S.length()) {
		m[S[i]-'a']++;
	}
	ll a = -1, b = -1;
	rep(i, S.length()) {
		ll maxi = -1, maxv = -1;
		rep(j, 26) {
			if (a != j && b != j) {
				if (maxv < m[j]) {
					maxi = j;
					maxv = m[j];
				}
			}
		}
		// rep(j, 3) {
		// 	cout << m[j];
		// }
		// cout << (char)(maxi+'a') << endl;
		a = b;
		b = maxi;
		if (maxi == -1 || m[maxi] == 0) {
			flg = false;
			break;
		}
		m[maxi]--;
	}
	if (flg) cout << "YES" << endl; else cout << "NO" << endl;
}

int main(){	
	string S;
	cin >> S;
	solve(S);
	return 0;
}



Measured memory_bytes: 512
#include<stdio.h>

int main(void){
	
	int S;
	int h = 0;
	int m = 0;
	int s = 0;
	
	scanf("%d" ,&S);
	h = S / 3600;
	S = S - h * 3600;
	m = S / 60;
        s = S - m * 60;
        
        printf("%d:%d:%d\n" , h, m, s);

	return 0;

}

Measured memory_bytes: 1816
import java.util.Arrays;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] d = new int[n];
    for (int i = 0; i < n; i++) {
      d[i] = scanner.nextInt();
    }
    Arrays.sort(d);
    int num = 1;
    for (int i = 0; i < n - 1; i++) {
      if (d[i] < d[i + 1]) num++;
    }
    System.out.println(num);
  }
}


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

using namespace std;

bool possible(long long longestLog, const vector<long long>& A, long long K) {
    long long N = A.size();
    long long numOfLongestLogs = 0;
    for (long long i = 0; i < N; ++i) {
        numOfLongestLogs += A[i] / longestLog;
        if (A[i] % longestLog == 0) {
            --numOfLongestLogs;
        }
    }
    return (numOfLongestLogs <= K);
}

void Main() {
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N, 0LL);
    for (long long i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<long long>());

    long long ub = A.front();
    long long lb = 0LL;
    while (ub - lb > 1LL) {
        long long mid = (ub + lb) / 2LL;
        if (possible(mid, A, K)) {
            ub = mid;
        }
        else {
            lb = mid;
        }
    }
    bool test = possible(lb, A, K);
    cout << ub << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 4764
num = [int(x) for x in input().split()]
val = [int(x) for x in input().split()]
res = 0

res = max(val)+num[1]
for i in range(1, len(val)):
    res -= abs(val[i]-val[i-1])-num[1] if abs(val[i]-val[i-1])-num[1] > 0 else 0

print(res)


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0)
        cout<<"Possible"<<endl;
    else
        cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
  int i,sum_len,v[2];
  float closs, l[11],t[2][12]={};
  while(scanf("%f,",&l[1])!=EOF){
    sum_len=l[1];
    for(i=2;i<11;i++) {scanf("%f,",&l[i]);sum_len+=l[i];}
    scanf("%d,%d",&v[0],&v[1]);
    closs=1.0*sum_len/(v[0]+v[1]);
    double sum_time[2]={};
    for(i=1;i<10;i++){
      t[0][i]=sum_time[0]+(l[i]/v[0]);
      t[1][10-i]=sum_time[1]+l[10-i]/v[1];
      sum_time[0]+=l[i]/v[0];
      sum_time[1]+=l[10-i]/v[1];
    }
    sum_time[0]+=l[i]/v[0];
    //    sum_time[1]+=l[10-i]/v[1];
    t[0][10]=t[1][0]=sum_time[0];
    for(i=0;i<11;i++){
      //      cout<<' '<<closs<<t[0][i] << ' ' <<t[1][i]<<endl;
      if(t[0][i] >= closs && t[1][i] <= closs){cout<<i<<endl; break;}
      //if(t[0][i] == closs && t[1][i] == closs) {cout<<i-1<<endl; break;}
    }
  }
  return 0;
}
  
  
  

Measured memory_bytes: 1232
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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 Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;

    ll n;
    ll x[100010],l[100010];
    cin>>n;
    pll a[100010];
    rep(i,n){
        cin>>x[i]>>l[i];
        a[i]={x[i]+l[i],x[i]-l[i]};
    }
    sort(a,a+n);
    ll now=-LLINF,ans=0;
    rep(i,n){
        if(now<=a[i].sc){
            ans++;
            now=a[i].fi;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
using namespace std;
#define rep(integer,n) for(int integer=0;integer<n;integer++)
#define mp make_pair
#define INF 100000000
typedef pair<int, int> P;

int h, w, n;
char maze[1000][1000];
int i, j;

struct DIR {
	int x, y;
} dir[4] = {
	{1, 0}, // right
	{0, 1}, // up
	{-1, 0}, // left
	{0, -1} // down
};

map<char, int> place;
int dist[1000][1000];

int bfs(int hp) {
	for(int x = 0; x < w; x++) {
		for(int y = 0; y < h; y++) {
			dist[y][x] = INF;
		}
	}
	dist[i][j] = 0;
	queue<P> q;
	q.push(mp(i,j));
	int ans = 0;
	while(!q.empty()) {
		int x = q.front().second;
		int y = q.front().first;
		q.pop();
		if(place[maze[y][x]] == hp) {
			i = y;
			j = x;
			maze[i][j] = '.';
			break;
		}
		for(int k = 0; k < 4; k++) {
			int nx = x + dir[k].x;
			int ny = y + dir[k].y;
			if(0 <= nx && nx < w && 0 <= ny && ny < h && maze[ny][nx] != 'X') {
				if(dist[ny][nx] == INF) {
					dist[ny][nx] = dist[y][x] + 1;
					q.push(mp(ny, nx));
				}
			}
		}
	}
	int ret = dist[i][j];
	return ret;
}

int main() {
	place.insert(mp('1', 1));
	place.insert(mp('2', 2));
	place.insert(mp('3', 3));
	place.insert(mp('4', 4));
	place.insert(mp('5', 5));
	place.insert(mp('6', 6));
	place.insert(mp('7', 7));
	place.insert(mp('8', 8));
	place.insert(mp('9', 9));
	place.insert(mp('.', 10));
	scanf(" %d %d %d", &h, &w, &n);
	rep(x, h) {
		scanf(" %s", &maze[x]);
	}
	int ans = 0;
	for(int x = 0; x < w; x++) {
		for(int y = 0; y < h; y++) {
			if(maze[y][x] == 'S') {
				i = y;
				j = x;
				maze[y][x] = '.';
				break;
			}
		}
	}
	rep(x,n) {
		ans += bfs(x + 1);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 5668
#include <bits/stdc++.h>
// make_tuple emplace_back next_permutation push_back make_pair second first
// setprecision

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
   public:
    int n;
    vector<vector<int>> t;
    Solver(LL n) : n(n), t(2 * n - 1){};
    void add_edge(int a, int b, int v) {
        t[a].push_back(v);
        t[v].push_back(a);
        t[v].push_back(b);
        t[b].push_back(v);
    }
    pair<LL, LL> calc(int r) {
        vector<LL> maxc((LL)t.size()), dep((LL)t.size(), -1);
        queue<int> Q;
        Q.push(r);
        dep[r] = 0;
        LL ret = 0;
        while (!Q.empty()) {
            int now = Q.front();
            Q.pop();
            for (auto x : t[now]) {
                if (dep[x] == -1) {
                    dep[x] = dep[now] + 1;
                    Q.push(x);
                }
            }
            ret = max(ret, dep[now] + 1);
            LL cnt_child =
                (now == r ? (LL)t[now].size() : (LL)t[now].size() - 1);
            maxc[dep[now]] = max(maxc[dep[now]], cnt_child);
        }
        LL ret2 = 1;
        for (int i = 0; i < ret - 1; ++i) {
            ret2 *= maxc[i];
        }
        DBG(r, ret, ret2, maxc)
        return {(ret + 1) / 2, ret2};
    }
    void solve() {
        for (int i = 0; i < n - 1; ++i) {
            int a, b;
            cin >> a >> b;
            add_edge(a - 1, b - 1, n + i);
        }
        pair<LL, LL> ans = {LINF, LINF};
        for (int i = 0; i < (int)t.size(); ++i) {
            auto tmp = calc(i);
            ans = min(ans, tmp);
        }
        cout << ans.first << ' ' << ans.second << "\n";
    }
};
}  // namespace Problem

int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long n = 0;
    std::cin >> n;
    Problem::Solver sol(n);
    sol.solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int i;
  string s;
  cin>>s;
  int n=s.size();
  if(n%2==1){
    cout<<"No";
    return 0;
  }
  for(i=0;i<n-1;i+=2){
    if(s[i]=='h' and s[i+1]=='i');
    else{
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
  return 0;
}

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

public class Main {

	static class PriorityQueue<E> {
		
		private Comparator<E> comparator;
		private int size;
		private List<E> list;
		
		public PriorityQueue(int initialCapacity, Comparator<E> comparator) {
			this.comparator = comparator;
			size = 0;
			list = new ArrayList<>(initialCapacity);
			list.add(null);
		}
		
		public void push(E element) {
			size++;
			if (size < list.size()) {
				list.set(size, element);
			} else {
				list.add(element);
			}
			bottomUp(size);
		}

		private void bottomUp(int idx) {
			if (idx <= 1) return;
			int p;
			if (idx % 2 == 0) p = idx / 2;
			else p = (idx - 1) / 2;
			if (compare(p, idx) < 0) {
				swap(p, idx);
				bottomUp(p);
			}
		}

		private int compare(int idx1, int idx2) {
			return comparator.compare(list.get(idx1), list.get(idx2));
		}
		
		public E poll() {
			if (size <= 0) return null;
			E ret = list.get(1);
			E last = list.get(size);
			list.set(1, last);
			list.set(size, null);
			size--;
			topDown(1);
			return ret;
		}

		private void topDown(int idx) {
			if (size <= 1) return;
			int l = idx * 2;
			int r = l + 1;
			int largest = idx;
			if (l <= size && compare(largest, l) < 0) {
				largest = l;
			}
			if (r <= size && compare(largest, r) < 0) {
				largest = r;
			}
			if (largest != idx) {
				swap(largest, idx);
				topDown(largest);
			}
		}

		private void swap(int i, int j) {
			E tmp = list.get(i);
			list.set(i, list.get(j));
			list.set(j, tmp);
		}
		
		public int size() {
			return size;
		}
		
		public String toString() {
			StringBuilder sb = new StringBuilder();
			sb.append("[");
			for (int i = 1; i <= size; i++) {
				sb.append(list.get(i));
				if (i != size) sb.append(", ");
			}
			sb.append("]");
			return sb.toString();
		}
	}
	
	static class MyComaprator<E extends Comparable<E>> implements Comparator<E> {
		@Override
		public int compare(E o1, E o2) {
			return o1.compareTo(o2);
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	public void run() throws IOException {
		PriorityQueue<Integer> pq = new PriorityQueue<>(10, new MyComaprator<Integer>());
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			StringTokenizer st = new StringTokenizer(reader.readLine());
			String cmd = st.nextToken();
			if (cmd.equals("insert")) {
				pq.push(Integer.parseInt(st.nextToken()));
			} else if (cmd.equals("extract")) {
				System.out.println(pq.poll());
			} else {
				break;
			}
		}
		reader.close();
	}
}



Measured memory_bytes: 190776
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

while True:
    n, x = map(int, readline().split())
    if (n + x) == 0:
        break
    cnt = 0
    for a in range(1, n + 1):
        for b in range(a + 1, n + 1):
            for c in range(b + 1, n + 1):
                if a + b + c == x:
                    cnt += 1
    print(cnt)



Measured memory_bytes: 5580
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<pair<pair<string,int>,int>> p(n);
    
    for(int i=0;i<n;i++){
        cin>>p.at(i).first.first>>p.at(i).first.second;
        p.at(i).second=i+1;
        p.at(i).first.second*=-1;
    }
    
    sort(p.begin(),p.end());
    
    for(int i=0;i<n;i++) cout<<p.at(i).second<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


int main()
{
	int n;
	int t, a;
	int h[1003];

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

	int ans = 0;
	double diff = std::abs(a * 1.0 - (t - h[0] * 0.006));
	for (int i = 1;i < n;i++) {
		double tmp = std::abs(a * 1.0 - (t - h[i] * 0.006));
		if (tmp < diff) {
			diff = tmp;
			ans = i;
		}
	}

	cout << ans + 1 << endl;

	return 0;
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;

template <class T>
struct edge {
    size_t to;
    T cost;
    edge(size_t to, T cost = 1) : to(to), cost(cost) {}
};

template <class T>
class graph {
private:
    const size_t count_vertices;
    const bool is_directed;
public:
    using weight_type = T;
    vector<edge<T>> *edges;
    graph(size_t count_vertices, bool is_directed = true) : count_vertices(count_vertices), is_directed(is_directed) {
        edges = new vector<edge<T>>[count_vertices];
    }
    ~graph() {
        delete [] edges;
    }
    size_t size() const { return count_vertices; }
    void make_edge(size_t u, size_t v, T cost) {
        edges[u].push_back(edge<T>(v, cost));
        if (!is_directed)
            edges[v].push_back(edge<T>(u, cost));
    }
};

template <class T>
typename graph<T>::weight_type minimum_spanning_tree(const graph<T> &g) {
    using W = typename graph<T>::weight_type;
    using P = pair<W, size_t>;

    int n = g.size();
    W result = 0;
    vector<bool> used(n, false);
    priority_queue<P, vector<P>, greater<P>> q;
    q.push(P(0, 0));
    while (!q.empty()) {
        W w;
        size_t u;
        tie(w, u) = q.top();
        q.pop();
        if (used[u]) {
            continue;
        }
        used[u] = true;
        result += w;
        for (const edge<W> &e: g.edges[u]) {
            size_t v = e.to;
            if (!used[v]) {
                q.push(P(e.cost, v));
            }
        }
    }
    return result;
}

int main() {
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    vector<pii> xi(N), yi(N);
    REP(i, N) {
        cin >> x[i] >> y[i];
        xi[i] = pii(x[i], i);
        yi[i] = pii(y[i], i);
    }
    sort(all(xi));
    sort(all(yi));
    graph<ll> g(N, false);
    REP(i, N - 1) {
        int u, v;
        u = xi[i].second;
        v = xi[i + 1].second;
        g.make_edge(u, v, min(abs(x[u] - x[v]), abs(y[u] - y[v])));
        u = yi[i].second;
        v = yi[i + 1].second;
        g.make_edge(u, v, min(abs(x[u] - x[v]), abs(y[u] - y[v])));
    }
    cout << minimum_spanning_tree(g) << endl;
    return 0;
}

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

typedef std::vector<int> vi;

int main()
{
	string s1, s2;
	cin>>s1>>s2;

	map<char, int> m1, m2;
	std::vector<int> m3, m4;

	for(int i=0; i < s1.size(); i++)
		m1[s1[i]]++;
	for(int i=0; i < s2.size(); i++)
		m2[s2[i]]++;

	for(std::map<char,int>::iterator iter = m1.begin(); iter != m1.end(); ++iter)
		m3.push_back(iter->second);

	for(std::map<char,int>::iterator iter = m2.begin(); iter != m2.end(); ++iter)
		m4.push_back(iter->second);

	sort(m3.begin(), m3.end());
	sort(m4.begin(), m4.end());

	if (m3==m4)
		cout<<"Yes";
	else
		cout<<"No";

	return 0;

}

Measured memory_bytes: 776
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int nt = 0, nx = 0, ny = 0;
        boolean bool = true;
        for(int i = 0; i < n; i++){
            int t = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            int xlen = Math.abs(nx-x);
            int ylen = Math.abs(ny-y);
            int tlen = t-nt;
            if(tlen < xlen + ylen || tlen % 2 != (xlen+ylen) % 2){
                bool = false;
                break;
            }
        }
        System.out.println(bool ? "Yes" : "No");
    }
}


Measured memory_bytes: 89080
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void print(int x)
{
    for (int i=7; i>=0; i--)
        cout<<(x>>i&1);
    cout<<endl;
}

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

    auto count = [&](int x)
    {
        int r = 0;
        for (int i=0; i<N; i++)
            r += x>>i&1;
        return r;
    };

    int C = A^B;
    if (count(C)%2!=1)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    vector<int> T;
    for (int i=0; i<1<<N; i++)
        T.push_back(i^i>>1);

    for (int i=0; i<count(C)/2; i++)
    {
        int t = 1<<(N-i*2-1);
        reverse(T.end()-t+1, T.end());
        reverse(T.end()-t+2, T.end()-t/2+1);
        reverse(T.end()-t/2+1, T.end());
    }

    vector<int> B0, B1;
    for (int i=0; i<N; i++)
        if (C>>i&1)
            B1.push_back(i);
        else
            B0.push_back(i);
    vector<int> M;
    int b0 = 0;
    int b1 = 0;
    for (int i=0; i<N; i++)
        if (T[(1<<N)-1]>>i&1)
            M.push_back(B1[b1++]);
        else
            M.push_back(B0[b0++]);

    cout<<"YES"<<endl;
    bool f = true;
    for (int t: T)
    {
        int t2 = 0;
        for (int i=0; i<N; i++)
            t2 |= (t>>i&1)<<M[i];
        t2 ^= A;
        cout<<(f?"":" ")<<t2;
        f = false;
    }
    cout<<endl;
}


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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  for ( int i = 0; i < (tx-sx); i++ ) {
    cout << 'R';
  }
  for ( int i = 0; i < (ty-sy); i++ ) {
    cout << 'U';
  }
  for ( int i = 0; i < (tx-sx); i++ ) {
    cout << 'L';
  }
  for ( int i = 0; i < (ty-sy); i++ ) {
    cout << 'D';
  }
  cout << 'D';
  for ( int i = 0; i < (tx-sx)+1; i++ ) {
    cout << 'R';
  }
  for ( int i = 0; i < (ty-sy)+1; i++ ) {
    cout << 'U';
  }
  cout << 'L';
  cout << 'U';
  for ( int i = 0; i < (tx-sx)+1; i++ ) {
    cout << 'L';
  }
  for ( int i = 0; i < (ty-sy)+1; i++ ) {
    cout << 'D';
  }
  cout << 'R' << endl;
  
  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.algorithm;
import std.string;
import std.file;
 
int main() {
        int[] hs;
        string l;
        while((l = readln()).length >= 2){
                float a, b, c, d, e, f;
                a = to!int(l.split()[0]), b = to!int(l.split()[1]), c = to!int(l.split()[2]);
                d = to!int(l.split()[3]), e = to!int(l.split()[4]), f = to!int(l.split()[5]);
                float x, y;
                x = (c * e - f * b)/(a * e - d * b), y = (c * d - f * a)/(b * d - e * a);
                x = to!float(to!int(x * 1000)) / 1000, y = to!float(to!int(y * 1000)) / 1000;
                printf("%.3f %.3f\n", x, y);
                }
        return 0;
}

Measured memory_bytes: 1140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					if(j>0 && i>1 && j+1<H && i<W) {
						System.out.print(".");
					}else {
						System.out.print("#");
					}
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());
		}
	}

}



Measured memory_bytes: 31364
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
	return table;
}

int main() {
	ll n;
	cin >> n;
	VL list = { 59049,46656,7776,6561,1296,729,216,81,36,9,6,1 };

	ll dp[100001];
	REP(i, n + 1) {
		dp[i] = 1e10;
	}
	dp[0] = 0;
	FOR(i, 1, n + 1) {
		REPC(p, list) {
			if (i - p >= 0) {
				dp[i] = std::min(dp[i], dp[i - p] + 1);
			}
		}
	}
	cout << dp[n] << endl;
}

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

int main(){
    string ss,tt,uu;
    int A,B;
    cin >> ss >> tt >> A >> B >> uu;

    if(uu == ss){
        A -= 1;
    }else B -=1;
    cout << A << " " << B << 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[] list=new int[n];
		int[] count=new int[100001];
		int number=0;
		for(int i=0;i<n;i++){
			list[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			count[list[i]]++;
		}
		for(int i=0;i<100001;i++){
			if(count[i]>0)number++;
		}
		if(number%2==0)System.out.println(number-1);
		else System.out.println(number);
	}
		
}

Measured memory_bytes: 50768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}

struct UF{
    vl par;
    UF(ll N):par(N){
        rep(i,N)par[i]=i;
    }
    ll root(ll x){
        if(par[x]==x)return x;
        return par[x]=root(par[x]);
    }
    bool same(ll x,ll y){
        return root(x)==root(y);
    }
    void unite(ll x,ll y){
        x=root(x),y=root(y);
        if(x==y)return;
        par[x]=y;
        return;
    }
};

int main() {
ll N;
  ll M;
    cin >>N>>M;
  vl p(N);
  rep(i,N) {
    ll aa;
cin >>aa;
    p.at(i)=aa-1;
  }
vl x(M);
  vl y(M);
  rep(i,M) {
cin >>x.at(i)>>y.at(i);
  }

  UF tree(N);
  rep(i,M) {
tree.unite(x.at(i)-1,y.at(i)-1);
  }
ll sum=0;
  rep(i,N) {
    if(tree.same(p.at(i),i)) {
sum++;
    }
       }

       
       cout<<sum<<endl;
       }


  
  
  
      
      

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpi;
typedef pair<int, int> pint;
typedef set<int> si;
typedef set<pint> spi;

main () {
    ll n, x;
    scanf("%lld%lld", &n, &x);
    ll ans = 3 * (n - __gcd(n, x));
    printf("%lld", ans);
    exit(0);
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007



struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


ll n, m;
vector<vector<ll>> la(110000);
UnionFind s(110000);
int main() {
	cin >> n >> m;
	REP(i, n) {
		ll a; cin >> a;
		REP(j, a) {
			ll b; cin >> b;
			la[b - 1].push_back(i);
		}
	}
	REP(i, m) {
		if (la[i].size() > 0){
			REP(j, la[i].size() - 1) {
				s.unionSet(la[i][j], la[i][j + 1]);
			}
		}
	}
	cout << (s.size(0) == n ? "YES" : "NO") << endl;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x,ll y,ll m) 
{
    ll res = 1; 
    x = x % m;                
    if (x == 0)
        return 0; 
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

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

void solve()
{
    ll a,b,n;
    cin>>a>>b>>n;
    if(b<=n)
    cout<<((b-1)*a)/b;
    else {
        cout<<(n*a)/b;
    }
}

int main()
{
    fastio;
    int t;
    t=1;
    //cin >> t;
    //int test=t;
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        //cout<<newl;
    }

    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
int main()
{
    // que[R] = {L, index_of_query};
    // um is map such that um[element] = last index the element was seen
    // s - a set that contains the last index as mentioned above
    // code assumes 0 indexed
    // complexity - O(n*log(n))
  
    unordered_map<int, int>um;
    pbds s;
    int n; cin >> n;
     int q; cin >> q;
    vector<int>a(n);
    for (auto &it : a)
        cin >> it;
  
    vector<int>ans(q);
    vector<vector<pair<int, int>>>que(n);
    for (int i = 0; i < q; i++)
    {
        int L, R; cin >> L >> R;
        L --;
        R--;
        que[R].push_back({L, i});
    }
    for (int i = 0; i < n; i++)
    {
        if (um.count(a[i]))
            s.erase(um[a[i]]);
        um[a[i]] = i;
        s.insert(i);
        for (auto it : que[i])
            ans[it.second] = s.size() - s.order_of_key(it.first);
    }
    for (int i = 0; i < q; i++)
        cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 72532
#include <stdio.h>
int main(){
  char s[11]={};
  int i,f=1,fc=0,l,ct=0;
  scanf("%s",s);
  for(i=1;;i++){
    if(s[i]==0){
      l=i;
      break;
    }
  }
  if(s[0]!='A'){
    f=0;
  }
  for(i=1;i<l;i++){
    if(i>=2 && i<l-1){
      if(s[i]=='C'){
        ct++;
        if(ct==1){
          fc=1;
        }else{
          fc=0;
        }
      }else if(s[i]<'a' || s[i]>'z'){
        f=0;
      }
    }else{
      if(s[i]<'a' || s[i]>'z'){
        f=0;
      }
    }
  }
  if(f==1&&fc==1){
    printf("AC\n");
  }else{
    printf("WA\n");
  }
  return 0;
}


Measured memory_bytes: 128
/* Author darklight13 -_- 
   IIT Patna 
*/
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
// typedef tree<int, null_type, less<int>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//     data_set;
#define rep(i,l,r)   for(int i=(l);i<(r);i++)
#define deb(x)     cout << (#x) << " is " << (x) << endl
#define dbg(x)     cout << x << ' '
#define here cout << " Hey! ";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld PI = 3.1415926535898;

int32_t main()
{
	SYNC
	int a,b,c;
	cin >> a >> b >> c;
	if(4*a*b < sq(c-a-b) & c >= (a+b)) {
		cout << "Yes";
	}else {
		cout << "No";
	}
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)

#include "bits/stdc++.h"

using namespace std;

#define all(a) begin(a), end(a)
#define MOD 1000000007
#define PII pair<int, int>
#define REP(x, l, u) for (ll x = l; x < u; x++)
#define RED(x, l, u) for (ll x = l; x >= u; x--)
#define complete_unique(a) a.erase(unique(begin(a), end(a)), end(a))
#define mst(x, a) memset(x, a, sizeof(x))
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b) {
    long long res = 1;
    while (b) {
        if (b & 1) {
            res = a * res;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll gcd(ll a, ll b) {
    a = abs(a), b = abs(b);
    while (b != 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

bool is_prime(int n) {
    if (n == 0)return false;
    if (n == 1)return false;
    if (n == 2)return true;
    if (n % 2 == 0)
        return false;
    int j = sqrt(n);
    for (int i = 2; i <= j; ++i) {
        if (n % i == 0)
            return false;
    }
    return true;
}

ll reverse_num(ll n) {
    ll x = 0, t = n;
    while (t != 0) {
        x = x * 10 + t % 10;
        t /= 10;
    }
    return x;
}

void solve() {
    //    freopen("C:\\Users\\26019\\Downloads\\P1195_4.in", "r", stdin);
    //    fclose(stdin);
    int n;
    cin >> n;
    vector<char> stone(n);
    for (int i = 0; i < n; i++) {
        cin >> stone.at(i);
    }
    int r = 0;
    for (char c : stone) {
        if (c == 'R') r++;
    }
    int res = 0;
    for (int i = 0; i < r; i++) {
        if (stone[i] == 'W') { res++; }
    }
    cout << res;
}


int main() {
    // 加速输入和输出
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}



Measured memory_bytes: 3664
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

const int s=1001;

using namespace std;

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

	int q;
	static unsigned int dp[s][s] = {0};
	
	dp[0][0] = 0; dp[0][1] = 0; dp[1][0] = 0;

	cin >> q;
	for(int k=0; k < q; k++){
		string X,Y;
		cin >> X >> Y;
		int i,j;
		for(i=0;i<X.size();i++){
			for(j=0;j<Y.size();j++){
				if(X[i] == Y[j]) dp[i+1][j+1] = dp[i][j] + 1;
				else dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
			}
		}
		cout << dp[i][j] << "\n";
	}
	return 0;
}


Measured memory_bytes: 7072
import qualified Data.ByteString.Char8 as B
import qualified Data.IntSet           as S
import           Data.Maybe            (fromJust)

readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = readInts <$> B.getLine

main :: IO ()
main = do
  n <- readLn
  as <- getInts
  putStrLn $ if solve n as then "YES" else "NO"

solve :: Int -> [Int] -> Bool
solve n as = S.size (S.fromList as) == n


Measured memory_bytes: 34172
#include <stdio.h>
#include <string.h>
int main(){
	char s[200000];
	scanf("%s",s);
	int l;
	l=strlen(s);
	long int ans;
	ans=0;
	int i;
	int j;
	j=0;
	char S[200000];
	for(i=0;i+j<l;i++){
		if(s[i+j]=='B'&&s[i+1+j]=='C'){
			S[i]='D';
			j=j+1;
		}else{
			S[i]=s[i+j];
		}
	}
	int m;
	m=l-j;
	long int k;
	k=0;
	for(i=m-1;i>=0;i--){
		if(S[i]=='D'){
			k=k+1;
		}else if(S[i]=='A'){
			ans=ans+k;
		}else{
			k=0;
		}
	}
	printf("%ld",ans);
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(void){
  string S[2];
  cin >> S[0];
  cin >> S[1];
  int A, B;
  cin >> A >> B;
  string U;
  cin >> U;

  if(S[0] == U)
    A--;
  else
    B--;

  cout << A <<" "<< B << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
s=[]
for i in range(n):
    s.append(input())
march_dict={"M":0,"A":1,"R":2,"C":3,"H":4}
march_list=[0,0,0,0,0]
for i in range(n):
    if s[i][0] in march_dict:
        march_list[march_dict[s[i][0]]]+=1
ans=0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            ans+=march_list[i]*march_list[j]*march_list[k]
print(ans)


Measured memory_bytes: 9752
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
const ll MAX = 30000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,a,b;
    cin >> x >> a >> b;
    if (abs(x-a) < abs(x-b)) PRINT("A");
    else PRINT("B");
}


Measured memory_bytes: 3608
N,M=map(int,input().split())
H=list(map(int,input().split()))
check=[0]*N
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]<H[B-1]:
        check[A-1]=check[A-1]+1
    elif H[A-1]>H[B-1]:
        check[B-1]=check[B-1]+1
    else:
        check[A-1]=check[A-1]+1
        check[B-1]=check[B-1]+1
ans=check.count(0)
print(ans)

Measured memory_bytes: 20132
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        ll n,k,q; cin >> n >> k >>  q;
        vll a(n+1,0);
        for(int i = 0; i<q; i++){
            int v; cin >> v;
            a[v-1]++;
        }
        for(int i = 0; i<n; i++){
            a[i] = k - (q-a[i]);
            if(a[i]<=0)cout<<"No"<<endl;
            else cout<<"Yes"<<endl;
        }



return 0;
}




Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
  string s;
  while(getline(cin, s)) {
    for (int i=0; i<26; i++) {
      string s2(s);
      for (int j=0; j<s.length(); j++) {
        if (isalpha(s[j]))
          s2[j] = (s[j]-'a'+i) % 26 + 'a';
      }
      if (s2.find("the")!=-1||s2.find("this")!=-1||s2.find("that")!=-1) {
        cout << s2 << endl;break;
      }
    }
  }
}


Measured memory_bytes: 3164
module Main where

import Data.Functor ((<$>))

area :: Int -> Int -> Int
area w h = w * h

perimeter :: Int -> Int -> Int
perimeter w h = w + w + h + h

main = do
  [w, h] <- map read . words <$> getLine
  putStrLn $ show (area w h) ++ " " ++ show (perimeter w h)



Measured memory_bytes: 3620
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b;
    scanf("%d",&a);
    scanf("%d",&b);
    printf("%d\ ",a/b);
    printf("%d\ ",a%b);
    printf("%.5lf\n",(double)a/b);
    return 0;
}


Measured memory_bytes: 2740
#include<bits/stdc++.h>
#define M 502
#define mo 1000000007
#define oo 1000000000
#define LL long long
using namespace std;

void read(int &x){
    char c; x=0;
    for (c=getchar(); c<48;)c=getchar();
    for (; c>=48; c=getchar())x=(x<<1)+(x<<3)+(c^48);    
}

int len,ans,i,j,l,r,a[500],b,c;
char s[500];
int main(){
	scanf("%s",s); 
	for (i=1; (s[i-1]>='a')&&(s[i-1]<='z'); i++){
		a[i]=s[i-1]-'a';
	}
	len=i-1;
	for (i=len-1; i>=2; i--)if (i%2==0){
		int t=1; l=0; r=i/2;
		for (j=1; t&&j<=i/2; j++){if (a[r+j]!=a[l+j]) t=0;}
		if (t==1){
			printf("%d\n",i); return 0;
		}		
	}
	return 0;
}

Measured memory_bytes: 256
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] arguments = br.readLine().split(" ");
		double a = Double.parseDouble(arguments[0]);
		double b = Double.parseDouble(arguments[1]);
		double theta = Double.parseDouble(arguments[2]);
		theta = toRadians(theta);
		
		double c = sqrt(pow(a, 2.0) + pow(b, 2.0) - (2.0 * a * b * cos(theta)));
		double surface = a * b * sin(theta) / 2.0;
		double height = b * sin(theta);
		double length = a + b + c;
		
		System.out.println(surface);
		System.out.println(length);
		System.out.println(height);
	}

}

Measured memory_bytes: 17012