akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(void){
    int a, b;
    cin >> a >> b;

    string s;
    cin >> s;

    int n = s.size();

    bool check = true;

    if(s.at(a) != '-') check = false;

    for(int i = 0; i <= a-1; i++){
        if(s.at(i) != '0' && s.at(i) != '1'&& s.at(i) != '2'&& s.at(i) != '3'&& s.at(i) != '4'&& s.at(i) != '5'&& s.at(i) != '6'&& s.at(i) != '7'
        && s.at(i) != '8'&& s.at(i) != '9'){
            check = false;
        }
    }

    for(int i = a+1; i <= n-1; i++){
        if(s.at(i) != '0' && s.at(i) != '1'&& s.at(i) != '2'&& s.at(i) != '3'&& s.at(i) != '4'&& s.at(i) != '5'&& s.at(i) != '6'&& s.at(i) != '7'
        && s.at(i) != '8'&& s.at(i) != '9'){
            check = false;
        }
    }

    if(check){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
using namespace std;

int main(){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(isupper(ch)){
            printf("%c",tolower(ch));
        }else if(islower(ch)){
            printf("%c",toupper(ch));
        }else{
            printf("%c",ch);
        }
        if(ch=='\n')break;
    }
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  vector<P> works;
  rep (i, n) {
    int a, b;
    cin >> a >> b;
    works.push_back(make_pair(b, a));
  }
  
  sort(works.begin(), works.end());
  
  ll time = 0;
  for (auto v : works) {
    if (time + v.second > v.first ) {
      cout << "No" << endl;
      return 0;
    }
    time += v.second;
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 5336
#include <stdio.h>
#define MAXS 10000
#define MAXT 500

int LinearSearch(int A[],int n, int key)
{
  int i=0;
  A[n] = key;
  while( A[i] != key ) i++;
  return i != n; 
}

int main()
{
  int n,q,S[MAXS],T[MAXT],result,count=0,i;

  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for( i=0 ; i<q ; i++ ){
    scanf("%d",&T[i]);
  }

  for( i=0 ; i<q ; i++ ){
    result = LinearSearch(S,n,T[i]);
    if( result==1 ) count++;
  }

  printf("%d\n",count);

  return 0;
  
  
}



Measured memory_bytes: 2108
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

x = k()
a = x//500
b = (x-500*a)//5
print(1000*a+5*b)


Measured memory_bytes: 10516
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = []
for _ in range(5):
    a.append(ni())

amin = min(a)
ans = (n-1)//min(a) + 1 + 4
print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
 
 
// N / A == B
// N / B == A
 
int countDivisor(int N){
	int ans = 0;
	for (int i = 1; i * i <= N; i++)
	{
		if (N % i == 0) {
			if (i * i == N) ans++;
			else ans += 2;
		}
	}
	return ans;
}
 
int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; i += 2)
	{
		if (countDivisor(i) == 8) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int>v;
vector<int>v2;
vector<int>vreel;

int main(){
	int a;
	cin>>a;
	int x;
	int kl=0;
	int kls=0;
	
	for(int i=0;i<a;i++){
		cin>>x;
		v.push_back(x);	
		vreel.push_back(i+1);
	}
	for(int i=0;i<a;i++){
		cin>>x;
		v2.push_back(x);	
	}
	int sayac=0;
	do{
		sayac++;
		int ol=1;
		for(int i=0;i<a;i++){
			if(vreel[i]!=v[i]){
				ol=0;
				break;
			}	
		}
		if(ol==1){
			kl=sayac;
	
		}
		
		ol=1;
		for(int i=0;i<a;i++){
			if(vreel[i]!=v2[i]){
				ol=0;
				break;
			}	
		}
		if(ol==1){
			kls=sayac;
	
		}
		
		
	
	}while(next_permutation(vreel.begin(),vreel.end()));
	cout<<abs(kl-kls);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string lcs(string text1, string text2) {
        vector<vector<int>> dp(text1.size()+1,vector<int>(text2.size()+1,0));
        for(int i=1;i<dp.size();i++){
            for(int j=1;j<dp[1].size();j++){
                if(text1[i-1]==text2[j-1]){
                    dp[i][j]= 1+ dp[i-1][j-1];//just before consderng t1[i] & t2[j] lcs length was dp[i-1][j-1;]
                }
                else
                    dp[i][j]= max(dp[i-1][j],dp[i][j-1]);
            }
        }
        //printing lcs;
        int i=dp.size()-1, j=dp[0].size()-1;
        string ans="";
        while(1){
            if(dp[i][j]==0)
                break;
            if(dp[i][j-1]==dp[i][j]){
                --j;
                continue;
            } 
            else if(dp[i-1][j]==dp[i][j] ){ 
                --i;
                continue;
            }
            else if( text1[i-1]==text2[j-1] && dp[i][j]==dp[i-1][j-1]+1){
                ans=text1[i-1]+ans;
                --i;--j;
            }           
        }
        return ans;
    }
    
    int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    cout<<lcs(s,t);
}

Measured memory_bytes: 38888
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

const int N = 101234;
vii G(N);

int dfs(int now, int par) {
    int res = 0;
    for (int ch: G[now]) {
        if (ch == par) continue;
        res ^= (dfs(ch, now) + 1);
    }
    // DEBUG(pii(now, res));
    return res;
}

signed main() {
    fio();

    int n;
    cin >> n;
    rep (i, n - 1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    if (dfs(0, -1)) {
        cout << "Alice" << endl;
    }
    else {
        cout << "Bob" << endl;
    }
}

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

int main() {
    int n, x, sum = 0; cin >> n >> x;
    vector<int> m(n);
    for (auto& e : m) {
        cin >> e;
        sum += e;
    }
    
    sort(m.begin(), m.end());
    cout << n + (x-sum)/m[0] << endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	vector<pair<LL, LL>> points(n);

	for (int i = 0; i < n; i++) {
		pair<LL, LL>p;
		cin >> p.first >> p.second;
		points[i]=p;
	}

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

	LL ans = n;
	for (int i = n-1; i >=0; i--) {
		for (int j = i-1; j >=0; j--) {
			LL tmp = 0;

			LL p = points[i].first - points[j].first;
			LL q = points[i].second - points[j].second;

			if (p == 0 && q == 0)continue;

			for (int k = n-1; k >=0; k--) {
				pair<LL, LL> ps;
				ps.first = points[k].first - p;
				ps.second = points[k].second - q;

				if (binary_search(points.begin(), points.end(), ps)) {
					tmp++;
				}
			}

			ans = min(ans, n - tmp);
		}
	}

	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (d % 2 ? b - a : a - b) << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a < b) {
			System.out.println("a < b");
		}
		else if(a > b){
			System.out.println("a > b");
		}
		else {
			System.out.println("a == b");
		}
	}

}



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

#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)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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;
}
///////////////////////////////////////////////
/*(._.)*/
int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;

	vector<int> bl(N+2);
	vector<int> wr(N+2);
	FORq(i,1,N){
		if (S[i-1] == '#'){
			bl[i] = bl[i-1] + 1;
		}else{
			bl[i] = bl[i-1];
		}
	}

	FORqr(i,1,N){
		if (S[i-1] == '.'){
			wr[i] = wr[i+1] + 1;
		}else{
			wr[i] = wr[i+1];
		}
	}

	int ans = 1e9;
	FORq(i,1,N){
		int nans = 0;
		if (S[i-1] == '#'){
			nans += bl[i] - 1 + wr[i+1];
		}else{
			nans += bl[i-1] - 1 + wr[i];
		}

		chmin(ans,nans);
	}

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


Measured memory_bytes: 2180
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]

