akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    // failed to analyze input format
    // TODO: edit here
    int h,m,H,M,k;
    cin >> h >> m >> H >> M >> k;
    
    ans = (H-h)*60 + (M-m) -k;
    cout << ans << endl;


    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/nomura2020/nomura2020_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/nomura2020/nomura2020_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/nomura2020/nomura2020_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3652
import java.util.*;
import java.io.*;

// Template for atcoder
public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};

    void solve() throws IOException {
        char[] a = nextString().toCharArray();
        char[] b = nextString().toCharArray();
        int res = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] != b[i]) {
                res++;
            }
        }
        outln(res);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


Measured memory_bytes: 37604
<?php

$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));

if($s === $t){
    echo "0";
    exit;
}

$count = strlen($s);
$ans = 0;


for($i=0; $i<$count; $i++){
    if($s[$i] != $t[$i]){
        $ans++;
    }
}
echo $ans;

Measured memory_bytes: 16664
import sys
import itertools
input = sys.stdin.readline

N = int(input())
D = list(map(int, input().split()))
mod = 998244353

if D[0] != 0:
    print(0)
    exit()

D.sort()
if D[1] == 0:
    print(0)
    exit()

gr = itertools.groupby(D[1:])
rank = 1
pre = 1
ans = 1
for key, group in gr:
    if rank != key:
        print(0)
        exit()
    cand = len(list(group))
    ans *= pre ** cand
    ans %= mod
    pre = cand
    rank += 1

print(ans)

Measured memory_bytes: 53028
# def solve(i,W,weight,value):
#     if i <0:
#         return 0
#     if weight[i]<=W:
#         return max(value[i]+solve(i-1,W-weight[i],weight,value),solve(i-1,W,weight,value))
#     else:
#         return solve(i-1,W,weight,value)



N,W=map(int,input().split())
weight=[]
value=[]
for i in range(N):
    n,m=map(int,input().split())
    weight.append(n)
    value.append(m)
