akhauriyash/Code-Regression huggingface dataset:
/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define GCD(a,b) __gcd(a,b);
#define endl "\n"
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define INFLL 9223372036854775807
#define debug 0
#define MAXN   100001
#define ar array
const int mxN=2e5;
const int MOD=1e9+7;
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
//Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
int main()
{
    fastio;
    ll n;
    cin>>n;
    vector<string>v;
    while(n--)
    {
        string s;
        cin>>s;
        v.pb(s);

    }
    cout<<"AC"<<" "<<"x"<<" "<<count(v.begin(),v.end(),"AC")<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<count(v.begin(),v.end(),"WA")<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<count(v.begin(),v.end(),"TLE")<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<count(v.begin(),v.end(),"RE")<<endl;

}


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

int main() {
    int N, Q; cin >> N >> Q;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    reverse(A.begin(), A.end()); // 考えやすいように左右反転
        
    vector<long long> sum(N+1), evensum(N+1); // 累積和、偶数番目累積和
    for (int i = 0; i < N; ++i) {
        sum[i+1] = sum[i] + A[i];
        evensum[i+1] = evensum[i] + (i % 2 == 0 ? A[i] : 0);
    }
        
    vector<long long> ths, vals; // ths: L の値が変化する x の境目、vals: またそのときの先手のスコア
    for (int i = 0; i < (N-1)/2; ++i) {
        // 先手が i + 1 個の領域を取ったときは
        // 後手も i + 1 個の領域を取る
        long long th = (A[i+1] + A[i*2+2])/2 + 1; // 後手が取る数値の真ん中
        long long val = (sum[i+1] - sum[0]) + (evensum[N] - evensum[i*2+2]);
        // (sum[i+1] - sum[0]) は先手が予め取ったスコア これに 青が取った領域の右から交互に取る
        // 青の取る領域は i+1からi+1個なのでええええ
        ths.push_back(th); vals.push_back(val);
    }
    reverse(ths.begin(), ths.end()); reverse(vals.begin(), vals.end());
    for (int _ = 0; _ < Q; ++_) {
        long long x; cin >> x;
        int it = upper_bound(ths.begin(), ths.end(), x) - ths.begin(); // L の値が何かを求める
        if (it == 0) cout << sum[(N+1)/2] - sum[0] << endl;
        else cout << vals[it-1] << endl;
    }
}

Measured memory_bytes: 5108
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: String = input();
    let mut t = "2018".to_string();
    t.push_str(&s.chars().skip(4).collect::<String>());
    println!("{}", t);
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  string s;
  stringstream ss;
  cin >> s;
  bool judge = true;
  if(s[0] != 'A') judge = false;

  int nc = 0;
  for(int i=2;i<s.length()-1;i++) if(s[i]=='C') nc++;
  if(nc != 1) judge = false;

  nc = 0;
  for(int i=0;i<s.length();i++){
    if(s[i] >='A' && s[i] <= 'Z') nc ++;
  }
  if(nc != 2) judge = false;
  if(judge) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;

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

	BufferedReader br =
	new BufferedReader(new InputStreamReader(System.in));

	String str1 = br.readLine();
	String str2[] = str1.split(" ");
	int a = Integer.parseInt(str2[0]);
	int b = Integer.parseInt(str2[1]);
	int c = a*b;
	int d = 2*(a+b);
	System.out.println( c + " " + d );

	}
}

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