v = 0
last = [-1 for _ in range(26)]

for d in range(D):
    last[t[d]-1] = d
    v += s[d][t[d]-1]
    for j in range(26):
        v -= c[j]*(d-last[j])
    print(v)


Measured memory_bytes: 9392
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

typedef pair<int, int> pp;

pp add(pp a, pp b)
{
    pp ans;
    ans.first = a.first * b.second + b.first * a.second;
    ans.second = a.second * b.second;
    return ans;
}
bool eq(pp a, pp b)
{
    return (a.first * b.second == b.first * a.second);
}
int n, limit, cnt;
pp target;

void search(int num, int now, pp sum, int l)
{
    if(num == n) return;
    for(int i = now; i <= limit;i++)
    {
        if( i * l > limit) break;
        pp next = add(sum, pp(1, i));

        if(eq(next, target))cnt++;
        else if(next.first * target.second < target.first * next.second)
            search(num+1, i, next, l * i);
    }
    return ;
}

int main()
{
    int p, q, l;
    while(cin >> p >> q >> limit >> n && n)
    {
        cnt = 0;
        target = pp(p, q);
        for(int i = 1; i <= limit; i++)
        {
            pp tmp = pp(1, i);
            if(eq(tmp, target)) cnt++;

            search(1, i, tmp, i);
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

		int N = sc.nextInt();
		int[] A = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}

		Set<Integer> linkedHashSet = new LinkedHashSet<Integer>();
		for (int i = 0; i < N; i++) {
			linkedHashSet.add(A[i]);
		}

		if (linkedHashSet.toArray().length == A.length) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

		sc.close();
	}

}


