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

using namespace std;

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

struct Node {
	Node* parent = NULL;
	vector<Node*> child;
	long long value = 0;
};
struct Edge {
	int parent = 0;
	int child = 0;
	bool operator <(const Edge& right) const { return parent < right.parent; }
};
struct Tree {
	vector<Node> node;
	Tree(int, vector<Edge>);
};
Tree::Tree(int nodeNum, vector<Edge> edge) {
	node.resize(nodeNum);
	for (Edge& it : edge) {
		node[it.child].parent = &node[it.parent];
		node[it.parent].child.push_back(&node[it.child]);
	}
}

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}
long long gcd(long long num1, long long num2) {
	return num2 == 0 ? num1 : gcd(num2, num1 % num2);
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	long long m_module = 1000000007;
	vector<struct Memo> memo;
public:
	long long calculate(int, int);
	Combination1(int, long long);
};
long long Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, long long module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Therefore(void) {

	int N; cin >> N;

	switch (N % 10) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl; 
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	}
	return;

}

int main(void) {

	cout << fixed << setprecision(15);
	A_Therefore();
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <array>

using namespace std;

array<int, 100001> num;
array<bool, 100001> possible;

int main()
{
  int n, m;
  cin >> n >> m;
  fill(num.begin(), num.end(), 1);
  fill(possible.begin(), possible.end(), false);
  possible[1] = true;

  for(int i = 0; i < m; i++)
  {
	int x, y;
	cin >> x >> y;
	if(possible[x])
	{
	  if(num[x] >= 1)
	  {
		possible[y] = true;
	  }
	  if(num[x] == 1)
	  {
		possible[x] = false;
	  }
	}
	num[x]--;
	num[y]++;
  }
  int count = 0;
  for(int i = 1; i <= n; i++)
  {
	if(possible[i]) count++;
  }
  cout << count << endl;
}


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

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;
  vector<string> A(N);
  rep(i,N)  cin >> A.at(i);

  ll ans=0;
  vector<vector<vector<int>>> tfx(20,vector<vector<int>>(20,vector<int>(10,0)));
  rep(i,N){
    string tmp=A.at(i);
    ll X=0;
    int ten=0;
    bool flag=false;
    rep(j,sz(tmp)){
      if(tmp.at(j)=='.'){
        flag=true;
        continue;
      }
      if(flag)  ten++;
      X*=10;
      X+=int(tmp.at(j)-'0');
    }
    int two=0;
    int five=0;
    while(X%2==0){
      X/=2;
      two++;
    }
    while(X%5==0){
      X/=5;
      five++;
    }
    chmin(two,19);
    chmin(five,19);

    rep(j,20){
      rep(k,20){
        rep(l,10){
          if(two+j<ten+l || five+k<ten+l) continue;
          ans+=tfx.at(j).at(k).at(l);
        }
      }
    }
    tfx.at(two).at(five).at(ten)++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 9440
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
using namespace std;
using ll=long long;
using R=double;

ll nC2(ll n){
	ll res = n*(n-1) / 2;
	return res;
}

int main(){
	string A;
	cin >> A;

	//printf("|A| : %d\n",A.length());

	ll all = nC2(A.length());
	//printf("all : %d\n", all);

	ll alpha[27]={0};

	for(int i = 0; i < A.length(); i++){
		alpha[A[i]-'a']++;
	}

	ll minus=0;
	for(int i = 0; i < 26; i++){
		//printf("%c : %d\n", i+'a', alpha[i]);
		if(alpha[i] >= 2){
			minus += nC2(alpha[i]);
		}
	}

	//printf("minus : %d\n",minus);

	ll result = all - minus + 1;

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
if(a == b && a != c){
    cout << "Yes" << endl;
}else if(a == c && a != b){
    cout << "Yes" << endl;
}else if (b==c && b != a){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}




// cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;

int x[3];
int main()
{
	int flag1 = 0,flag2 = 0;
	for (int i = 0; i < 3; i++)
	{
		scanf("%d", &x[i]);
	}
	for (int i = 0; i < 3; i++)
	{
		if (x[i] == 5)flag1++;
		if (x[i] == 7)flag2++;
	}
	if (flag1 == 2 && flag2 == 1)cout << "YES";
	else cout << "NO";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {   if (y & 1)
        res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int main()
{
	IOS;
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int max=a[0],ans=1;
	for(int i=1;i<n;i++)
	{
		if(a[i]>=max)
		{
			ans++;
			max=a[i];
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
from collections import Counter
 
M = 998244353
n = int(input())
a = map(int, input().split())
x, c, r = next(a), Counter(a), 0
if x == c[0] == 0:
    r = p = i = 1
    while c[i]:
        r = r * pow(p, c[i], M) % M
        p = c[i]; n -= p; i += 1
print((r, 0)[n > 1])


Measured memory_bytes: 22636
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct edge{
	int s,t,nxt;
}e[400005];
int last[200005],e_cnt;
void ins(int a,int b){
	e[e_cnt]=(edge){a,b,last[a]};
	last[a]=e_cnt++;
}
int fa[200005],pre[200005],v[200005],vp[200005];
int dfs2(int x,int L){
	if(x>L)return 0;
	int res=1;
	for(int i=last[x];i!=-1;i=e[i].nxt)if(e[i].t!=fa[x])
		res+=dfs2(e[i].t,L);
	return res;
}
void dfs0(int x){
	for(int i=last[x];i!=-1;i=e[i].nxt)if(e[i].t!=fa[x]){
		if(x>fa[pre[x]])pre[e[i].t]=e[i].t;
		else pre[e[i].t]=pre[x];
		fa[e[i].t]=x;
		dfs0(e[i].t);
	}
	if(pre[x]==x){
		v[x]=1;
		for(int i=last[x];i!=-1;i=e[i].nxt)if(e[i].t!=fa[x])v[x]+=dfs2(e[i].t,fa[x]);
		int t=fa[pre[fa[x]]];
		if(t){
			vp[x]=dfs2(x,t);
		}
	}
}
int r[200005];
void dfs1(int x){
	if(x!=1){
		r[x]=r[fa[x]];
		if(pre[x]==x){
			r[x]+=v[x]-vp[x];
		}else if(x>fa[pre[x]]){
			r[x]++;
			for(int i=last[x];i!=-1;i=e[i].nxt)if(e[i].t!=fa[x])r[x]+=dfs2(e[i].t,fa[pre[x]]);
		}
	}
	for(int i=last[x];i!=-1;i=e[i].nxt)if(e[i].t!=fa[x])dfs1(e[i].t);
}
int main(){
	int n;
	scanf("%d",&n);
	memset(last,-1,sizeof(last));
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		ins(u,v);
		ins(v,u);
	}
	dfs0(1);
	/*
	for(int i=2;i<=n;i++)printf("%d ",pre[i]); puts("");
	for(int i=2;i<=n;i++)printf("%d ",v[i]); puts("");
	for(int i=2;i<=n;i++)printf("%d ",vp[i]); puts("");
	*/
	dfs1(1);
	for(int i=2;i<=n;i++)printf("%d ",r[i]); puts("");
	return 0;
}

Measured memory_bytes: 19072
import java.util.*;

public class Main {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = n;
		int fx = 0;
		while (x > 0) {
			fx += x % 10;
			x /= 10;
		}
		if (n % fx == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23252
H,N=map(int,input().split())
A=[0]*N
B=[0]*N
for i in range(N):
    a,b=map(int,input().split())
    A[i]=a
    B[i]=b
    
inf=10**9
dp=[[inf] * (H+1) for _ in range(N+1)]

for i in range(N+1):
    dp[i][0]=0
    
    
for i in range(N):
    for j in range(H+1):
        if j-A[i]>=0:
            dp[i+1][j]=min(dp[i][j],dp[i+1][j-A[i]]+B[i])
        else:
            dp[i+1][j]=min(dp[i][j],dp[i][0]+B[i])

            
print(dp[-1][-1])

Measured memory_bytes: 120556
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n,q;
    string s;cin >> n >> s >> q;
    vector<set<int>> is(26);
    rep(i,n) is[s[i]-'a'].insert(i);
    rep(qi, q){
        int ty;cin >> ty;
        if(ty == 1){
            int i;char c;
            cin >> i >> c;
            --i;
            is[s[i]-'a'].erase(i);
            s[i] = c;
            is[s[i]-'a'].insert(i);
        }else{
            int l,r;cin >> l >> r;
            --l;
            int ans = 0;
            rep(i,26){
                auto it = is[i].lower_bound(l);
                if(it != is[i].end() && *it < r) ++ans;
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
int main() {
  int x;
  cin >> x;
  int max_ = 0;
  for(int b=1; b<=1000; b++) {
    for(int p=2; p<=1000; p++) {
      int pp = pow(b,p);
      if(pp<=x)
       max_ = max(max_, pp); 
      else
        break;
    }
  }
  cout << max_ << endl;
  return 0;
}


Measured memory_bytes: 256
//ΔARC 095A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 222222;
int a[N],b[N];
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i),b[i]=a[i];
	sort(b+1,b+n+1);
	for(i=1;i<=n;i=i+1){
		if(a[i]<=b[n/2])
			printf("%d\n",b[n/2+1]);
		else
			printf("%d\n",b[n/2]);
	}
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
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(v) v.begin(), v.end()
using ll = long long;
using vi = vector<int>; 
using vvi = vector<vi>;
typedef pair<int,int> P;
string s;
int k;
ll INF = 10000000000000000;
int main(){
    ll N;
    cin >>N;
    ll M,m;
    M = 0;
    m = 0;
    M = N/15;
    m = N%15;
    long long S;
    S = 0;
    S += 60*M+120*M*(M-1)/2;
    vi v={0,1,3,3,7,7,7,14,22,22,22,33,33,46,60};
    vi v2={0,1,2,2,3,3,3,4,5,5,5,6,6,7,8};
    S += 15*M*v2[m]+v[m];
    cout << S << endl; 
}

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

#ifndef LOCAL
#define cerr dolor_sit_amet
#endif

#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int , int > ipair;
typedef pair < ll , ll > lpair;
const int IINF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int DX[] = { 1,  0, -1,  0,  1, -1,  1, -1};
const int DY[] = { 0,  1,  0, -1,  1, -1, -1,  1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll sqr(ll x) { return x*x; } ll sqr(int x) { return (ll)x*x; }
double sqr(double x) { return x*x; } ld sqr(ld x) { return x*x; }
mt19937 mmtw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(mmtw) % (y - x + 1) + x; }

template<typename T> T& updMin(T& a, T const& b) { if (b < a) a = b; return a; }
template<typename T> T& updMax(T& a, T const& b) { if (a < b) a = b; return a; }

// ========================================================================= //

const int N = 100179;

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

    ll a, b, c;
    cin >> a >> b >> c;
    c = min(c, a + b + 1);
    cout << b + c << "\n";

    return 0;
}


Measured memory_bytes: 256
use std::error::Error;
use std::io;
use std::str::FromStr;

fn get_line() -> io::Result<String> {
	let mut buffer = String::new();
	io::stdin().read_line(&mut buffer)?;
	Ok(buffer)
}

#[allow(dead_code)]
fn get_input_number<T>() -> Result<T, Box<dyn Error + 'static>>
where
	T: FromStr,
	<T as FromStr>::Err: Error + 'static,
{
	Ok(get_line()?.trim().parse::<T>()?)
}

#[allow(dead_code)]
fn get_input_array<T>() -> Result<Vec<T>, Box<dyn Error + 'static>>
where
	T: FromStr,
	<T as FromStr>::Err: Error + 'static,
{
	Ok(get_line()?
		.split_whitespace()
		.map(|s| s.parse::<T>())
		.collect::<Result<Vec<_>, _>>()?)
}

fn main() -> Result<(), Box<dyn Error>> {
	let input = get_input_array::<i8>()?;
	let mut takashi_health = input[0];
	let takashi_attacc = input[1];
	let mut aoki_health = input[2];
	let aoki_attacc = input[3];
	loop {
		aoki_health -= takashi_attacc;
		if aoki_health <= 0 {
			println!("{}", "Yes");
			break;
		}
		takashi_health -= aoki_attacc;
		if takashi_health <= 0 {
			println!("{}", "No");
			break;
		}
	}
	Ok(())
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int i=0,j=N-1,count=0;
  string S1,S2;
  bool flag = true;
  cin >> S1;
  for(int i=0;i<N;i++){
    if(S1.at(i) == 'W') S1.at(i) = '0';
    if(S1.at(i) == 'R') S1.at(i) = '1';
  }
  S2 = S1;
  
  for(int i=0;i<N-1;i++){
    if(S1.at(i) != S1.at(i+1)) flag = false;
  }
  if(flag){
    cout << '0' << endl;
    return 0;
  }
  
  while(S1 <= S2){
    
    S1 = S2;
    if(S2.at(i) == '0'&&S2.at(j)=='1'){
      swap(S2.at(i), S2.at(j));
      i++;
      j--;
      if(S1 <= S2) count++;
    }
    else if(S2.at(i) != '0'&&S2.at(j)=='1'){
      i++;
    }
    else if(S2.at(i) == '0'&&S2.at(j)!='1'){
      j--;
    }
    else if(S2.at(i) != '0'&&S2.at(j)!='1'){
      i++;
      j--;
    }
  }
  cout << count << endl;
  return 0;
}

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


void solve(long long N, std::vector<long long> A){
    A.insert(A.begin(), 0);
    A.push_back(0);

    auto total=0l;
    for(int i=1; i<N+2; i++)
        total += abs(A[i]-A[i-1]);

    for(auto i=1l;i<=N; i++){
        auto curr = A[i];
        auto prev = A[i-1];
        auto next = A[i+1];
        cout << total - abs(curr-prev)-abs(next-curr)+abs(next-prev) << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 2032
//che contesti bod!
    #include <bits/stdc++.h>
        
    using namespace std;
        
    int main(){
        int arr[111111];
        int n;
        cin >> n;
        for(int i=0; i<n; i++){
    		cin >> arr[i];
    	}
        int a=0;
        int b=0;
        for(int i=0; i<n; i++){
        	if(arr[i]%4==0){
    			a++;
    		}
        	else if(arr[i]%2==0){
    			b++;
    		}
        	}
        	//cout << a << ' ' << b << endl;
       	if(a>=n/2){
        	cout << "Yes";
        	return 0;
        	}
        if(a*2+b>=n){
    		cout << "Yes";
        	return 0;
        	}
        cout << "No";
        	return 0;
        }

Measured memory_bytes: 640
N, K, Q = map(int, input().split())
A = [0] * N

for _ in range(Q):
    a = int(input()) - 1
    A[a] += 1

s = sum(A)

for a in A:
    if K - (s - a) > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4680
/**
 * @Author:      G_BG
 * @DateTime:    2018-10-06 17:32:37
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
#define MST(a, b) memset(a, b, sizeof(a));
#define CLR(a) MST(a, 0);
#define pb push_back
#define rep(x, y, z) for (int x = y; x < z; ++x)
#define dwn(x, y, z) for (int x = y; x >= z;--x)
#define lowbit(x) (x & (-x))
typedef long long LL;
typedef unsigned long long ULL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn=1e2+10;
struct Node{
    int x,y;
    int f;
}a[maxn*2];
bool cmp(Node a, Node b){
    return a.x < b.x;
}
set<int> dict;
int main(int argc, char const *argv[]) {
    ios::sync_with_stdio(0);cin.tie(0);
    int n;cin >> n;
    rep(i,0,n) cin >> a[i].x >> a[i].y,a[i].f = 1;
    rep(i,0,n) cin >> a[n+i].x >> a[n+i].y,a[n+i].f = 2;
    sort(a,a+2*n,cmp);
    int ans = 0;
    for(int i = 2*n-1;i >= 0;i--){
        if(a[i].f == 2) dict.insert(a[i].y);
        else {
            auto j = lower_bound(dict.begin(),dict.end(),a[i].y);
            if(j != dict.end()) {
                ans++;
                dict.erase(*j);
            }
        }
    }
    cout << ans << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 998244353;

vector<int>e[maxn],w[maxn];
vector<ll> es[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int x,y,z;
    cin>>x>>y>>z;
    e[x].push_back(y);
    w[x].push_back(z);
  }
  unordered_map<ll, int> mp;
  set<ll> st;
  ll cur = 0;
  for(int i=1;i<=n;i++){
    for(ll x:es[i]){
      mp[x]--;
      if(mp[x]==0)st.erase(x);
    }
    if(i>1&&st.size()==0){
      cout<<-1<<endl;
      return 0;
    }
    cur = *st.begin();
    for(int j=0;j<e[i].size();j++){
      ll nxt = w[i][j] + cur;
      int pos = e[i][j]+1;
      es[pos].push_back(nxt);
      if(st.find(nxt)==st.end()){
        st.insert(nxt);
      }
      mp[nxt]++;
    }
  }
  cout<<cur<<endl;
  return 0;
}

Measured memory_bytes: 20516
n = int(input())
A = [int(i) for i in input().split()]

q = int(input())
m = [int(i) for i in input().split()]

def dfs(idx, s, target):
    if s == target:
        return 1
    
    if s > target or idx == n:
        return 0
    if s + sum(A[idx:]) < target:
        return 0

    return dfs(idx+1, s, target) or dfs(idx+1, s + A[idx], target)

for target in m:
    ans = 'yes' if dfs(0, 0, target) else 'no'
    print(ans)
    
    
    



Measured memory_bytes: 5628
x, y = map(str, input().split())
hex_dict = {'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15}
if hex_dict[x] < hex_dict[y]:
    print('<')
elif hex_dict[x] > hex_dict[y]:
    print('>')
else:
    print('=')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, A[201010];
ll dp[201010][2][4][3];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	rep(i, 0, N + 1) rep(top, 0, 2) rep(two, 0, 3) rep(three, 0, 2) dp[i][top][two][three] = -infl;

	dp[0][0][0][0] = 0;

	dp[1][0][0][0] = A[0];
	dp[2][1][0][0] = A[1];
	dp[3][0][1][0] = A[2];

	rep(i, 0, N) rep(top, 0, 2) rep(two, 0, 3) rep(three, 0, 2) if(-infl < dp[i][top][two][three]) {
		chmax(dp[i + 2][top][two][three], dp[i][top][two][three] + A[i + 1]);
		chmax(dp[i + 3][top][two + 1][three], dp[i][top][two][three] + A[i + 2]);
		chmax(dp[i + 4][top][two][three + 1], dp[i][top][two][three] + A[i + 3]);
	}

	ll ans = -infl;
	rep(i, 1, N + 1) rep(top, 0, 2) rep(two, 0, 3) rep(three, 0, 2) if (-infl < dp[i][top][two][three]) {
		int cnt = 0;
		int tot = i;
		if (top == 0) cnt++, tot--;

		rep(t, 0, two) tot--;
		rep(t, 0, three) tot -= 2;

		cnt += tot / 2;

		if (cnt == N / 2) chmax(ans, dp[i][top][two][three]);
	}
	cout << ans << endl;
}







Measured memory_bytes: 41948
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;

#define REP(i, n) for(ll i = 0; i < n; i++)






















int main(){
    string s, t;
    cin >> s >> t;
    ll cnt = 0;
    REP(i, s.size()){
        if(s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
int main(){
  string N;
  long long K;
  cin>>N>>K;
  long long dp[100][1000];
  dp[1][1]=9;
  dp[2][1]=0;
  dp[3][1]=0;
  for(long i=2;i<=(long long)N.size();i++){
    dp[1][i]=9*i;
    dp[2][i]=9*dp[1][i-1]+dp[2][i-1];
    dp[3][i]=9*dp[2][i-1]+dp[3][i-1];
    //cout<<dp[1][i]<<" "<<dp[2][i]<<" "<<dp[3][i]<<" "<<dp[1][i]+dp[2][i]+dp[3][i]<<endl;
  }
  if(K==1){cout<<dp[1][(long long)N.size()-1]+(N.at(0)-'0')<<endl;}
  if(K==2){
    long long ans=dp[1][(long long)N.size()-1]*(N.at(0)-'0'-1)+dp[2][(long long)N.size()-1];
    while((long long)N.size()>=2){
      N=N.substr(1);
      if(N.at(0)!='0'){
        ans+=dp[1][(long long)N.size()-1];
        ans+=N.at(0)-'0';
        break;
      }
    }
    cout<<ans<<endl;
  }
  if(K==3){
    long long ans=dp[3][(long long)N.size()-1]+dp[2][(long long)N.size()-1]*(N.at(0)-'0'-1);
    while((long long)N.size()>=3){
      N=N.substr(1);
      if(N.at(0)!='0'){
        ans+=dp[2][(long long)N.size()-1];
        ans+=dp[1][(long long)N.size()-1]*(N.at(0)-'0'-1);
        while((long long)N.size()>=2){
          N=N.substr(1);
          if(N.at(0)!='0'){
            ans+=dp[1][(long long)N.size()-1];
            ans+=N.at(0)-'0';
            if(ans!=0){
              cout<<ans<<endl;
              return 0;
            }
          }
          cout<<ans<<endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 3664
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 110
using namespace std;
int n,m,a[N],b[N],bl;
int main()
{
	scanf("%d%d",&n,&m);
	int t=0;
	for(int i=1;i<=m;i++) 
	{
		scanf("%d",&a[i]);
		if(a[i]%2) t++;
	}
	if(m==1)
	{
		if(a[1]>1) b[++bl]=a[1]-1;
		b[++bl]=1;
		printf("%d\n%d\n",a[1],bl);
		for(int i=1;i<=bl;i++) printf("%d ",b[i]);
		return 0;
	}
	if(t>2) {printf("Impossible\n");return 0;}
	for(int i=1;i<=m;i++) if(a[i]%2) {swap(a[i],a[1]);break;}
	for(int i=2;i<=m;i++) if(a[i]%2) {swap(a[i],a[m]);break;}
	if(a[1]>1) b[++bl]=a[1]-1;
	for(int i=2;i<m;i++) b[++bl]=a[i];
	b[++bl]=a[m]+1;
	for(int i=1;i<=m;i++) printf("%d ",a[i]);printf("\n");
	printf("%d\n",bl);
	for(int i=1;i<=bl;i++) printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="SUN") cout<<7;
  else if(s=="MON") cout<<6;
  else if(s=="TUE") cout<<5;
  else if(s=="WED") cout<<4;
  else if(s=="THU") cout<<3;
  else if(s=="FRI") cout<<2;
  else cout<<1;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int H, W;
char maze[1100][1100];
int d[1100][1100];

int main () {
  cin >> H >> W;
  queue<P> que;
  Rep(i, H) {
    Rep(j, W) {
      cin >> maze[i][j];
      if (maze[i][j] == '#') que.emplace(i, j);
    }
  }

  int ans = 0;

  while (!que.empty()) {
    int n = que.size();

    queue<P> new_que;
    Rep(i, n) {
      P p = que.front(); que.pop();
      Rep(k, 4) {
        int new_y = p.first + dy[k];
        int new_x = p.second + dx[k];

        if (new_y >= 0 & new_y < H & new_x >= 0 & new_x < W) {
          if (maze[new_y][new_x] == '.') {
            new_que.emplace(new_y, new_x);
            //cout << new_y << new_x << "\n";
            maze[new_y][new_x] = '#';
          }
        }
      }
    }
    que = new_que;

    ++ans;
    //cout << ans << "\n";
  }

  cout << ans -1<< "\n";
}

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

namespace A
{

    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineInt();
            Console.WriteLine((n*2)*Math.PI);
            ReadLine();
        }

        //最大公約数
        static int gcd(int a, int b)
        {
            if (a > b) {
                return gcd(b, a);
            }

            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }

            return a;
        }

        //最小公倍数
        static int lcm(int a, int b) => a * b / gcd(a, b);

        /// <summary>
        /// コンビネーション
        /// </summary>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        public static string ReadLine() => Console.ReadLine();
        public static int ReadLineInt() => int.Parse(Console.ReadLine());
        public static string[] ReadLineStringSplit(char a = ' ') => ReadLine().Split(a).ToArray();
        public static int[] ReadLineIntSpilit(char a = ' ') => ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        public static long[] ReadLineLongSpilit(char a = ' ') => ReadLine().Split(a).Select(x => long.Parse(x)).ToArray();
        static string[] GetAplhaLowerArray() => new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

Measured memory_bytes: 18656
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X))
#define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X))
#define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1,0};

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	int n;
	cin>>n;
	vector<int> ps(n*n);
	for(auto &x:ps) cin>>x, --x;
	vv<int> ord(n,vector<int>(n));
	rep(i,n*n) ord[ps[i]/n][ps[i]%n]=i;
	// rep(i,n){rep(j,n) cout<<ord[i][j]<<",\t"; cout NL;}
	vv<int> dst(n,vector<int>(n,MOD));
	deque<pii> que;
	auto bfs=
		[&](int t){
			while(que.size()){
				auto [x,y]=que.front(); que.pop_front();
				rep(d,4){
					int nx=x+dx[d];
					int ny=y+dy[d];
					if(nx<0 || ny<0 || nx>=n || ny>=n) continue;
					if(MN(dst[ny][nx],dst[y][x]+(ord[ny][nx]>=t))){
						if(ord[ny][nx]>=t){
							que.emplace_back(nx,ny);
						}else{
							que.emplace_front(nx,ny);
						}
					}
				}
			}
		};
	rep(i,n){
		que.emplace_back(0,i); dst[i][0]=1;
		que.emplace_back(n-1,i); dst[i][n-1]=1;
		que.emplace_back(i,0); dst[0][i]=1;
		que.emplace_back(i,n-1); dst[n-1][i]=1;
	}
	bfs(-1);
	ll re=0;
	rep(i,n*n){
		int x=ps[i]%n;
		int y=ps[i]/n;
		--dst[y][x];
		re+=dst[y][x];
		que.eb(x,y);
		bfs(i+1);
	}
	cout<<re NL;
  return 0;
}


Measured memory_bytes: 7292
#include<bits/stdc++.h>
using namespace std;
const int N = 505;
const int inf = 0x3f3f3f3f;

int n, m;
char s[N][N], b[N][N], r[N][N];

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		scanf("%s", s[i] + 1);
		for (int j = 1; j <= m; ++j)
			b[i][j] = r[i][j] = s[i][j];
	}
	for (int i = 1; i <= n; ++i) {
		b[i][1] = '#';
		r[i][m] = '#';
		for (int j = 2; j < m; ++j) {
			if (i & 1) b[i][j] = '#';
			else r[i][j] = '#';
		}
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			putchar(b[i][j]);
		putchar('\n');
	}
	putchar('\n');
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			putchar(r[i][j]);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int main()
{
    int n;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    ll ans=a[n-1],ans2=0;
    for(int i=0;i<n-1;i++)
    {
        if(min(a[i],a[n-1]-a[i])>min(ans2,a[n-1]-ans2))
            ans2=a[i];
    }
    cout<<ans<<" "<<ans2<<'\n';
}

Measured memory_bytes: 640
#include <stdio.h>
#include<stdlib.h>

int main(void)
{
	int i,c,d,total=0;
	char s[11],a[12];
	scanf("%s",s);
	scanf("%s",a);
	c=strlen(s);
	d=strlen(a);
	if(d-c!=1)total++;
	for(i=0;i<c;i++){
		if(s[i]!=a[i])total++;
	}
	if(total==0)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    pair<int, int> p[n];
    for(int i = 0; i < n; i++) p[i] = pair<int, int> (a[i], b[i]);
    sort(p, p+n);
    long long ans = 0;
    //int count = 0;
    for(int i = 0; i < n; i++) {
       int buy = min(m, p[i].second);
       ans += (long long)buy * p[i].first;
       m -= buy;
    }
    cout << ans;
}


Measured memory_bytes: 1792
#include<iostream>
 
using namespace std;
 
int main(){
    int N, j, key;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++) cin >> A[i];
 
    for(int i=0;i<N;i++){
        key=A[i];
	j=i-1;
        while(j>=0&&A[j]>key){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=key;
        for(int k=0;k<N;k++){
        if(k>0) cout << " ";
        cout << A[k];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3092
let cnt = ref 0
let g = ref []

let print_list l =
  List.iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) l;
  print_newline ()

let print_array = Array.iter (fun n -> Printf.printf "%d\n" n)

let insertion_sort a n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j + g) <- v
    else (a.(j + g) <- a.(j); incr cnt; insert (j - g) v)
  in
  let rec doit i =
    if i >= n then ()
    else (insert (i - g) a.(i); doit (i + 1))
  in
  doit g

let generate_g n =
  let rec doit i g lst =
    if g > n then lst
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: lst)
  in
  doit 1 1 []

let shell_sort a n =
  cnt := 0;
  g := generate_g n;
  let rec doit = function
    | [] -> ()
    | hd :: tl -> (insertion_sort a n hd; doit tl)
  in
  doit !g

let () =
  let n = read_int () in
  let a = Array.make n 0 in
  let rec doit i =
    if i >= n then ()
    else (a.(i) <- read_int (); doit (i + 1))
  in
  doit 0;
  shell_sort a n;
  Printf.printf "%d\n" (List.length !g);
  print_list !g;
  Printf.printf "%d\n" !cnt;
  print_array a

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

int main() {
  int cnt=0;  
  vector<string> vec(4);
  for (int i = 0; i < 3; i++) {
    cin >> vec.at(i);
  }
  vec.at(3) = vec.at(0);

  for (int i = 0; i < 3; i++) {
    if (vec.at(i) != vec.at(i + 1)) {
      cnt++;
    }
  }
  if (cnt == 0) {
    cout << 1 << endl;
  }
  else {
    cout << cnt << endl;
  }
}

Measured memory_bytes: 256
import numpy as np
 
N = int(input())
*A, = map(int, input().split())

A.sort()
A = A[::-1]

log = []

a = A[0] #max
b = A[-1] #min
for i in range(1,N-1):
  if (A[i] < 0):
    log.append((a,A[i]))
    a -= A[i]
  else:
    log.append((b,A[i]))
    b -= A[i]
log.append((a,b))
print(a-b)
for l in log:
  print(l[0], l[1])


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll ans = 0;
    ll N, K; cin >> N >> K;
    if(K == 0){
        cout << N*N << endl;
        return 0;
    }
    for(ll b = K+1; b <= N; b++){
        //a % b >= K
        //a = K, K+b, ...
        //K + mb <= Nなるm>=0の個数
        //m <= (N-K)/b
        //あまりはK,...,b-1まであり得る -> (b-1) - K + 1個
        //N % b < Kならはみ出てない
        ll nums = (b-1)-K + 1;
        ll over = 0;
        if(N % b >= K) over = nums - (N%b - K + 1);
        ans += nums*((N-K)/b+1)-over;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int N,M;
    cin >> N >> M;
    char A[N][N],B[M][M];
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];
    bool ans=false;
    for(int i=0;i<N-M+1;i++) for(int j=0;j<N-M+1;j++){
        bool check=true;
        rep(k,M) rep(l,M) if(B[k][l]!=A[i+k][j+l]) check=false;
        if(check) ans=true;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	
	while (scanf("%d", &n) != EOF){
		n %= 39;
		if (n == 0){
			n = 39;
		}
		printf("3C");
		if (n < 10){
			printf("0");
		}
		printf("%d\n", n);
	}
	
	return (0);
}

Measured memory_bytes: 600
/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    if(n%1000==0)
    {
        cout<<0<<endl;
        return 0;
    }
    int k=n/1000;
    cout<<1000*(k+1)-n<<endl;
}

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

int main()
{
   ll int n;
   cin>>n;
   ll int a[n];
   for(ll int i=0;i<n;i++)
    cin>>a[i];
  ll int dp[n]={0};
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  if(n>2)
  dp[2]=min(abs(a[2]-a[0]),dp[1]+abs(a[2]-a[1]));
  for(int i=3;i<n;i++)
  {
dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));}
cout<<dp[n-1]<<endl;

}

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

using namespace std;

string s;

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

    int k;
    cin >> k >> s;

    if(k >= s.size())
        cout << s;
    else
    {
        for(int i = 0; i < k; i++)
            cout << s[i];

        cout <<"...";
    }
    return 0;
}


Measured memory_bytes: 3652
X,N=map(int,input().split())
P=list(map(int,input().split()))

i=0
p=X+1
q=X-1
while True:
    if N==0:
        print(int(X))
        break
    if X not in P:
        print(int(X))
        break
    if q not in  P:
        print(int(q))
        break
    if p not in P:
        print(int(p))
        break
    i+=1
    p+=1
    q-=1

Measured memory_bytes: 9192
#include<stdio.h>
int main(void)
{
    int a,b,c,x,y,z;
	scanf("%d %d %d",&a,&b,&c);
	x=a+b;
	y=a+c;
	z=b+c;
	if(x==c || y==b || z==a){
	    printf("Yes\n");
	}
	else{
	    printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>

int main() {
  //freopen("input.txt", "r", stdin);
  char c[3];
  memset(c, 0, sizeof(c));
  while (~scanf("%s", c)) {
    printf("%c\n", c[0] + 1);
    memset(c, 0, sizeof(c));
  }
  return 0;
}


Measured memory_bytes: 128
require "set"
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)

hash = {}
max = 0
set = Set.new
a_arr.each do |a|
  hash[a] ||= 0
  hash[a] += 1
  max = a if a > max
  set << a
end

hash.each do |k, v|
  i = v > 1 ? 1 : 2
  tmp = k * i
  while tmp <= max do
    set.delete(tmp)
    i += 1
    tmp = k * i
  end
end

puts set.size

Measured memory_bytes: 44160
#include <iostream>
#include <string.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	char a[3];
 	int b=700;
 	cin >> a;
 	for (int i = 0; i < 3; i++) {
 		if(a[i]=='o')
 		b=b+100;
 	}
 	cout << b << endl;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>
#define MAX_H 50
#define MAX_W 50
char field[MAX_H + 2][MAX_W + 2];
int main(void){

  for(int i = 0 ; i < MAX_H + 2 ; i++)
    for(int j = 0 ; j < MAX_W + 2 ; j++)  field[i][j] = '.';

  int H, W; cin >> W >> H;
  for(int i = 1 ; i <= H ; i++)
    for(int j = 1 ; j <= W ; j++) cin >> field[i][j];

  bool ans = true;
  for(int i = 1 ; i <= H ; i++)
    for(int j = 1 ; j <= W ; j++)
     if(field[i][j] == '#' && field[i + 1][j] == '.' && field[i - 1][j] == '.' && field[i][j + 1] == '.' && field[i][j - 1] == '.')
       ans = false;

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

  return 0;
}


Measured memory_bytes: 256