int main() {
    char C[2][3];
    std::cin >> C[0][0] >> C[0][1] >> C[0][2]
             >> C[1][0] >> C[1][1] >> C[1][2];

    if (C[0][0] == C[1][2] && C[0][1] == C[1][1] && C[0][2] == C[1][0]) {
        std::cout << "YES\n";
    } else {
        std::cout << "NO\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[10005];
int main(void)
{
    int n,m,sum=0;
    cin >> n >> m;
    for(int i=1;i<=m;i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    if(sum>n) cout << "-1";
    else cout << n-sum;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    ll A = 0, B = 0, C = 0, D = 0, E = 0;
    map<ll, ll> m;
    cin >> N;
    for(ll i = N;i > 0;i--) {
        ll cur = i;
        for(ll j = 2;j <= i;j++) {
            while(cur % j == 0) {
                m[j]++;
                cur /= j;
            }
        }
    }
    for(auto &j: m) {
        if(j.second >= 74) A++;
        if(j.second >= 24) B++;
        if(j.second >= 2) C++;
        if(j.second >= 14) D++;
        if(j.second >= 4) E++;
    }
    cout << A + B * (C - 1) + D * (E - 1) + E * (E - 1) * (C - 2) / 2  << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
typedef long long ll;
typedef unsigned long long LL;
using namespace std;
int n,h;
int main()
{
	scanf("%d%d",&n,&h);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if(x>=h)
			ans++;
	}
	printf("%d\n",ans);
	//system("pause");
	return 0;
}


Measured memory_bytes: 504
a, b = map(int, input().split())
s = input()
valid = True
for i in range(len(s)):
    if (i + 1) <= a:
        if not ('0' <= s[i] <= '9'):
            valid = False
            break
    elif i + 1 == a + 1:
        if not s[i] == '-':
            valid = False
            break
    else:
        if not ('0' <= s[i] <= '9'):
            valid = False
            break
if valid is False:
    print('No')
else:
    print("Yes")


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
int gcd(int x,int y){
	if(y==0)return x;
	return gcd(y,x%y);
}
int lcm(int x,int y){
	return x*y/gcd(x,y);
}
int main()
{
	int N;
	int ans;
	int A[10];
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d",&A[i]);
	ans=A[0];
	for(int i=1;i<N;i++){
		ans=lcm(ans,A[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1192
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line
            .split_whitespace()
            .map(String::from)
            .collect();
        self.index = 0;
    }
}

#[derive(Clone)]
struct Node {
    edges: Vec<usize>,
}

impl Node {
    fn new() -> Self {
        Self {
            edges: vec![],
        }
    }
}

type Tree = Vec<Node>;

fn solve(tree: &mut Tree) -> i64 {
    let mut res = 0;
    for i in 0..tree.len() {
        tree[i].edges.sort();
        tree[i].edges.reverse();

        let steps = (tree.len() - i) as i64;
        let mut delta = 1;
        let mut prev = i as i64;

        for &node in tree[i].edges.iter() {
            let count = prev - node as i64;
            res += delta * steps * count;
            delta -= 1;
            prev = node as i64;
        }
        res += delta * steps * (prev + 1);
    }
    res
}

fn main() {
    let mut reader = TokenReader::new();
    let nodes = reader.next::<usize>();

    let mut tree = vec![Node::new(); nodes];
    for _ in 1..nodes {
        let a = reader.next::<usize>() - 1;
        let b = reader.next::<usize>() - 1;
        tree[std::cmp::max(a, b)].edges.push(std::cmp::min(a, b));
    }

    let res = solve(&mut tree);
    println!("{}", res);
}


Measured memory_bytes: 12844
s = input()
mod = 2019
ls = [1]+[0]*2018
ans = 0
temp=0
m=1
for i in range(len(s)):
    temp= (temp + m*int(s[-i-1]))%mod
    m=(m*10)%mod

    ls[temp] += 1

for i in ls:
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 68436
#include<cstdio>
#include<algorithm>
#define int long long
const int N=200003;
int x[N],ans[N],g[N],n,m,k,used[N],siz;
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",x+i),g[i]=i;
	for(int i=n;i;i--)x[i]-=x[i-1];
	scanf("%lld%lld",&m,&k);
	for(int i,j=1;j<=m;j++)scanf("%lld",&i),std::swap(g[i],g[i+1]);
	for(int i=1,j,v;i<=n;i++)if(!used[i]){
	  siz=1;
	  for(j=g[i];j!=i;j=g[j])
		siz++;
	  j=i;
	  for(int id=1;id<=k%siz;id++)j=g[j];
	  ans[i]=x[j],used[j]=1;
	  for(j=g[j],v=g[i];!used[j];j=g[j],v=g[v])
		ans[v]=x[j],used[j]=1;
	}
	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]+=ans[i-1]);
	return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

const ll INF = 10000000000000009;

template <typename T>
struct Edge
{
    int to;
    T cost;
};

template <typename T>
struct WeightedGraph
{
    int n;
    vector<vector<Edge<T>>> g;
    
    WeightedGraph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to, T cost){
        g[from].push_back((Edge<T>){to, cost});
    }
};

int main()
{
    int n, m;
    ll p;
    cin >> n >> m >> p;
    WeightedGraph<ll> g(n), h(n);
    for(int i = 0; i < m; i++){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--; b--;
        g.add_edge(a, b, c - p);
        h.add_edge(b, a, 1);
    }
    ll d[2503], l[2503], r[2503];
    for(int u = 0; u < n; u++) d[u] = l[u] = r[u] = -INF;
    d[0] = 0;
    for(int i = 1; i <= n * 2; i++){
        for(int u = 0; u < n; u++){
            if(d[u] == -INF) continue;
            for(Edge<ll> e : g.g[u]){
                int v = e.to;
                d[v] = max(d[v], d[u] + e.cost);
            }
        }
        if(i == n){
            for(int u = 0; u < n; u++) l[u] = d[u];
        }
    }
    bool b[2503]{0};
    b[n - 1] = true;
    queue<int> que;
    que.push(n - 1);
    while(que.size()){
        int u = que.front();
        que.pop();
        for(Edge<ll> e : h.g[u]){
            int v = e.to;
            if(!b[v]){
                b[v] = true;
                que.push(v);
            }
        }
    }
    for(int u = 0; u < n; u++){
        if(d[u] > l[u] && b[u]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << max(l[n - 1], 0ll) << endl;
}


Measured memory_bytes: 4092
#include<bits/stdc++.h>
using namespace std;
int n;
int x[110],y[110],h[110];
vector<int> big;
int main() {
	cin>>n;
	for(int i=0; i<n; i++) {
		cin>>x[i]>>y[i]>>h[i];
	}
	for(int i=0; i<=100; i++) {
		for(int j=0; j<=100; j++) {
			int H=-1;
			big.clear();
			for(int k=0; k<n; k++) {
				int tmp1=abs(i-x[k]);
				int tmp2=abs(j-y[k]);
				int tmph=tmp1+tmp2+h[k];
				if(h[k]==0) {
					big.push_back(tmph);
					continue;
				}
				if(H==-1) {
					H=tmph;
				} else if(H!=tmph) {
					H=-1;
					break;
				}
			}
			bool ok=true;
			for(int k=0; k<big.size(); k++) {
				if(H>big[k]) {
					ok=false;
					break;
				}
			}
			if(H>=1&&ok) {
				cout<<i<<" "<<j<<" "<<H<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=101010;
const ll mod=1e9+7;

int main(){
  int n,k;
  cin >> n >> k;
  vector<ll> dp(mx,longinf);
  vector<ll> h(n);
  rep(i,n){ cin>>h[i]; }
  dp[0]=0;
  rep(i,n)for(int j=1; j<=k; j++){
    dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j])); 
  }
  ll ans=dp[n-1];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
n=int(input())
l = [list(map(int,input().split())) for i in range(n)]
ans='No'
    
for i in range(n-2):

    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
        ans='Yes'
    
print(ans)

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

typedef long long ll;

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

    int N; cin >> N;
    map<char, int> char_cnt[N];

    for (int i = 0; i < N; ++i) {
        string s; cin >> s;
        for (char c : s) {
            char_cnt[i][c]++;
        }
    }

    map<string, ll> anagram_key_cnt;
    for (int i = 0; i < N; ++i) {
        string key;
        for (auto v : char_cnt[i]) {
            key.push_back(v.first);
            key.append(to_string(v.second));
        }
        anagram_key_cnt[key]++;
    }

    ll ans = 0;
    for (auto v : anagram_key_cnt) {
        ll val = v.second;
        ans += val*(val - 1)/2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 57728
#include<stdio.h>
#include<string.h>

int strSize = 12;
int charKind = 4;
int L = 1046527;
char hashList[1046527][12];

int hash(char str[]) {
	int hash = 0;
	int kindPower = 1, charValue;
	for (int i = 0; i < strSize; i++) {
		if (str[i] == 'A') {
			charValue = 1;
		} else if (str[i] == 'C'){
			charValue = 2;
		} else if (str[i] == 'G'){
			charValue = 3;
		} else if (str[i] == 'T'){
			charValue = 4;
		}
		hash += charValue*kindPower;
		kindPower *= charKind+1;
	}
	int h1 = hash%L, h2 = 1+hash%(L-1);

	for (int i = 0;;i++) {
		int res = (h1+i*h2)%L;
		if (strcmp(hashList[res], str) == 0) {
			return res;
		}
		if (hashList[res][0] == '\0') {
			return res;
		}
	}
}

int main() {
	int n;

  scanf("%d", &n);


  char order[n][12], str[n][strSize];
	bool output[n];
  int countf = 0;

  for ( int i = 0; i < n; i++ ) {
		scanf("%s %s", order[i], str[i]);
	}

  for ( int i = 0; i < n; i++ ) {
		if (strcmp(order[i], "insert") == 0) {
			strcpy(hashList[hash(str[i])],str[i]);
		} else {
      if (strcmp(hashList[hash(str[i])],str[i]) == 0) {
        output[countf] = true;
      } else {
        output[countf] = false;
      }
      countf++;
    }
	}

  for (int i = 0; i < countf; i++) {
    if (output[i]) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }

  return 0;
}



Measured memory_bytes: 38736
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n;cin>>n;
    vector<int>A(n);cin>>A;
    
    int c=1;
    int flag = 0;
    for(auto i = 1;i<n;i++){
        
        if(A[i]==A[i-1])continue;
        
        if(A[i]>A[i-1] && flag == 0){
            flag = 1;
            continue;
        }
        
        if(A[i]<A[i-1] && flag == 0){
            flag = -1;
            continue;
        }
        
        if(A[i]>A[i-1] && flag == 1)continue;
        if(A[i]<A[i-1] && flag == -1)continue;
        
        c++;
        flag = 0;
    }
    cout<<c<<endl;
    return 0;
}








Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>a(n+1),b(n);
  rep(i,n+1)cin>>a[i];
  rep(i,n)cin>>b[i];
  ll res=0;
  rep(i,n)
  {
    int e=min(a[i],b[i]);
    res+=e;b[i]-=e;
    e=min(a[i+1],b[i]);
    res+=e;a[i+1]-=e;
  }
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int cnt=1,ans=0;
int n,a[200010];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		if(a[i]==cnt) cnt++;
		else ans++;
	if(cnt!=1) printf("%d",ans);
	else printf("-1");
	return 0;
}

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

int main(int argc, const char * argv[]) {
    int N;
    int x;
    int count = 0;
    
    cin >> N >> x;
    
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    
    sort(a.begin(), a.end());
    for (int i = 0; i < a.size() - 1; i++) {
        if (x >= a[i]) {
            x -= a[i];
            count++;
        }
    }
    if (x == a[a.size() - 1]) {
        count++;
    }
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll ar[N];
void preprs(ll n){
	for(ll i=1;i<=n;i++){
		ar[i]=i;
	}
}
ll root(ll i){
	while(ar[i]!=i){
		ar[i]=ar[ar[i]];
		i=ar[i];
	}
	return i;
}
void dunion(ll x,ll y){
	x=root(x); y=root(y);
	if(x==y) return ;
	if(y<x) swap(x,y);
	ar[y]=x;
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,q;
	cin>>n>>q;
	preprs(n);
	while(q--){
		cin>>i>>k>>l;
		if(i==0){
			dunion(k,l);
		}
		else{
			if(root(k)==root(l)) cout<<"1"<<endl;
			else cout<<"0"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 5176
#include <iostream>

using namespace std;

void printArr(int a[], int len) {


	for (int i = 0; i < len; i++)
	{
		if (i == 0) cout << a[0];
		else cout << " " << a[i];
	}
	cout << endl;
}

int bubbleSort(int a[], int len) {

	int count = 0;
	bool flag = false;	//是否完成
	for (int i = 0; i < len; i++) {
		flag = true;
		for (int j = len - 1; j > i; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				count++;
				flag = false;
			}
		}
		if (flag) return count;
	}
	return count;
}

int main() {

	int n;
	cin >> n;
	
	int* r = new int[n];

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

	int count = bubbleSort(r, n);
	printArr(r, n);
	cout << count << endl;

	delete[] r;
	return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#define endl "\n"
typedef long long ll;

using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

int  frq[200];
int main(){
	Lancer();
	//cout << fixed << setprecision(12);

	ll n,sum=0;
	cin >> n;
	for (int i = 1; i <= n; i++){
		if (i % 3 != 0 && i % 5 != 0)
			sum += i;
	}
	cout << sum;
	cout << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,x,a=0;
    cin>>n;
    for (int i=1;i<=n;++i)
    {
        cin>>x;
        if ((x&1)&&(i&1))
            ++a;
    }
    cout<<a;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (1e9)

int main() {
  ll n, x, y;
  cin >> n >> x >> y;
  map<ll, ll> ans;

  for(ll i = 1; i < n; i++) {
    for(ll j = i+1; j <= n; j++) {
      ans[min(abs(i-j), abs(x-i)+1+abs(y-j))]++;
    }
  }

  for(int i = 1; i < n; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

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

int main()
{
  int N, a, max = INT_MIN, min = INT_MAX;
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> a;
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << max - min << 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[] x= new int[n];
		int [] y = new int[n];
		long[] h = new long[n];
		int t=0;
		for(int i=0;i<n;i++) {
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
			h[i]=sc.nextInt();
			if(h[i]!=0) {
				t=i;
			}
		}
		long H=0;
		for(int i=0;i<=100;i++) {
			for(int j=0;j<=100;j++) {
				H=h[t]+Math.abs(x[t]-i)+Math.abs(y[t]-j);
				boolean ch=true;
				for(int k=0;k<n;k++) {
					if(h[k]!=Math.max(H-Math.abs(x[k]-i)-Math.abs(y[k]-j),0)) {
						ch=false;
						break;
					}
				}
				if(ch) {
					System.out.println(i+" "+j+" "+H);
				}
			}
		}


	}
}

Measured memory_bytes: 22100
# E - Dividing Chocolate
import numpy as np

H, W, K = map(int, input().split())
S = np.zeros((H, W), dtype=np.int64)

ans = H+W

for i in range(H):
    S[i] = list(str(input()))

for m in range(1<<(H-1)):
    cut = bin(m).count('1')
    if cut >= ans:
        continue

    wp = np.zeros((cut+1, W), dtype=np.int64)
    wp[0] = S[0]
    c = 0
    for n in range(H-1):
        if m>>n&1:
            c += 1
        wp[c] += S[n+1]

    if np.count_nonzero(wp > K):
        continue

    wq = np.zeros((cut+1, ), dtype=np.int64)
    for j in range(W):
        wq += wp[:,j]
        if np.count_nonzero(wq > K):
            cut += 1
            wq = wp[:,j]

    ans = min(ans, cut)

print(ans)




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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

ll const mod = 1e9+7;

int up(int i,int k) {
  return (i+k-1)/k;
}

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<vector<ll>> memo(10,vector<ll> (4,0));
  vector<ll> dp(4,0),td(4,0);
  dp[0] = 1;
  rep(i,N) {
    int t = S[i] - '0';
    td[0]=1;
    rep2(j,1,4) {
      td[j] = -memo[t][j];
      td[j] += dp[j-1] + dp[j];
      td[j]%=mod;
      memo[t][j] = dp[j-1];
      // cout << td[j] << ' ';
    }
    swap(td,dp);
  }
  cout << dp[3] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[200001],ans;
map<int,int> mp;
int Get(int x)
{
	int res=1;
	while (res<=x) res*=2;
	return res;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=0;i<n;++i) cin>>a[i],++mp[a[i]];
	sort(a,a+n);
	reverse(a,a+n);
	for (int i=0;i<n;++i)
	{
		if (mp[a[i]]==0) continue;
		int tot=Get(a[i]);
		--mp[a[i]];
		if (mp.count(tot-a[i]) && mp[tot-a[i]]!=0) --mp[tot-a[i]],++ans;
    }
	cout<<ans;
	return 0;
}

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

const int MAXH = 110;
const int MAXW = 110;
const int MAXN = MAXH * MAXW;
int H, W;
int N;

int ans[MAXH][MAXW];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> H >> W >> N;
	auto move = [&](int a, int b) -> pair<int, int> {
		if (vector<int>({W-1, 0})[a%2] == b) {
			return {a+1, b};
		} else {
			return {a, b + 1 - 2 * (a % 2)}; 
		}
	};
	int a = 0, b = 0;
	for (int c = 1; c <= N; c++) {
		int v; cin >> v;
		while (v--) {
			ans[a][b] = c;
			tie(a, b) = move(a, b);
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << ans[i][j] << " \n"[j==W-1];
		}
	}

	return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
inf = 10 ** 14
dp = [[0] * (N + 1) for _ in range(N)]
for l in range(N):
  for r in range(l, N + 1):
    if l == r: continue
    if (N - (r - l)) % 2: dp[l][r] = inf
    else: dp[l][r] = -inf
for c in range(N + 1):
  for l in range(N - c + 1):
    if l == N: continue
    r = l + c
    t = (N - (r - l)) % 2
    if l - 1 >= 0:
      if t == 0:
        dp[l - 1][r] = min(dp[l - 1][r], dp[l][r] - a[l - 1])
      else:
        dp[l - 1][r] = max(dp[l - 1][r], dp[l][r] + a[l - 1])
    if r + 1 <= N:
      if t == 0:
        dp[l][r + 1] = min(dp[l][r + 1], dp[l][r] - a[r])
      else:
        dp[l][r + 1] = max(dp[l][r + 1], dp[l][r] + a[r])
print(dp[0][N])

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

typedef long long ll;

#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define clr(a, b) memset(a, b, sizeof(a))
#define forn(i, n) for(int i=0; i<(int)(n); ++i)
#define forab(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    clock_t tStart = clock();
#endif
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if((d1 == 30 || d1 == 31) && d2 == 1)
        cout << 1 << "\n";
    else if(d1 == 28 && d2 == 1)

        cout << 1 << "\n";
    else
        cout << 0 << "\n";
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * (clock() - tStart)/ CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
# B

N, L = map(int, input().split())

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

if azi_list[0]<=0 and azi_list[-1]>=0:
#     print(1)
    print(sum(azi_list))
elif abs(azi_list[0]) < abs(azi_list[-1]):
#     print(2)
    print(sum(azi_list[1:]))
else:
#     print(3)
    print(sum(azi_list[:-1]))

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

typedef long long ll;

using namespace std;

int main()
{
    ll n, x;
    vector<ll> l;
    ll tmp;

    cin >> n >> x;
    for (ll i=0; i<n; ++i)
        cin >> tmp, l.push_back(tmp);

    ll d = 0;
    ll counter;

    //cout << d << endl;
    for (ll i=0; i<n; ++i)
    {
        //cout << d + l[i] << endl;
        d = d + l[i];

        if (d <= x)
        {
            counter++;
        }
        else
            break;
    }

    cout << ++counter << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	ar := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	sort.Ints(ar)
	min := 2000000000
	for i := k - 1; i < n; i++ {
		diff := ar[i] - ar[i-k+1]
		if diff < min {
			min = diff
		}
	}
	fmt.Println(min)
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  
  string A,B;
  int count;
  cin >> A >> B;
  
  rep(i, 3){
    if ( A.at(i) == B.at(i) ){
      count++;
    }
  }
    cout << count << endl;
}

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

ll N, K;
const int MAX_N = 1.0e5 + 10;
pair<int, int> ab[MAX_N];

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(ab, ab+N);

    ll cnt = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (cnt >= K) {
            break;
        }
        else {
            cnt += ab[i].second;
            ans = ab[i].first;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string P[20];
int N, c[26], F[20], r[20]; char d[26]; int cnt1 = 0;
int X10[3628800];
int fact(int n) {
	int sum1 = 1;
	for (int i = 1; i <= n; i++)sum1 *= i;
	return sum1;
}
int main() {
	int a2[10] = { 0,1,2,3,4,5,6,7,8,9 }, cnt4 = 0;
	do {
		for (int i = 0; i < 10; i++) {
			if (!a2[i]) X10[cnt4] = i;
		}
		cnt4++;
	} while (next_permutation(a2, a2 + 10));
	while (true) {
		for (int i = 0; i <= 10; i++) { F[i] = fact(i); r[i] = 0; }
		for (int i = 0; i < 20; i++) { P[i] = ""; }
		for (int i = 0; i < 26; i++) { c[i] = 0; d[i] = ' '; }
		cnt1 = 0;
		cin >> N; if (N == 0) { break; }
		for (int i = 0; i < N; i++) {
			cin >> P[i];
			for (int j = 0; j < P[i].size(); j++) {
				c[P[i][j] - 'A']++;
			}
		}
		for (int i = 0; i < 26; i++) {
			if (c[i] >= 1) {
				d[i] = cnt1 + 'A';
				cnt1++;
			}
			else {
				d[i] = 'Z';
			}
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < P[i].size(); j++) {
				P[i][j] = d[P[i][j] - 'A'];
			}
			if (P[i].size() >= 2) { r[P[i][0] - 'A'] = 1; }
		}
		int a[10] = { 0,1,2,3,4,5,6,7,8,9 };
		int cnt2 = 0, cnt3 = 0, V = 0, sum = 0;
		int R[100];
		for (int i = 0; i < N; i++)R[i] = P[i].size();
		do {
			if (cnt2 % F[10 - cnt1]) { cnt2++; continue; }
			if (r[X10[cnt2]] == 1) { cnt2++; continue; }
			sum = 0;
			for (int i = 0; i < N; i++) {
				int Q = 0;
				for (int j = 0; j < R[i]; j++) Q = Q * 10 + a[P[i][j] - 'A'];
				if (i != N - 1) sum += Q;
				else if (sum == Q) cnt3++;
			}
		E:;
			cnt2++;
		}
		while (next_permutation(a, a + 10));
		cout << cnt3 << endl;
	}
	return 0;
}

Measured memory_bytes: 17268
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  int digit;
  digit = floor(log10(N)) + 1;
  int sum = 0;
  for(int i=0; i<digit; i++){
    sum += (int)(N / pow(10, i)) % 10;
  }
  if(N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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)

using ll = long long;
#define INF 1e9

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(M);
  REP(i, N){
    cin >> A[i];
  }
  REP(i, M){
    cin >> B[i];
  }
  bool ans = false, flag = true;
  REP(i, N-M+1){
    REP(j, N-M+1){
      flag = true;
      REP(k, M){
        if(flag == false){
          break;
        }
        REP(l, M){
          if(B[k][l] != A[i+k][l+j]){
            flag = false;
            break;
          }
        }
      }
      if(flag){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

int main()
{
	
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<max(0,min(b,d)-max(a,c))<<endl;

}



Measured memory_bytes: 3576
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{n:usize, a:[i64;n]};
    let mut a = a;
    a.sort();
    println!("{}", a[a.len()-1]-a[0]);
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

int main()
{
  int n, m, q;
  cin >> n >> m >> q;

  vvi s(n+1, vi(n+1));
  rep(i, m){
    int l, r;
    cin >> l >> r;
    s[l][r]++;
  }

  rep(i, n+1){
    rep(j, n){
      s[i][j+1] += s[i][j]; 
    }
  }

  while(q--){
    int a, b;
    cin >> a >> b;

    int ans = 0;
    repi(i, a, b+1){
      ans += s[i][b];
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main(){
    int n;
    int x,y;
    cin >> n;
    vector<pii> pos;
    double total = 0;
    rep(i,n){
        cin >> x >> y;
        pos.push_back(make_pair(x,y));
    }

    rep(i,n){
        reps(j,i+1,n){
            total += sqrt((pos[i].first - pos[j].first) * (pos[i].first - pos[j].first) + (pos[i].second - pos[j].second) * (pos[i].second - pos[j].second));
        }
    }

    int fact = 1,factN=1;
    reps(i,1,n-1) fact *= i;
    reps(i,1,n+1)factN *= i;
    double ans =  total * 2 * (n-1) * fact;

    printf("%.9f\n",ans/factN);
    //cout << "tot:" << total << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
sd = {input():1}
for i in range(n-1):
    s = input()
    if s in sd:
        sd[s] += 1
    else:
        sd[s] = 1

m = int(input())
td = {input():1}
for i in range(m-1):
    t = input()
    if t in td:
        td[t] += 1
    else:
        td[t] = 1

for x in td:
    if x in sd:
        sd[x] -= td[x]

print(max(0,max(map(int, sd.values()))))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int N;
    string S;
    cin >> N >> S;
    int res = INT_MIN;
    string L, R;
    REP( i, N - 1 )
    {
        L += S[ i ];
        R = S.substr( i + 1, S.size() - i );
        set<char> l, r;
        REP( j, (int)L.size() )
        {
            l.emplace( L[ j ] );
        }
        REP( k, (int)R.size() )
        {
            r.emplace( R[ k ] );
        }
        int cnt = 0;
        for( auto &x : l )
        {
            for( auto &z : r )
            {
                if( x != z ) continue;
                cnt++;
            }
        }
        res = max( res, cnt );
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
    int num, tmp;
    int count = 0;
    scanf("%d", &num);

    while ( num ) {
         tmp = num % 10;
         if ( tmp == 2 ) {
              count++;
         }
         num /= 10;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
lst = {"S":[0]*13, "H":[0]*13, "C":[0]*13, "D":[0]*13} 
for i in range(n):
    x, num = raw_input().split()
    num = int(num)
    lst[x][num-1] = 1
for i in ["S", "H", "C", "D"]:
  for j in range(13):
    if lst[i][j] == 0:
      print i, j+1

Measured memory_bytes: 6408
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<queue>
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	for (int i=b-a+1;i<=b+a-1;i++)
	{
		cout << i << endl;

	}
}

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

int main() 
{
        int n;
        int i;
        int a;
        int count;
        int min;

        cin >> n;
        i = -1;
        while (++i < n)
        {
                cin >> a;
                count = 0;
                while (a % 2 == 0)
                {
                        count++;
                        a /= 2;
                }
          		if (i == 0)
                	min = count;
                else if (min > count)
                    min = count;
        }
        cout << min << endl;
}


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

using namespace std;

using ll = long long;

int main() {
  int n, x;
  cin >> n >> x;
  n = n * 2 - 1;
  vector<int> v(n);
  if (n == 3) {
    if (x == 2) {
      cout << "Yes" << endl;
      cout << 2 << endl;
      cout << 1 << endl;
      cout << 3 << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
  }
  if (x < 2 || x > n - 1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  if (x >= 2 && x <= n - 2) {
    v[n / 2] = x - 1;
    v[n / 2 - 1] = x + 1;
    v[n / 2 + 1] = x;
    v[n / 2 + 2] = x + 2;
  } else {
    v[n / 2] = x + 1;
    v[n / 2 - 1] = x - 1;
    v[n / 2 + 1] = x;
    v[n / 2 + 2] = x - 2;
  }
  queue<int> q;
  for (int i = 1; i <= n; ++i) {
    if (i < x - 1 || i > x + 2)
      q.push(i);
  }
  for (int i = 0; i < n; ++i) {
    if (!v[i]) {
      v[i] = q.front();
      q.pop();
    }
  }
  for (const auto &c : v) {
    cout << c << endl;
  }
}

Measured memory_bytes: 3072
def examA():
    N = I()
    ans = 48-N
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 38256
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int X, int d) {
  return (X / d);
} 

void solve() {
  int l, r, d; cin >> l >> r >> d;
  cout << get(r, d) - get(l - 1, d) << '\n';
}

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

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <stack>

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

using namespace std;

int S[100000], T[50000];
int N;

bool binarySearch(int key)
{
    int left, right;
    left = 0;
    right = N;
    while (left < right)
    {
        int mid = (left + right) / 2;
        if (S[mid] < key)
            left = mid + 1;
        else if (S[mid] > key)
            right = mid;
        else
            return true;
    }
    return false;
}

int main()
{
    int q;
    cin >> N;
    REP(i, N)
    {
        cin >> S[i];
    }
    cin >> q;
    int count = 0;
    REP(i, q)
    {
        cin >> T[i];
        if (binarySearch(T[i]))
            count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3684
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b=input().split()
    if a==b:
        print("H")
    else:
        print("D")

main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll h, w;
  cin >> h >> w;

  ll ans = 0;

  

  ans = (h*w+1)/2;

  if(h==1 || w== 1){
    cout << 1 <<endl;
    return 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;

ll Ep(ll x, ll y){
  if(y == 1) return x;
  ll r = Ep(x,y/2);
  if(y%2 == 1) return r *r%MOD *x%MOD;
  else return r *r%MOD;
}
ll comb(ll m, ll n){
  if(m < n) return 0;
  ll ans = 1;
  for(int i=0; i<n; ++i){
    ans *= m-i;
    ans %= MOD;
    ans *= Ep(n-i, MOD-2);
    ans %= MOD;
  }
  return ans;
}

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  ll ans = Ep(2,n)-1;
  a = comb(n,a);
  b = comb(n,b);
  ans -= a-MOD;
  ans %= MOD;
  ans -= b-MOD;
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int ac = 0;
        int wa = 0;
        int[] sub = new int[n];

        for(int i = 0; i < m; i++){
            int p = sc.nextInt() - 1;
            boolean s = sc.next().equals("AC");
            if(s && sub[p] > -1){
                wa += sub[p];
                sub[p] = -1;
                ac++;
            }else if(!s && sub[p] > -1){
                sub[p]++;
            }
        }

        System.out.println(ac + " " + wa);

    }
}


Measured memory_bytes: 64100
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn];
vector<int> fac[5];
void gf(int a,int num)
{
	fac[num].push_back(1);
	fac[num].push_back(a);
	int i;
	for(i=2;i*i<a;i++)
		if(a%i==0)
		{
			fac[num].push_back(i);
			fac[num].push_back(a/i);
		}
	if(i*i==a)
		fac[num].push_back(1);
	sort(fac[num].begin(),fac[num].end());
}
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//  fl();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	gf(a[1],1);
	gf(a[2],2);
	int ans=-maxn;
	for(int t=1;t<=2;t++)
	{
		for(int i=fac[t].size()-1;i>=0;i--)
		{
			int tmp=fac[t][i],num=0;
			bool sign=true;
			for(int j=1;j<=n;j++)
			{
				if(a[j]%tmp!=0)
					num++;
				if(num>1)
				{
					sign=false;
					break;
				}
			}
			if(sign)
				ans=max(ans,tmp);
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383
#define pb push_back
#define all(s) s.begin(),s.end()


int main (){
    fast;
    
    ll n, m = 1000000007;
    cin>>n;
    ll ten = 1,nine = 1,eight = 1;
    
    for(int i=0;i<n;i++){
        ten = (ten*(ll)10)%m;
        nine = (nine*(ll)9)%m;
        eight = (eight*(ll)8)%m;
    }
    
    ll ans = 0;
    ans = (((ans + (ten%m + eight%m)%m)%m - (nine%m + nine%m)%m)%m + 10*m)%m;
    cout<<ans%m<<endl;


}

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

int main() {
  string S;
  cin >> S;
 
  int N = S.size();
  int ans=0, var=0;
  for (int i=0; i<N; ++i) {
    char b = S.at(i);
    if (b == 'A') {
      ++var;
    } else if (b == 'T') {
      ++var;
    } else if (b == 'C') {
      ++var;
    } else if (b == 'G') {
      ++var;
    } else {
      ans = max(ans, var);
      var = 0;
    }
    ans = max(ans, var);
  }
  cout << ans << endl;
  return 0;
}









Measured memory_bytes: 256