Measured memory_bytes: 73772
#include <bits/stdc++.h>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node { int p, l, r; };
Node T[MAX];
int n, D[MAX];

void print(int u) {
	int c;
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].p << ", ";
	cout << "depth = " << D[u] << ", ";

	if (T[u].p == NIL)
		cout << "root, ";
	else if (T[u].l == NIL)
		cout << "leaf, ";
	else
		cout << "internal node, ";

	cout << "[";

	if (T[u].l != NIL) {
		c = T[u].l;
		cout <<  c;
		while (T[c].r != NIL) {
			cout << ", " << T[c].r;
			c = T[c].r;
		}
	}

	cout << "]" << endl;
}

int rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL)
		rec(T[u].r, p);
	if (T[u].l != NIL)
		rec(T[u].l, p + 1);
	return 0;
}

int main() {
	int i, j, d, v, c, l, r;
	cin >> n;
	for (i = 0; i < n; i++)
		T[i].p = T[i].l = T[i].r = NIL;
	for (i = 0; i < n; i++) {
		cin >> v >> d;
		for (j = 0; j < d; j++) {
			cin >> c;
			if (j == 0)
				T[v].l = c;
			else
				T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}
	for (i = 0; i < n; i++) {
		if (T[i].p == NIL)
			r = i;
	}
	rec(r, 0);
	for (i = 0; i < n; i++)
		print(i);
}


Measured memory_bytes: 7776
from sys import stdin
from itertools import groupby
S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())
l = len(S)
# Run Length Encoding
rle = [(k, sum(1 for _ in g)) for k, g in groupby(S)]