# print(solve(N-1,W,weight,value))
dp=[[0]*(W+1) for i in range(N+1)]
for i in range(1,N+1):
    for j in range(1,W+1):
        if weight[i-1]<=j:
            dp[i][j]=max(dp[i-1][j-weight[i-1]]+value[i-1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
    # print(dp[i])
print(dp[-1][-1])


Measured memory_bytes: 147064
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int ans = 0;
		while(S.indexOf("ABC") != -1){
			ans++;
			S = S.substring(S.indexOf("ABC") + 3);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(string, C1, C2);
  rep(i, 0, 3) {
    if (C1[i] != C2[2 - i]) {
      print("NO");
      return;
    }
  }
  print("YES");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

ll n;
ll now;
vector<vector<bool> > g;
vector<bool> used;
vl startTime,endTime;
void dfs(ll idx){
    used[idx]=1;
    startTime[idx]=++now;
    rep(i,n){
        if(g[idx][i]&&!used[i])dfs(i);
    }
    endTime[idx]=++now;
}
void solve(){
    cin>>n;
    g=vector<vector<bool> >(n,vector<bool>(n));
    used=vector<bool>(n);
    startTime=vl(n);
    endTime=vl(n);
    rep(i,n){
        ll idx,m;cin>>idx>>m;
        idx--;
        rep(k,m){
            ll to;cin>>to;to--;
            g[idx][to]=true;
        }
    }
    rep(i,n){
        if(!used[i])dfs(i);
    }
    rep(i,n){
        cout<<(i+1)<<" "<<startTime[i]<<" "<<endTime[i]<<endl;
    }
}

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



Measured memory_bytes: 3180
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;

final class Main {

    public static final int MAX_RESULT = 4000;
    public static final int SALE_BORDER = 1000000;

    private Main() {
    }

    public static void main(final String[] argv) throws IOException {
        final BufferedReader inputReader =
                new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String input = inputReader.readLine();
            if (input == null || input.equals("0")) {
                break;
            }
            int count = Integer.parseInt(input);
            HashMap<String, BigInteger> sales =
                    new HashMap<String, BigInteger>();
            ArrayList<String> result = new ArrayList<String>();
            while (count-- > 0) {
                input = inputReader.readLine();
                String[] data = input.split(" ");
                if (!sales.containsKey(data[0])) {
                    sales.put(data[0], BigInteger.ZERO);
                    result.add(data[0]);
                }
                final long sale = Long.parseLong(data[1])
                        * Long.parseLong(data[2]);
                sales.put(data[0],
                        sales.get(data[0]).add(BigInteger.valueOf(sale)));
            }
            for (Entry<String, BigInteger> entry : sales.entrySet()) {
                if (entry.getValue().compareTo(BigInteger.valueOf(SALE_BORDER))
                        < 0) {
                    result.remove(entry.getKey());
                }
            }
            if (result.isEmpty()) {
                System.out.println("NA");
            } else {
                for (String string : result) {
                    System.out.println(string);
                }
            }
        }
    }
}

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

int main() {
    ll a,b,c,d;
    std::cin >> a>>b>>c>>d;
    ll ma = max({
        a*c,a*d,b*c,b*d
    });
    if(a<=0 && 0<=b){
        ma = max(0ll,ma);
    }
    if(c<=0 && 0<=d){
        ma = max(0ll,ma);
    }
    std::cout << ma << std::endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
using namespace std;
constexpr int mod = 1'000'000'007;
static int dp[100'010][2];
// Let X = A + B
// dp[i][0] --> first i digits, L = X
// dp[i][1] --> first i digits, L > X
// don't care --> first i digits, L < X
int main() {
    string l;
    cin >> l;
    const int n = (int)l.length();

    // L_0 == '1'
    dp[0][0] = 1;
    dp[0][1] = 0;

    for (int i = 0; i < n; i++) {
        auto cnt_eq = 0LL;
        auto cnt_lt = 0LL;

        if (l[i] == '0') { // AND X[i] == '0'
            cnt_eq += dp[i][0];
            cnt_lt += dp[i][1];
        }
        if (l[i] == '0') { // AND X[i] == '1'
            // case 1: A[i]=0, B[i]=1
            cnt_eq += 0;
            cnt_lt += dp[i][1];
            // case 2: A[i]=1, B[i]=0
            cnt_eq += 0;
            cnt_lt += dp[i][1];
        }
        if (l[i] == '1') { // AND X[i] == '0'
            cnt_eq += 0;
            cnt_lt += dp[i][0] + dp[i][1];
        }
        if (l[i] == '1') { // AND X[i] == '1'
            // A[i]=0, B[i]=1
            cnt_eq += dp[i][0];
            cnt_lt += dp[i][1];
            // A[i]=1, B[i]=0
            cnt_eq += dp[i][0];
            cnt_lt += dp[i][1];
        }

        dp[i + 1][0] = cnt_eq % mod;
        dp[i + 1][1] = cnt_lt % mod;
    }

    cout << ((dp[n][0] + dp[n][1]) % mod);
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
typedef pair<ll, ll> P;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    int p;
    pair<pair<string, int>, int> m[110];
    for (int i = 0; i < n; i++) {
        cin >> s >> p;
        m[i] = make_pair(make_pair(s, -p), i);
    }
    sort(m, m + n);
    for (int i = 0; i < n; i++) {
        cout << m[i].second + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int H,N;
int a[1005],b[1005];
int f[1005][20005];
int main()
{
	scanf("%d%d",&H,&N);
	for(int i=1;i<=N;++i) 
	    scanf("%d%d",&a[i],&b[i]);
	for(int i=0;i<=N;++i)
	   for(int j=0;j<=20005;++j)
	       f[i][j]=1e9;
	f[0][0]=0;
	int INF=1e9;
	for(int i=1;i<=N;++i)
	{
		for(int j=0;j<=20000;++j)
		   f[i][j] = min (j>=a[i] ? f[i][j-a[i]]+b[i] : INF, f[i-1][j] ); 
	}
	int ans=1e9;
	for(int i=H;i<=20000;++i)
		ans=min(ans,f[N][i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 81828
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    deque<int> dq;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if((i+n)%2==1) dq.push_front(a);
        else dq.push_back(a);
    }

    for(auto x : dq) cout << x << " ";
    cout << endl;

    return 0;
}

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

int main(){
  
  long int N;
  cin >> N;
  long int K;
  cin >> K;

  vector <int> h(N);
  for (int i=0; i<N; i++) {
    cin >> h[i];
  }

  long int cnt = 0;

////

  for (int i=0; i<N; i++) {
    if ( h[i] >= K) {
      cnt++;
    }
  }
  
  cout << cnt << endl;

  return 0;

}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <map>

using ll = long long;

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

int main() {
    int N;
    std::cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 0)continue;
        auto div = enum_div(i);
        if (div.size() == 8) {
            ans++;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

        int N=gi();
        double[] A=new double[N];
        double s=0;
        for (int i=0;i<N;i++) {
        	A[i]=gd();
        	s+=A[i];
        }
        double m=s/N;
        
        double mk=Double.MAX_VALUE;
        int min=0;
        for (int i=0;i<N;i++) {
        	double k=Math.abs(m-A[i]);
        	if(k<mk) {
        		mk=k;
        		min=i;
        	}
        }
        System.out.print(min);

//        if (s>L[n-2]) {
//        	System.out.println("Yes");
//        }else {
//        	System.out.println("No");
//        }
	}


	public static long uclid(long m, long n) {
    	if (m<n) {
			m^=n;
			n^=m;
			m^=n;
		}

		while(true) {
			long t=m%n;
			if (t==0) {
				return n;
			} else {
				m=n;
				n=t;
			}
		}
    }

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

int main() {
  int x, n;
  cin >> x >> n;

  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }

  sort(p.begin(), p.end());

  int diff = 0;
  int answer;
  while (true) {
    int value = x - diff;

    bool exist = false;
    for (int pi : p) {
      if (value == pi) {
        exist = true;
        break;
      } else if (value < pi) {
        break;
      }
    }

    if (!exist) {
      answer = value;
      break;
    }

    value = x + diff;
    exist = false;
    for (int pi : p) {
      if (value == pi) {
        exist = true;
        break;
      } else if (value < pi) {
        break;
      }
    }
    if (!exist) {
      answer = value;
      break;
    }

    diff++;
  }
  cout << answer << endl;
}


Measured memory_bytes: 3652
q=int(input())
from heapq import heappush,heappop,heapify
l=[]
r=[]
sl=0
sr=0
sb=0
for i in range(q):
    Q=input().split()
    if len(Q)==1:
        x=-l[0]
        print(x,x*len(l)-sl+sr-len(r)*x+sb)
        continue
    a,b=int(Q[1]),int(Q[2])
    sb+=b
    if len(l)>len(r):
        heappush(r,a)
        sr+=a
    else:
        heappush(l,-a)
        sl+=a
    try:
        if r[0]<-l[0]:
            x,y=heappop(r),-heappop(l)
            heappush(r,y)
            sr+=y-x
            heappush(l,-x)
            sl+=x-y
    except:
        pass

Measured memory_bytes: 92760
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For(i, 0, n)
#define rrep(i, n) rFor(i, n, 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    string s;
    cin >> s;
    if(s == "RRR") printf("%d\n", 3);
    else if(s == "RRS" || s == "SRR") printf("%d\n", 2);
    else if(s == "SSS") printf("%d\n", 0);
    else printf("%d\n", 1);
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
const int P = 1000000007;
#define LL long long
LL fpow(LL x,LL y) {
	LL a = 1;
	for(;y;y>>=1,x=x*x%P)if(y&1)a=a*x%P;
	return a;
}
long long N;
int main() {
    scanf("%lld",&N);
    cout<<((fpow(10LL,N)-2*fpow(9LL,N)+fpow(8LL,N))%P+P)%P;
    return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int a[n];
    rep(i, n){
        cin >> a[i];
    }

    int cri = a[0];
    int ans = 0;
    int cnt = 0;
    rep(i, n){

        if (cri == a[i]){
            ++cnt;
        }
        else{
            cri = a[i];
            ans += cnt/2;
            cnt = 1;

        }

    }
    ans += cnt/2;
    ppp(ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	
	long long result = a - b;
	if (k % 2) {
		result = result * -1;
	}
	
	if (result < 1000000000000000000) {
		cout << result << endl;
	} else {
		cout << "Unfair" << endl;
	}
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/arc103/tasks/arc103_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn doit(a: &Vec<i32>) -> Vec<(i32, usize)> {
    let n = a.len();
    let mut d = a.clone().into_iter().zip(0..n).collect::<Vec<_>>();
    d.sort_by_key(|&(v,idx)| (-v,idx));

    let mut ret = vec![d[0], d[1], d[2]];
    ret
}

fn main() {
    input! {
        n: usize,
        v: [usize; n]
    };

    let mut deg = dvec!(0; 2, 100010);
    for i in 0..n {
        deg[i%2][v[i]] += 1;
    }

    let mut best = n as i32;
    let even = doit(&deg[0]);
    let odd = doit(&deg[1]);
    for (ecnt,ev) in even {
        for (ocnt,ov) in odd.clone() {
            if ev == ov {
                continue;
            }
            // debug!(ev,ecnt,ov,ocnt);
            best = min(best, (n as i32)-ecnt-ocnt);
        }
    }
    println!("{}", best);
}


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

int main() {
  int n;
  cin>>n;
  for (int i=1; i<=9; i++) {
    for (int j=1; j<=9; j++) {
      if (i*j==n) {
        cout<<"Yes"<<endl;
      	return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}



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

using namespace std;
const int maxn = 5;


int main() {
    int S;
    cin>>S;
    int a =  S/100;
    int b =S%100;
    if (a<=12||b<=12){
        if ((a<=12) && (b<=12)&&a&&b){
            cout<<"AMBIGUOUS";
        } else if(a<=12&&a){
            cout<<"MMYY";
        } else if(b<=12&&b){
            cout<<"YYMM";
        } else{
            cout<<"NA";
        }
    } else{
        cout<<"NA";
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#define SIZE 2000000

int main() {
  int A[SIZE];
  int H=0;
  int i, l, largest, tmp, n;
  char com[21], buf[20];
  buf[19]='\0';
  char *p,*c1,*c2;
  c1 = com+1;
  c2 = com+2;
  do {
    fgets(com, 20, stdin);
    if (*com == 'i') {
      n = 0;
      p = com+7;
      while (*p!='\n') {
        n = n*10+*p-'0';
        p++;
      }
      A[++H] = n;
      for (i=H; i>1 && A[i/2]<A[i];i>>=1) {
        tmp = A[i/2];
        A[i/2] = A[i];
        A[i] = tmp;
      }

    } else if (*c1=='x') { // extract
      n = A[1];
      for (i=18; n>0; n/=10) buf[i--]=(n%10)+'0';
      puts(buf+i+1);
      A[1] = A[H];
      i = 1;
      while (1) {
        l = i<<1;
        largest = i;
        if (l < H && A[l] > A[i])        largest = l;
        if (l+1 < H && A[l+1] > A[largest])  largest = l+1;
        if (largest == i) break;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        i = largest;
      }
      H--;
    }
  } while (*c2!='d');
  return 0;
}


Measured memory_bytes: 5460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n,k;
    cin >> n >> k;
    vint p(n);
    REP(i,n) cin >> p[i];
    sort(ALL(p));
    int ans = 0;
    REP(i,k) ans += p[i];
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 3624
A, B = map(int, input().split())

ans = [['#'] * 100 for _ in range(50)] + [['.'] * 100 for _ in range(50)]
A -= 1
B -= 1

for h in range(0, 100, 2):
    if A == 0:
        break
    for w in range(0, 100, 2):
        ans[h][w] = '.'
        A -= 1
        if A == 0:
            break

for h in range(0, 100, 2)[::-1]:
    if B == 0:
        break
    for w in range(0, 100, 2):
        ans[h][w] = '#'
        B -= 1
        if B == 0:
            break

print(100, 100)
for a in ans:
    print(''.join(a))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

const ll MOD = 1000000007LL;

int main(void) {
  ll N, W;
  cin >> N >> W;
  vector<ll> weight(N);
  REP(i, 0, N) cin >> weight[i];

  sort(weight.begin(), weight.end(), greater<ll>());

  ll dp[2][N + 1][W + 1];
  REP(i, 0, 2) REP(j, 0, N + 1) REP(k, 0, W + 1) dp[i][j][k] = 0;
  dp[0][N][0] = 1;

  REP(t, 0, N) {
    ll cur = t % 2, nxt = (t + 1) % 2;
    REP(i, 0, N + 1) REP(j, 0, W + 1) dp[nxt][i][j] = 0;

    REP(n, 0, N + 1) REP(w, 0, W + 1) {
      (dp[nxt][t][w] += dp[cur][n][w]) %= MOD;
      if(w + weight[t] <= W) {
        (dp[nxt][n][w + weight[t]] += dp[cur][n][w]) %= MOD;
      }
    }

    // REP(n, 0, N + 1) {
    //   REP(w, 0, W + 1) cout << dp[nxt][n][w] << " ";
    //   cout << endl;
    // }
    // cout << endl;
  }

  ll ans = 0;
  REP(n, 0, N + 1) REP(w, 0, W + 1) {
    if(n == N || w + weight[n] > W) (ans += dp[N % 2][n][w]) %= MOD;
  }
  cout << ans << endl;
}



Measured memory_bytes: 34488
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int x;
    cin >> x;
    yn(x == 7 || x == 5 || x == 3);

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
flg=0
for i in range(n-1,0,-1):
  if h[i]-h[i-1]==-1:
    h[i-1]-=1
  elif h[i]-h[i-1]<-1:
    print('No')
    flg=1
    break
if flg==0:
  print('Yes')

Measured memory_bytes: 15020
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());
            var dArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToList();

            long result = 0;
            for(int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    result += dArray[i] * dArray[j];
                }
            }

            Console.WriteLine(result);
        }
    }
}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

struct UnionFind{
	vector<int> par,rank;
	UnionFind(int n) :par(n + 1),rank(n + 1,1){
		for(int i = 1;i <= n;i++) par [i] = i;
	}
	int find(int x){
		return par [x] == x ? x : par [x] = find(par [x]);
	}
	bool unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x == y) return false;
		if(rank [x] < rank [y]) swap(x,y);
		rank [x] += rank [x] == rank [y];
		par [y] = x;
		return true;
	}
	bool same(int x,int y){
		return find(x) == find(y);
	}
};

int N,M;
int X [10000],Y [10000];
struct E{
	int from,to,len;
	bool operator<(const E& other){
		return len > other.len;
	}
};

int distance(int a,int b)
{
	return (X [a] - X [b]) * (X [a] - X [b]) + (Y [a] - Y [b]) * (Y [a] - Y [b]);
}

int main()
{
	scanf("%d%d",&N,&M);
	FOR(i,0,N){
		scanf("%d%d",&X [i],&Y [i]);
	}
	vector<E> edge;
	FOR(i,0,M){
		int u,v;
		scanf("%d%d",&u,&v);
		u--; v--;
		edge.push_back(E{u,v,distance(u,v)});
	}
	sort(edge.begin(),edge.end());

	double ans = 0.0;
	UnionFind uf(N);
	FOR(i,0,M){
		if(uf.same(edge [i].from,edge [i].to)){
			ans += sqrt(edge [i].len);
			continue;
		}
		uf.unite(edge [i].from,edge [i].to);
	}
	printf("%.10f\n",ans);

	return 0;
}

Measured memory_bytes: 3516
#include <iostream>

int main()
{
    long long h, w;
    std::cin >> h >> w;

    if (h == 1 || w == 1)
    {
        std::cout << 1;
        return 0;
    }

    long long row1, row2;
    if (w % 2 == 0)
        row1 = row2 = w / 2;
    else row1 = w / 2 + 1, row2 = w / 2;

    long long result = 0;
    if (h % 2 == 0)
        result += (h / 2) * (row1 + row2);
    else result += (h / 2) * (row1 + row2) + row1;

    std::cout << result;

    return 0;
}

Measured memory_bytes: 256
/**
*    created: 04.07.2020 21:32:04
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int x, a, b;
    cin >> x >> a >> b;
    int da = abs(a-x);
    int db = abs(b-x);
    if (da < db) cout << 'A' << endl;
    else cout << 'B' << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int ans=0;
    for (int i=1;i<=n;i++) {
        string sn=to_string(i);
        if (sn.size()%2!=0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011

int n, i, x, v;
int cnt[maxN];

int main()
{
   // freopen("test.in","r",stdin);

    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> x;
        if (x != 0) cnt[x - 1]++;
        cnt[x]++;
        cnt[x + 1]++;
    }

    for (i = 1; i <= 100001; i++)
        if (cnt[i] > cnt[v])
            v = i;

    cout << cnt[v];



    return 0;
}


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

const int64_t mod=1e9+7;

int main() {
  int N,M,i,x;
  cin >> N >> M;
  set<int> a;
  for(i=0; i<M; i++) {
    cin >> x;
    a.insert(x);
  }
  
  vector<int64_t> dp(N+1);
  dp.at(0)=1;
  
  for(i=1; i<=N; i++)
    if(!a.count(i)) {
      dp.at(i) += dp.at(i-1);
      if(i!=1)
        dp.at(i) += dp.at(i-2);
      if(dp.at(i) == 0) {
        cout << 0 << endl;
        return 0;
      }
      dp.at(i) %= mod;
    } else
      dp.at(i) = 0;
  
  cout << dp[N] << endl;
}

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

#define MOD (1000000007)

int main(void) {
    char s[100001];
    scanf("%s", &s);
    int len = strlen(s);
    unsigned long long dp[len][13];
    if (s[len-1] == '?') {
        for (int i = 0; i < 13; i++) {
            dp[len-1][i] = i < 10;
        }
    } else {
        for (int i = 0; i < 13; i++) {
            dp[len-1][i] = i == (s[len-1] - '0');
        }
    }

    for (int i = len - 2, digit = 10; i >= 0; i--, digit = (digit * 10) % 13) {
        for (int j = 0; j < 13; j++) {
            dp[i][j] = 0;
        }
        if (s[i] == '?') {
            for (int m = 0; m<10; m++) {
                for (int j = 0; j<13; j++) {
                    int sh = (j + m * digit) % 13;
                    dp[i][sh] += dp[i+1][j];
                }
            }
        } else {
            int m = s[i] - '0';
            for (int j = 0; j<13; j++) {
                int sh = (j + m * digit) % 13;
                dp[i][sh] += dp[i+1][j];
            }
        }
        
        for (int j = 0; j<13; j++) {
            dp[i][j] %= MOD;
        }
    }

    printf("%d\n", dp[0][5]);
}

Measured memory_bytes: 10368
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = ii()
    l = [0]*(N+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                t = x*x+y*y+z*z+x*y+y*z+z*x
                if t <= N:
                    l[t] += 1
    print(*l[1:], sep='\n')

if __name__ == '__main__':
    main()


Measured memory_bytes: 68452
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleAppTest
{
    class CountMedian
    {
        static void Main(string[] args)
        {


            int N = int.Parse(Console.ReadLine());
            var A = new int[N];
            var B = new int[N];
            var medianVariety = 0;

            for (var i = 0; i < N; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                A[i] = int.Parse(str[0]);
                B[i] = int.Parse(str[1]);
            }
            Array.Sort(A);
            Array.Sort(B);

            if(N % 2 == 1)
            {
                medianVariety = (B[N / 2] - A[N / 2]) + 1;
            }
            else
            {
                medianVariety = ((B[N / 2] + B[(N / 2)-1]) - (A[N / 2] + A[(N / 2) - 1])) + 1;
            }
            Console.WriteLine(medianVariety);
        }
    }
}

Measured memory_bytes: 47476
s = input()

l = [0]*len(s)

for i in range(len(s)):
	l[i] = s[i]

min = 100000

for i in range(len(s)-2):
	k = int(l[i])*100+int(l[i+1])*10+int(l[i+2]) 
	test = abs(753-k)
	#print(k)
	if test < min:
		#print(i)
		#print(min)
		min = test
		
print(min)
	


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  vector<int> x, y;
  rep(i, N) {
    int a;
    cin >> a;

    x.push_back(a + i);
    y.push_back(i - a);
  }

  vector<int> quantile(x);
  sort(quantile.begin(), quantile.end());
  quantile.erase(unique(quantile.begin(), quantile.end()), quantile.end());

  vector<int> cnt(quantile.size(), 0);
  int64_t result = 0;
  rep(i, N) {
    int j =
        lower_bound(quantile.begin(), quantile.end(), y[i]) - quantile.begin();
    if (j < quantile.size() && quantile[j] == y[i]) {
      result += cnt[j];
    }

    cnt[lower_bound(quantile.begin(), quantile.end(), x[i]) -
        quantile.begin()]++;
  }
  cout << result << endl;

  return 0;
}

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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

std::string s,t;
std::set<tuple<char,char>> sp;

V<int> cnt1;
V<int> cnt2;

int main(){
    INIT;
    cin >> s;
    cin >> t;
    cnt1.resize(26);
    cnt2.resize(26);
    REP(i,s.size()) {
        char a = s[i];
        char b = t[i];
        cnt1[a-'a']++;
        cnt2[b-'a']++;
    }

    REP(i,26) {
        REP(j,26) {
            if(cnt1[i] == cnt2[j]) {
                cnt1[i] = 0;
                cnt2[j] = 0;
                break;
            }
        }
    }

    bool ok = true;
    REP(i,26) if(cnt1[i] > 0 || cnt2[i] > 0) ok = false;

    cout << (ok ? "Yes" : "No") << "\n";
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)                                                             \
  sort(x.begin(), x.end());                                                    \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y)                                                           \
  cerr << "(" << #x << ", " << #y << ") = "                                    \
       << "(" << x << ", " << y << ")" << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

const long double PI = 3.14159265358979323846264338327950L;
// ----------------------------------------------

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

  int a, b, h, m;

  cin >> a >> b >> h >> m;

  long double jdeg = (long double)(h * 60 + m) / 720 * 2 * PI;

  long double bdeg = (long double)(m) / 60 * 2 * PI;

  long double bt = jdeg - bdeg;

  long double ans2 =
      (long double)(a * a + b * b) - (long double)(2 * a * b) * cos(bt);
  printf("%.10Lf\n", sqrtl(ans2));

  return 0;
}

Measured memory_bytes: 4180
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        if (n == 1) {
            System.out.println(1);
            return;
        }
        Set<Integer> set = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        List<Integer> list = new ArrayList<>();
        int max = 0;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            max = Math.max(max, a);
            list.add(a);
            if (!set.contains(a)) {
                set.add(a);
            } else {
                set2.add(a);
            }
        }
        boolean[] b = new boolean[max + 1];
        Arrays.fill(b, true);
        Collections.sort(list);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int a = list.get(i);
            if (!set2.contains(a) && b[a]) {
                ans++;
            }
            for (int j = a; j <= max; j += a) {
                b[j] = false;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 75260
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, m, a[100010], b[100010];
vector<pair<int, int>> vec[100010];
bool bl[100010];
bool bl2[100010];
int cnt[100010];

void dfs(int v) {
	int cnt = 0;
	bl[v] = true;
	for (int i = 0; i < (int)vec[v].size(); i++) {
		if (bl[vec[v][i].first])continue;
		bl2[vec[v][i].second] = true;
		dfs(vec[v][i].first);
	}
}

bool dfs2(int v, int p) {
	for (int i = 0; i < (int)vec[v].size(); i++) {
		if (!bl2[vec[v][i].second])continue;
		if (vec[v][i].first == p)continue;
		if (dfs2(vec[v][i].first, v))cnt[v]++;
	}
	if (cnt[v] % 2) {
		if (p)cout << v << " " << p << endl;
		return false;
	}
	else {
		if (p)cout << p << " " << v << endl;
		return true;
	}
}

signed main() {
	cin >> n >> m;
	if (m % 2) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		vec[a[i]].push_back(make_pair(b[i], i));
		vec[b[i]].push_back(make_pair(a[i], i));
	}
	dfs(1);
	for (int i = 0; i < m; i++) {
		if (bl2[i])continue;
		cout << a[i] << " " << b[i] << endl;
		cnt[a[i]]++;
	}
	dfs2(1, 0);
}

Measured memory_bytes: 16000
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class91
    {
        static void Main()
        {
            var abk = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long a = abk[0], b = abk[1], k = abk[2];
            a -= k;
            if (a < 0)
            {
                b += a;
                a = 0;
                if (b < 0)
                    b = 0;
            }
            Console.WriteLine($"{a} {b}");
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define forn for(int i=0;i<n;i++)
#define form for(int j=0;j<m;j++)
#define pb push_back
#define s second
#define f first
int main()
{
   const int N = (1e5) + 5;
    int n, a[N];
    int L[N];
    int R[N];
    scanf("%d", &n);
 
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
 
    for (int i = 1; i <= n; i++) {
        L[i] = __gcd(L[i - 1], a[i]);
    }
 
    for (int i = n; i >= 1; i--) {
        R[i] = __gcd(a[i], R[i + 1]);
    }
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        ans = max(ans, __gcd(L[i - 1], R[i + 1]));
    }
 
    printf("%d", ans);
 
    return 0;
   
				
}

Measured memory_bytes: 1408