if len(set(S)) == 1:
    print(len(S) * K // 2)
else:
    tmp_ans = sum([t[1] // 2 for t in rle])*K
    if S[0] != S[-1]:
        print(tmp_ans)
    else:
        print(tmp_ans - (rle[0][1] // 2 + rle[-1][1] // 2 - (rle[0][1] + rle[-1][1]) // 2) * (K-1))

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
  int n;

  scanf("%d", &n);

  if(n % 2 == 0) printf("0.5000000000");

  else{
    if(n == 1) printf("1.00000000");

    else{
      printf("%.9f", (double)(n/2 + 1)/n);
    }
  }

  return 0;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


// Run Length Encoding
vecll countVector(vecll v,ll guard=-1){
  ll size=v.size();
  v.push_back(guard);
  vecll ret;
  ll count=1;
  forll(i, 0, size){
	if(v[i]==v[i+1]){
	  count++;
	}else{
	  ret.push_back(count);
	  count=1;
	}
  }
  return ret;
}


int main()
{
  ll n, t;
  cin >> n;
  vecll a(3 * n);
  vecll b;
  forll(i, 0, n){
	cin >> t;
	a[3 * i] = t-1;
	a[3 * i + 1] = t;
	a[3 * i + 2] = t+1;
  }
  sort(a.begin(), a.end());
  b = countVector(a);
  t = 0;
  forll(i, 0, b.size())
	t = max(t, b[i]);
  cout << t << endl;
}


Measured memory_bytes: 8704
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	string s;
	cin >> s;
	REP(i, s.size()){
		if(s[i] == 'g' && i % 2 == 1) ans++;
		else if(s[i] == 'p' && i % 2 == 0) ans--; 
	}
	cout << ans << endl;
}

Measured memory_bytes: 3756
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const double PI = acos(-1);
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ double x, y; };
bool operator == (P x, P y)
{   return x.x == y.x && x.y == y.y;    }
bool operator != (P x, P y)
{   return !(x == y);  }
bool operator < (P x, P y)
{ return x.x < y.x || (x.x == y.x && x.y < y.x); }

int main()
{    
    int n;
    while(cin >> n && n)
    {
        vector<P> points(n); char k;
        rep(i, n)
            cin >> points[i].x >> k >> points[i].y;
        
        sort(ALL(points));
        
        int res = 0;
        P s = points[0];
        P begin = s;
        
        double mrad = PI * 3 / 2;
        do
        {
            res++;
            vector<P>::iterator deleted;
            
            double irad = 0;
            for(vector<P>::iterator it = points.begin() + (res == 1); it != points.end(); it++)
            {
                double rad = atan2((*it).y - begin.y, (*it).x - begin.x);
                rad = rad < 0 ? 2 * PI + rad : rad;
                
                rad = rad < mrad ? 2 * PI - mrad + rad : rad - mrad;
                if(it == points.begin() + (res == 1) || irad < rad)
                {
                    deleted = it;
                    irad = rad;
                }
            }
            mrad += irad;
            if(2 * PI <= mrad) mrad -= 2 * PI;
            
            begin = *deleted;
            points.erase(deleted);
        }
        while(begin != s);
        
        cout << n - res << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> GetDiv(ll x)
{
    vector <ll> Res;
    for(ll y = 1; y * y <= x; y++)
    {
        if(x % y == 0)
        {
            Res.push_back(y);
            if(y * y != x)  Res.push_back(x / y);
        }
    }
 
    return Res;
}
bool Can(ll n, ll k)
{
    if(k < 2 || k > n)  return false;
    while(n % k == 0)   n /= k;
    return n % k == 1;
}
int main()
{
    ll n;  
	scanf("%lli",&n);
    vector <ll> D1 = GetDiv(n);
    vector <ll> D2 = GetDiv(n - 1);
    set <ll> Ans;
    for(ll k : D1)
        if(Can(n, k))
            Ans.insert(k);
    for(ll k : D2)
        if(Can(n, k))
            Ans.insert(k);
 
    cout << Ans.size() << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 1e5 + 2;
const int M = 1e5 + 2;
const int mod = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e16;
 
void data() {
    #ifdef PC
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
 
void scerr(vi nums) {
	for (auto it : nums)
		cerr << it << " | ";
	cerr << "\n";
}
 
ll n, dp[N], a[N];
 
int main() {
	data();
	scanf("%lld", &n);
	dp[0] = inf, dp[1] = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		if (i > 1)
			dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	}
	printf("%lld", dp[n]);
	return 0;
}
 
/*
	Timus: 288481RF
	CodeForces: __fractal
*/

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	float sum = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)	{
		cin>>a[i];
		sum += (float)1 / a[i];
	}
	cout << (float)1/sum << endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import combinations

EPS = 1e-8

N, K, *XYC = map(int, open(0).read().split())
PC = [(complex(x, y), c) for x, y, c in zip(*[iter(XYC)] * 3)]


def intersection(A, r, B, s):
    D = B - A
    d = abs(D)

    cos_t = (d * d + r * r - s * s) / (2 * d * r)
    sin_t = max(1 - cos_t * cos_t, 0.0) ** 0.5

    R = r * complex(cos_t, sin_t)
    D /= d

    return (
        A + D * R,
        A + D * R.conjugate(),
    )


def is_ok(T):
    A = [p for p, _ in PC]
    for (p1, c1), (p2, c2) in combinations(PC, 2):
        A += intersection(p1, T / c1, p2, T / c2)

    for a in A:
        if K <= sum(1 for p, c in PC if c * abs(a - p) < T + EPS):
            return True
    return False


ng, ok = 0, 1000000
for _ in range(100):
    md = (ng + ok) / 2
    if is_ok(md):
        ok = md
    else:
        ng = md

print(ok)

Measured memory_bytes: 68444
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
ll A[101];
int main(void){
    ll N,M,X;cin>>N>>M>>X;
    ll a;
    REP(i,M){
        cin>>a;a--;
        A[a]=1;
    }
    ll ans1=0,ans2=0;
    REP(i,X){
        ans1+=A[i];
    }
    FOR(i,X,N){
        ans2+=A[i];
    }
    cout<<min(ans1,ans2)<<"\n";
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {

    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    Sort(v);
    double ans=v[0] ;
    rep(i,n-1)ans=(ans+v[i+1])/2;
    fin(ans);
}



Measured memory_bytes: 256
A = [input().split() for i in range(3)]
N = int(input())
b = [input() for i in range(N)]
f = False

for i in range(N):
    for j in range(3):
        for k in range(3):
            if b[i] == A[j][k]:
                A[j][k] = 0

for i in range(3):
    if A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
        f = True
    elif A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
        f = True

if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
    f = True
elif A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0:
    f = True

print("Yes") if f else print("No")



Measured memory_bytes: 3064
// By Atul Rathore

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define f(n) for(int i=0;i<n;i++)
#define p(x) cout<<x<<endl;
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	


int main()
{
	fastio;
	int k;
	cin>>k;
	ll sum=0;
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=k;j++)
		{
			for(int y=1;y<=k;y++)
			{
				int u=__gcd(j,y);
				sum+=__gcd(i,u);
			}
		}
	}
	cout<<sum<<endl;
	
	
}


Measured memory_bytes: 3640
// Contest No.: ABC176
// Problem No.: C
// Solver:      Jinmin Goh
// Date:        20200822

#include <cstring>
#include <iostream>
#include <cstdlib>
#include <list>
#include <array>
#include <atomic>
#include <algorithm>
#include <deque>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <valarray>
#include <vector>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;

int nums[200010];

int main() {
    long long int n, ans = 0;
    scanf("%lld", &n);
    for(int i = 0; i < n; i++) {
        scanf("%lld", &nums[i]);
    }

    int curMin = nums[0];
    for(int i = 0; i < n; i++) {
        if(nums[i] > curMin) {
            curMin = nums[i];
        }
        else {
            ans += curMin - nums[i];
        }
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 4620
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
    #define endl "\n" 
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    multiset<int> red,grn;
    multiset<int,greater<int> > col;
    int x,y,a,b,c,sum,xx;
    void solve()
    {
        cin>>x>>y>>a>>b>>c;
        fo(i,0,a)
        {
            cin>>xx;
            red.insert(xx);
        }
        fo(i,0,b)
        {
            cin>>xx;
            grn.insert(xx);
        }
        fo(i,0,c)
        {
            cin>>xx;
            col.insert(xx);
        }
        // for(auto xx:red)deb(xx)
        //     for(auto xx:grn)deb(xx)
        //         for(auto xx:col)deb(xx)

        while(red.size()<x)
        {
            red.insert(*col.begin());
            col.erase(col.begin());
        }
        while(grn.size()<y)
        {
            grn.insert(*col.begin());
            col.erase(col.begin());
        }
        
        while(red.size()>x)
            red.erase(red.begin());
        while(grn.size()>y)
            grn.erase(grn.begin());

        while((*col.begin())>min(*red.begin(),*grn.begin()))
        {
            if(*red.begin()<*grn.begin())
            {
                red.insert(*col.begin());
                red.erase(red.begin());
            }
            else
            {
                grn.insert(*col.begin());
                grn.erase(grn.begin());
            }
            col.erase(col.begin());
        }

        for(auto xx:red)sum+=xx;
        for(auto xx:    grn)sum+=xx;

        cout<<sum<<endl;
 
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
    {
    
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
    
        // cin>>t;while(t--)
            solve();
    
        return 0;
    }

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int N; cin >> N;
  string s; cin >> s;
  int red=0, blue=0;
  for(int i = 0; i < N; ++i) {
    if(s[i] == 'R') red++;
    else if(s[i] == 'B') blue++;
  }
  if(red > blue) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
const double eps = 1e-9;

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int main()
{
    #ifdef __LOCAL
        fs::path path_to_file = __FILE__;
        fs::path input,output;
        input = output = path_to_file.parent_path();
        input += string("/input/") + string(path_to_file.stem()) + string(".txt");
        output += string("/output/") + string(path_to_file.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif

    int N;
    vector<pii> A;
    cin >> N;
    for(int i=1;i<=N;i++){
        int in;
        cin >> in;
        A.push_back(make_pair(i,in));
    }
    sort(A.begin(),A.end(),[](pii a, pii b){return a.second < b.second;});
    for(int i=0;i<N;i++){
        cout << A[i].first << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1780
inp = input()

first = int(inp[:2])
last = int(inp[2:])

def month_check(num):
  if num == 0:
    return False
  elif num > 12:
    return False
  else:
    return True

first_check = month_check(first)
last_check = month_check(last)

if first_check & last_check:
  print("AMBIGUOUS")
elif (first_check == True) & (last_check == False):
  print("MMYY")
elif (first_check == False) & (last_check == True):
  print("YYMM")
elif (first_check == False) & (last_check == False):
  print("NA")

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int[] input = new int[3];
        input[0] = in.nextInt();
        input[1] = in.nextInt();
        input[2] = in.nextInt();
        Arrays.sort(input);
        System.out.println(input[0] + input[1]);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_map>

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

ll combination(int n) {
    
    return n * (n-1) / 2;
}



int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    unordered_map<string, int> mp(n);
    string s;
    rep(i, n)
    {
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    
    
    
    ll cnt = 0;
    for (auto p : mp)
    {
        int num_duplicate = p.second;
        cnt += (ll)num_duplicate * (num_duplicate - 1) / 2;
    }
    
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  ll n, ans=0;
  cin >> n;
  ans = n * (n+1) / 2 - n;
  cout << ans;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
s = "n"+input()
info = [list(map(int,input().split())) for i in range(q)]

ruiseki = [0]*(n+1)
for i in range(1,n+1):
  if s[i-1]+s[i] == "AC" :
    ruiseki[i] = ruiseki[i-1] + 1
  else:
    ruiseki[i] = ruiseki[i-1]

for i in range(q):
  print(ruiseki[info[i][1]]-ruiseki[info[i][0]])

Measured memory_bytes: 30752
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n;
    cin>>n;
    int a1[100005]={0};
    int a;
    loop(i,0,n)
    {
        cin>>a;
        a1[a]++;
        a1[a+1]++;
        if(a-1>=0)
        a1[a-1]++;
    }
    int ans = 0;
    loop(i,0,100005)
    {
        ans = max(ans,a1[i]);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 4008
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		int num = s.length();
		for(int i = 0;i < num;i++){
			System.out.print("x");
		}
		System.out.println("");

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22612
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    T = SS()

    l = len(S)

    S_i = [[] for _ in range(26)]
    T_i = [[] for _ in range(26)]
    for i in range(l):
        S_i[ord(S[i]) - ord('a')].append(i)
        T_i[ord(T[i]) - ord('a')].append(i)

    S_set = set()
    T_set = set()
    for i in range(26):
        if S_i[i]: S_set.add(tuple(S_i[i]))
        if T_i[i]: T_set.add(tuple(T_i[i]))

    if S_set == T_set:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 24184
#include <bits/stdc++.h>
#define X first
#define Y second
#define PB push_back
#define ll long long
#define pii pair<ll,ll>
#define MEM(x,y) memset(x,y,sizeof(x))
#define bug(x) cout<<"debug "#x" is "<<x<<endl;
#define FIO ios::sync_with_stdio(false);
#define ALL(x) x.begin(),x.end()
#define LOG 20
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1|1)
using namespace std;
#define vi vector<int>
const int maxn = 2e5+7;
const ll mod=998244353;
ll a[maxn],b[maxn],c[maxn];
int main(){
    FIO
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[5]==s[4]) cout<<"Yes"<<endl;
    else cout<<"No\n";
	return 0;
}


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

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		multiset<int> Set;
		for(int i = 0; i < n; ++i)
		{
			int temp;
			cin >> temp;
			Set.insert(temp);
		}
		for(int i = 0; i < 10; ++i)
		{
			int temp = Set.count(i);
			for(int j = 0; j < temp; ++j)
			{
				cout << "*";
			}
			if(!temp)
			{
				cout << "-";
			}
			cout << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0