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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	priority_queue<ll> r;
	priority_queue<ll> g;
	priority_queue<ll> non;

	for(int i = 0; i < a; ++i)
	{
		ll in;
		cin >> in;
		r.push(in);
	}
	for(int i = 0; i < b; ++i)
	{
		ll in;
		cin >> in;
		g.push(in);
	}
	for(int i = 0; i < c; ++i)
	{
		ll in;
		cin >> in;
		non.push(in);
	}

	ll ans = 0;
	int non_cnt = 0;
	while(x + y - non_cnt > 0)
	{
		ll next_r   = (x <= 0 || r.empty()) ? 0 : r.top();
		ll next_g   = (y <= 0 || g.empty()) ? 0 : g.top();
		ll next_non = non.empty() ? 0 : non.top();

		if (next_r >= next_g && next_r >= next_non)
		{
			x--;
			ans += next_r;
			r.pop();
		}
		else if (next_g >= next_r && next_g >= next_non)
		{
			y--;
			ans += next_g;
			g.pop();
		}
		else if (next_non >= next_g && next_non >= next_r)
		{
			non_cnt++;
			ans += next_non;
			non.pop();
		}
		else
		{
			cout << "nazo" << endl;
		}
	}
	cout << ans <<  endl;

}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3316
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class AHaiku {
public:
  static void solve(istream &cin, ostream &cout) {
    string s;
    cin >> s;
    cout << s.substr(0, 5) << " " << s.substr(6, 7) << " " << s.substr(14, 5) << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  AHaiku solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

int main() {
  vector<int> vec(3);
  for (int i = 0; i < 3; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  cout << vec.at(0) * 10 + vec.at(1) + vec.at(2) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b;
	cin>>a>>b;
	if(a<b) cout<<"a < b"<<endl;
	else if(a>b) cout<<"a > b"<<endl;
	else cout<<"a == b"<<endl;
	return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
#define MAX 1000000

int A[MAX];
int partition(int,int);

int main(){
    int x,n;

    scanf("%d",&n);
    
    for(int i = 0;i < n;i++)scanf("%d",&A[i]);

    x = partition(0,n-1);

    for(int i = 0;i < n;i++){
        if(i == x)printf("[");
        printf("%d",A[i]);
        if(i == x)printf("]");
        if(i < n - 1)printf(" ");
    }
    printf("\n");

    return 0;
}

int partition(int p,int r){
    int x,i,temp;

    x = A[r];
    i = p - 1;

    for(int j = p;j < r;j++){
        if(A[j] <= x){
            i = i + 1;
            temp = A[i];
            A[i] = A[j];
            A[j] = temp;
        }
    }

    temp = A[i + 1];
    A[i + 1] = A[r];
    A[r] = temp;

    return i + 1;
}




Measured memory_bytes: 2112
from collections import defaultdict
from itertools import combinations


def solve():
    N = int(input())
    S = input()
    s1, s2 = S[:N], S[N:][::-1]
    
    l_dict = defaultdict(int)
    r_dict = defaultdict(int)
    for i in range(N+1):
        for red_idx in combinations(range(N), i):
            red, blue = '', ''
            for j in range(N):
                if j in red_idx:
                    red += s1[j]
                else:
                    blue += s1[j]
            l_dict[red+' '+blue] += 1
    for i in range(N+1):
        for red_idx in combinations(range(N), i):
            red, blue = '', ''
            for j in range(N):
                if j in red_idx:
                    red += s2[j]
                else:
                    blue += s2[j]
            r_dict[red+' '+blue] += 1
    
    ans = sum(l_dict[key] * r_dict[key] for key in l_dict)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 90080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int cnt_ab(string s) {
    int ans = 0;
    for(int i = 1; i < s.length(); i++) {
        if (s[i] == 'B' && s[i-1] == 'A') {
            ans += 1;
        }
    }
    return ans;
}
int main() {
    int N;
    string s;
    cin >> N;
    int ab = 0;
    int b_head = 0;
    int a_tail = 0;
    int base = 0;
    for(int i = 0; i < N; i++) {
        cin >> s;
        base += cnt_ab(s);
        if (s[0] == 'B' && s.back() == 'A') {
            ab += 1;
        } else if (s[0] == 'B') {
            b_head += 1;
        } else if (s.back() == 'A') {
            a_tail += 1;
        }

    }
    if (ab > 0) {
        base += ab-1;
        if (b_head > 0) {
            b_head -= 1;
            base += 1;
        }
        if (a_tail > 0) {
            a_tail -= 1;
            base += 1;
        }
    }
    base += min(a_tail, b_head);
    cout << base << endl;

    return 0;
}



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

int main(){
    int n;cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  int ans=0;

  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
    ans+=b[i];
  }
  rep(i,n-1){
    cin>>c[i];
  }
   rep(i,n-1){
     if(a[i]+1==a[i+1]){
       ans+=c[a[i]-1];
     }
     // cout<<"ans "<<ans<<endl;
   }
   cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input()) 
x = []
y = []

a = 1

for i in range(N):
    d = input().split()
    x.append(int(d[0]))
    y.append(int(d[1]))


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

count = 0
d = 0
for i in range(N):
    for j in range(N):
        if i == j:
            break

        d += distance(x[i], y[i], x[j], y[j])

print((d * (N - 1) / (N * (N - 1) / 2)))



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

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  if(b - a == c - b) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/perl

use strict;
use warnings;

my $x = <STDIN>;

if ($x<100) {
    print "0\n";
    exit;
}
my $cnt = 0;
my $y;
while ($x>=100) {
    $x -= 100;
    $y = $x;
    $cnt++;
}
if ($y<=5*$cnt) {
    print "1\n";
} else {
    print "0\n";
}

Measured memory_bytes: 640
import math
while(1):
    n=int(input())
    s=[]
    if n== 0:
        break
    s=list(map(int,input().split()))
    mean = int(sum(s))/int(len(s))
    ss=0
    for i in range(len(s)):
        ss += (s[i]-mean)**2
    std = math.sqrt(ss/n)
    print(std)


Measured memory_bytes: 5696
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>

using namespace std;

string itos(int);


int main(){


  string s[1000];
  int n[1000];

  int sumin = 0;


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

  for(int i = 0; i < sumin-1; i++){
    for(int j = i; j < sumin; j++){
      if(n[i] > n[j]){
        int stock = n[i];
	n[i] = n[j];
	n[j] = stock;
	string stack = s[i];
	s[i] = s[j];
	s[j] = stack;
      }
    }
  }


  string num[1000];


  map<string, string> M;


  for(int i = 0; i < sumin; i++){
    for(int j = 0; j < i; j++){
      if(s[j] == s[i]){
	M[s[i]] += " ";
	break;
      }
    }

    M[s[i]] += itos(n[i]);

  }

  sort(s, s+sumin);


  for(int i = 0; i < sumin-1; i++){
    int check = 0;
    if(i != 0){
      for(int j = 0; j < i; j++){
	if(s[i] == s[j]){
	  check++;
	}else if(check == 0 && j == i-1){	
	  cout << s[i] << endl << M[s[i]] << endl;
	}
      }
    }else{
      cout << s[i] << endl << M[s[i]] << endl;
    }
  }


  
  return 0;
}

string itos(int x){
  ostringstream s;
  s << x;
  return s.str();
}

Measured memory_bytes: 0
n, m, q = map(int, input().split())
cities = [[0 for _ in range(n+1)] for _ in range(n+2)]
trains = [list(map(int, input().split())) for _ in range(m)]
quests = [list(map(int, input().split())) for _ in range(q)]

for train in trains:
    x, y = train[0], train[1]
    cities[x][y] += 1

for i in range(n):
    for j in range(1, n-i+1):
        x = j + i
        cities[j][x] += cities[j][x-1] + cities[j+1][x] - cities[j+1][x-1]

for quest in quests:
    p, q = quest[0], quest[1]
    print(cities[p][q])


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i,N) cin >> X.at(i);
    int min = 1000000;
    rep(P,101){
        int ans = 0;
        rep(i,N){
            ans += pow(X.at(i)-P,2);
        }
        if(ans<min) min = ans;
    }
    cout << min <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<vector>
#include<ctime>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const ll inf=0x3f3f3f3f;
const ll Mod=924844033;
const ll N=4005;
ll read(){
	ll s=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
	return s*f;
}
ll n,m,tot;
ll fac[N],vis[N],f[N][N][2];
int main(){
//	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	n=read();m=read();fac[0]=1;
	for(ll i=1;i<=n;i++)fac[i]=fac[i-1]*i%Mod;
	for(ll i=1;i<=m;i++){
		for(ll t=2;t--;){
			for(ll j=i;j<=n;j+=m){
				tot++;
				if(j!=i)vis[tot]=1;
			}
		}
	}
	ll ans=0;
	f[0][0][0]=1;
	for(ll i=0;i<n*2;i++){
		for(ll j=0;j<=n;j++){
			f[i+1][j][0]=(f[i][j][0]+f[i][j][1])%Mod;
			if(vis[i+1])f[i+1][j+1][1]=f[i][j][0];
		}
	}
	for(ll i=0;i<=n;i++){
		ll t=i&1?-1:1;
		f[2*n][i][0]=(f[2*n][i][0]+f[2*n][i][1])%Mod*fac[n-i]%Mod;
		ans=(ans+f[2*n][i][0]*t+Mod)%Mod;
	}
	printf("%lld",ans);
	return 0;
}

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


int main(){
    string s;
    cin >> s;
    string t;
    cin >> t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    rep(i,100){
        if(s[i] > t[i]){
            cout << "No" << endl;
            return 0;
        }
        if(s[i] < t[i]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

vector<int> a(26);
vector<bool> canSwap(26, 1);

bool mapping(int x, int y) {
	int z = find(a.begin(), a.end(), y) - a.begin();
	if (x == z) {
		canSwap[x] = 0;
		return 1;
	}
	if (canSwap[x] && canSwap[z]) {
		canSwap[x] = 0;
		swap(a[x], a[z]);
		return 1;
	}
	return 0;
}

int main() {
	bool isYes = 1;
	for (int i = 0; i < 26; i++) {
		a[i] = i;
	}

	string s, t;
	cin >> s >> t;
	int n = s.size();

	for (int i = 0; i < n; i++) {
		if (!mapping(s[i] - 'a', t[i] - 'a')) {
			isYes = 0;
			break;
		}
	}

	cout << (isYes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 776
import java.io.*;
import java.text.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int N = sc.nextInt();
		String s = sc.next();
		int count = 0;
		
		for (int i = 0; i < N; i++) {
			if (s.charAt(i) == 'R') {
				count++;
			}
		}
		String msg = "No";
		
		if (N / 2 < count) {
			msg = "Yes";
		}
		System.out.println(msg);
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
 
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  int a[3];
  int c = 0;
  int count = 0;
 
  rep(i,0,3){
    cin >> a[i];
  }
  rep(i,0,3){
    if(a[i] == 5){
      count++;
    }
    else if(a[i] == 7){
      c++;
    }
  }
  if((count == 2) && (c == 1)){
    printf("YES\n");
  }
  else printf("NO\n");
  
  return 0;
}

Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<int> a(n + 1); rep(i, n) cin >> a[i + 1];
	vector<ll> dp(n + 1, 1000);
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= i; ++j)
		{
			chmax(dp[i], dp[j]);
			chmax(dp[i], ((dp[j] / a[j])*a[i] + dp[j] % a[j]));
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

int main() {
    string s;
	cin >>s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == s[i + 1]) {
			cout <<"Bad"<<endl;
			return 0;
		}
	}
	cout <<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    string S;cin >> S;
    if(N % 2 != 0){
        cout << "No" << endl;
        return 0;
    }
    else{
        REP(i,N/2){
            int j = N/2 + i;
            if(S[i] != S[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let ans = [];
   let pai = xs[1];
   for(let i = 0; i < xs[0]; i++){
     ans.push(pai + i);
   }
   let ans1 = 0;
   for(let i = 0; i < xs[0]; i++){
     ans1 = (ans1 + ans[i]);
    }
   
   let ans2 = [];
   for(let i = 0; i < xs[0]; i++){
    ans2.push(Math.abs(ans[i]));
   }
   const compare = (a, b)=>{ 
   return a - b;  
   }
   ans2.sort(compare);    
   //console.log(ans2);
   if(ans[0]>0){
   console.log(ans1-ans2[0]);
   }else if(ans[0]<=0){
   console.log(ans1-(-ans2[0]));
   }      
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7500
N = int(input())
s = {}
for _ in range(N):
  a = "".join(sorted(input()))
  if a not in s:
    s[a] = 0
  else: s[a] += 1

ans = 0
for v in s.values():
  if v < 2: ans += v
  if v > 1: ans += v * (v+1) // 2
print(ans)

Measured memory_bytes: 17848
#include <bits/stdc++.h>
using namespace std;
#define ri register int
const int N=105,M=505,mod=1e9+7; 
int f[N][N][M],L[N];
inline void add(int &x,ri y){
	x=(x+=y)>=mod?x-mod:x;
}
inline int mul(ri x,ri y){
	return (long long)x*y%mod;
}
int main(){
	ri n,X,i,j,k,l,res,ans;
	scanf("%d%d",&n,&X);
	for(i=1;i<=n;++i) scanf("%d",&L[i]); 
	sort(L+1,L+1+n,[&](int x,int y){
		return x>y;
	});
//	for(i=1;i<=n;++i) printf("%d ",L[i]); puts("");
	f[1][1][L[1]]=1;
	for(i=2;i<=n;++i)
		for(j=1;j<=i;++j)
			for(k=j*L[i-1];k<=X;++k)
				if(res=f[i-1][j][k]){
					// 自成一个区间 
					add(f[i][j+1][k+L[i]],mul(j+1,res));
					// 被完全覆盖 
					add(f[i][j][k],mul(k-j*(L[i]-1),res));
					// 只与一个区间有交 
					for(l=1;l<L[i];++l) // 枚举相交长度 
						add(f[i][j][k+L[i]-l],mul(2*j,res));
					if(j>1)
						// 合并两个区间
						for(l=2;l<=L[i];++l) // 枚举被覆盖长度 
							add(f[i][j-1][k+L[i]-l],mul((j-1)*(l-1),res));
				}
	ans=0;
	for(j=1;j<=n;++j)
		add(ans,f[n][j][X]);
	printf("%d\n",ans);
	return 0;
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  string s;cin>>s;
  ans1(s!="AAA"&&s!="BBB");
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  rep(i, a+1) rep(j, b+1) {
    int k = (x-i*500-j*100)/50;
    if (k >= 0 && k <= c)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,m,k;
  cin>>n;
  cin>>m;
  cin>>k;
  vector<long long int>a(n+1,0),b(m+1,0);
  for(int i=1;i<=n;i++)
  {
    long long int l;
    cin>>l;
    a[i]=a[i-1]+l;
  }
  for(int j=1;j<=m;j++)
  {
    long long int l;
    cin>>l;
    b[j]=b[j-1]+l;
  }
  long long int j=m,ans=0;
  for(int i=0;i<=n;i++)
  {
    while(a[i]+b[j]>k&&j>0)
      j--;
    if(j==0&&a[i]>k)
      break;
    ans=max(ans,i+j);
  }
  cout<<ans;
}

Measured memory_bytes: 6420
N, M =map(int,input().split())
L = 0
R = N
for i in range(M):
  Lnew, Rnew =map(int,input().split())
  if(L < Lnew):
    L = Lnew
  if(R > Rnew):
    R = Rnew

ans = R-L+1
if(ans < 0):
  ans = 0
  
print(ans)

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;

int main() {
    vector<int> A(5);
    cin >> A.at(0) >> A.at(1) >> A.at(2) >> A.at(3) >> A.at(4);
    vector<int> P ={ 0, 1, 2, 3, 4 };
    int final_answer = inf;
    do {
        int ans = 0;
        for(int i = 0; i < 5; i++){
            while(ans % 10 != 0) ans += 1;
            ans += A.at(P.at(i));
        }
        final_answer = min(final_answer, ans);
    } while (next_permutation(P.begin(), P.end()));
    cout << final_answer << endl;
    return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC" << "\n";
	else
		cout << "ABC" << "\n";
	return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>

using namespace std;

class base{
  string b1,b2;
public:
  base(string x);
  string rec();
};
base::base(string x):b1(x){}
string base::rec(){  
  if(b1=="A"){
    b2="T";
  }
  else if(b1=="T"){
    b2="A";
  }
  else if(b1=="C"){
    b2="G";
  }
  else {
    b2="C";
  }
  return b2;
};

int main(){
  string s;
  cin >> s;
  base bond(s);
  s=bond.rec();
  cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int n, A[1000000],c=0;
void merge(int[], int, int, int);
void mergeSort(int[], int, int);

int main(){
  int i;

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

  mergeSort(A, 0, n);

  for(i=0; i<n-1; i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",c);
  return 0;
}

void merge(int A[], int left, int mid, int right){
  int n1, n2;
  int i, j, k;

  n1 = mid - left;
  n2 = right - mid;
  int L[n1], R[n2];
  for(i=0; i<n1; i++){
    L[i] = A[left+i];
  }
  for(i=0; i<n2; i++){
    R[i] = A[mid+i];
  }
  L[n1] = 1000000000;
  R[n2] = 1000000000;
  i=0;
  j=0;
  for(k=left; k<right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i+1;
    } else{
      A[k] = R[j];
      j = j+1;
    }
  c++;
  }
}

void mergeSort(int A[], int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

Measured memory_bytes: 4500
#include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;


int main(){
  int n,k;
  cin>>n>>k;
  
  map<int,int> mp;
  int tmp,i=0;
 for(i=0;i<n;i++){
 
    cin>>tmp;
    mp[tmp]++;
    
  }
  
  vector<pair<int,int>> v(mp.size());
  i=0;  
  for(auto x:mp){
    v[i]=make_pair(x.second,x.first);
    i++;
  }
  
  sort(v.begin(),v.end());
  int result=0;
  for(i=0;i<(int)mp.size()-k;i++){
    result+=v[i].first;
    
  }
  cout<<result<<endl;
  
}

Measured memory_bytes: 11136
using System;
class shuffle{
    public static void Main(){
        String str = Console.ReadLine();
        String temp;
        while(!str.Equals("-")){
            int snum = int.Parse(Console.ReadLine());
            int number;
            for(int i=0; i<snum; i++){
                number = int.Parse(Console.ReadLine());
                temp = str.Substring(0,number);
                str = str.Substring(number);
                str = str + temp;
            }
            Console.WriteLine(str);
            str = Console.ReadLine();
        }
    }
}



Measured memory_bytes: 15852
#include <bits/stdc++.h>
using namespace std;
//-------------------------------------------MACROS---------------------------------------------
#define 	TIEMPO_CORRIDA		cerr << "tiempo: "<<1.0*clock()/CLOCKS_PER_SEC <<" seg.\n";
#define 	FILES				freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define 	FORIT(it,e)			for(it = e.begin() ; it != e.end() ; it++)
#define 	FOR(i,a,b)			for(i = a ; i < b ; i++)
#define 	RFOR(i,a,b)			for(i = a ; i >= b ;i--)
#define 	FORSW(i,a,b,sw)		for(i = a ; i < b && sw ; i++)
#define 	RFORSW(i,a,b,sw)	for(i = a ; i >= b && sw ; i--)
#define 	fast 				ios::sync_with_stdio(false),cin.tie(),cout.tie();
#define 	to_int(x) 			atoi(x.data())
#define 	to_long(x) 			atoll(x.data())
#define 	ALL(x) 				x.begin(),x.end()
#define 	RALL(x) 			x.rbegin(),x.rend()
typedef 	long long 			ll;
typedef 	pair<int,int> 		pi;
typedef 	pair<ll,ll> 		pl;
const		int 				modN = 1e9+7;
const		double 				PI = 3.1415926535897932384626433832795028841;
//---------------------------------------------------------------------------------------------

int nodes,edges;
vector<vector<int>>graph;
int memo[100002];

int dp(int n){
	if(graph[n].size()==0) return memo[n]=0;
	if(memo[n]!=-1) return memo[n];
	int ans=0;
	for(int e : graph[n])
		ans = max(ans,dp(e)+1);
	return memo[n] = ans;
}

int main(){
	int i,j,x,y;
	while(scanf("%d %d",&nodes,&edges)==2){
		memset(memo,-1,sizeof memo);
		graph.assign(nodes+1,vector<int>());
		FOR(i,0,edges){
			scanf("%d %d",&x,&y);
			graph[x].push_back(y);
		}
		int ans = -1;
		FOR(i,1,nodes+1) ans = max(ans,dp(i));
		printf("%d\n",ans);
	}
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    char q;
        for(int i=0; i<=s.size(); i++)
        {
            if('a'<=s[i] && s[i]<='z'){
            if(i%2==0)
            {
                q=s[i];
                cout << q;
            }
            }
            else
                break;
        }

    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=510;
    int H,W;
    int a[MAXN][MAXN];
    class Line{
    public:
        int x1,y1,x2,y2;
        Line(int a1,int b1,int a2,int b2):
        x1(a1),y1(b1),x2(a2),y2(b2){}
    };
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>H>>W;
        for(int u=1;u<=H;u++){
            for(int v=1;v<=W;v++)cin>>a[u][v];
        }
        vector<Line>ans;
        for(int u=1;u<=H;u++){
            for(int v=1;v<W;v++){
                if(a[u][v]%2==1){
                    a[u][v+1]++;
                    a[u][v]--;
                    ans.push_back(Line(u,v,u,v+1));
                }
            }
        }
        for(int u=1;u<H;u++){
            if(a[u][W]%2==1){
                a[u+1][W]++;
                a[u][W]--;
                ans.push_back(Line(u,W,u+1,W));
            }
        }
        cout<<ans.size()<<"\n";
        for(auto l:ans){
            cout<<l.x1<<" "<<l.y1<<" "<<l.x2<<" "<<l.y2<<'\n';
        }
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 5232
// https://beta.atcoder.jp/contests/arc092/submissions/2242272
#include <iostream>
#pragma GCC target ("tune=native,arch=ivybridge")
#pragma GCC optimize ("O3,Ofast,unroll-loops")

int as[202020];
int bs[202020];
constexpr int block = 5000;
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &as[i]);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &bs[i]);
    }

    int ans = 0;
    for (int i = 0; i < n; i += block) {
        int end = min(n, i + block);
        int j = 0;
        for (; j + 3 < n; j += 4) {
            for (int ii = i; ii < end; ++ii) {
                ans ^= as[j] + bs[ii];
                ans ^= as[j + 1] + bs[ii];
                ans ^= as[j + 2] + bs[ii];
                ans ^= as[j + 3] + bs[ii];
            }
        }
        for (; j < n; ++j) {
            for (int ii = i; ii < end; ++ii) {
                ans ^= as[j] + bs[ii];
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.* ; 
import java.math.*;
class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner (System.in);

	
	String s1 = scan.next();
    String s2 = scan.next();
    
    char []c1 = s1.toCharArray();
    char []c2 = s2.toCharArray();
    char[] c3 = new char[c1.length+c2.length];
    int k = 0 ;
    for(int i = 0 ; i< c1.length ; i++){
      c3[k] = c1[i];
      k++;
      if(k==c3.length) break;
      
        c3[k]=c2[i];
      	k++;
      
    }
    String s3 = String.valueOf(c3);
    System.out.println(s3);
  }
}


Measured memory_bytes: 22740
N = int(input())
lis = []
six = 6
nine = 9
while six<=100000:
    lis.append(six)
    six *= 6
while nine<=100000:
    lis.append(nine)
    nine *= 9
lis.sort()
dp = [0]
for i in range(1,N+1):
    tmp = dp[i-1]+1
    for l in lis:
        if i-l<0:
            break
        tmp = min(tmp,dp[i-l]+1)
    dp.append(tmp)
print(dp[N])


Measured memory_bytes: 44124
n = int(input())
s = input()
r = []
g = []
b = []
for i in range(n):
	if s[i] == "R":
		r.append(i)
	elif s[i] == "G":
		g.append(i)
	else:
		b.append(i)
count = 0
unchi = set(b)
for i in r:
	for j in g:
		u = abs(i-j)
		count += [0,1][(max(i,j)+u) in unchi] + [0,1][(min(i,j)-u) in unchi] + [0,1][u%2 == 0 and (i+j)//2 in unchi]
print(len(r)*len(g)*len(b)-count)

Measured memory_bytes: 9332
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N;
map<ll, ll> mp;
vector<ll> canuse;

int main() {
  cin >> N;
  rep(i, 0, N) {
    ll a;
    cin >> a;
    ++mp[a];
  }

  for (auto e : mp) {
    if (e.second >= 4) {
      canuse.push_back(e.first);
      canuse.push_back(e.first);
    } else if (e.second >= 2) {
      canuse.push_back(e.first);
    }
  }

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

  if (canuse.size() < 2) {
    cout << 0;
  } else {
    cout << canuse[0] * canuse[1];
  }
}


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

int main(){
	int N;
	cin >> N;
	int ans = 0;
	for(int i = 1; i <= N; i+=2){	
		int num = 0;
		for(int j = 1; j <= i; j++)
		{
			if(i % j == 0) num++;
		}
		if(num == 8 ){
			ans++;
		}
		
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int a;
  vector<int>e;
  for(int i=0;i<3;i++){
    cin>>a;
    e.push_back(a);
  }
  sort(e.begin(),e.end());
  int x=0;
  x+=(e[1]-'0')-(e[0]-'0');
  x+=(e[2]-'0')-(e[1]-'0');
  
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

satisfaction = b[a[0]-1]

for i in range(1, n):
    satisfaction += b[a[i]-1]
    if a[i] - 1 == a[i-1]:
        satisfaction += c[a[i]-2]

print(satisfaction)
    


Measured memory_bytes: 3064
# coding: utf-8
#!/usr/bin/env python3

from collections import deque

# input
h, w = map(int, input().split())
a = [ list(input()) for _ in range(h) ]

# direction vector
dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]

# 訪れたかどうかの情報を持つ bool 値
is_visited = [ [False for _ in range(w)] for __ in range(h) ]

q = deque()

for x in range(w):
    for y in range(h):
        if a[y][x] == "#":
            q.append( (x, y, 0) )
            is_visited[y][x] = True

while q:
    # queue の先頭を取り出す
    x, y, cnt = q.popleft()
    # 4方向にループ
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]

        if nx < 0 or w <= nx or ny < 0 or h <= ny or is_visited[ny][nx]:
            continue

        q.append( (nx, ny, cnt+1) )
        is_visited[ny][nx] = True

print(cnt)

Measured memory_bytes: 170460
#include <iostream>
#include <algorithm>

using namespace std;

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

  //第1成分に入力，第2成分に何番目か
  pair<int, int> A[N];
  for(int i=0; i<N; i++){
    cin >> A[i].first;
    A[i].second = i+1;
  }

  //第1成分でソート(第2成分は実質関係ない)
  sort(A, A+N);

  //第2成分を出力
  for(int i=0; i<N; i++)
    cout << A[i].second << " ";

  cout << endl;
  
  return 0;
}


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

int main() {
	long long n;
	cin>>n;
	long long a[n+1][n+1];
	for(long long i=1;i<n+1;i++)
	    for(long long j=1;j<n+1;j++)
	        cin>>a[i][j];
	long long dp[(1<<n)]={0};
	long long t,d,k,d2;
	for(long long i=0;i<(1<<n);i++){
	    t=i;
	    while(t){
	        d=log2(t & -t) + 1;
	        t-=(t&-t);
	        k=t;
	        while(k){
	            d2=log2(k & -k) + 1;
	            k-=(k&-k);
	            dp[i]+=a[d][d2];
	            
	        }
	    }
	    for(long long j=i;j;j=(j-1)&i){
	        dp[i]=max(dp[i],dp[j]+dp[i-j]);
	    }
	}cout<<dp[(1<<n)-1];
}


Measured memory_bytes: 768
#include<iostream>
#include<cmath>
using namespace std;
int main(){
        int n;
        int r=0;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        for(int i=0;i<n;i++){
                int j=2;
                for(;j*j<=a[i];j++){
                        if(a[i]%j==0) break;
                }
                if(j*j>a[i]) r++;
        }
        cout<<r<<endl;
        return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ios>
#include <iomanip>
#include <bitset>
#include <cstdlib>

#define INF 200000000
#define MOD 1000000007
//#define int long long int
#define ll long long int
#define _tilde_ ~

using namespace std;

int main()
{

    string s;
    cin >> s;

    ll sum = 0;
    ll len = s.length();

    //今回はbitsで各桁について足し算見送りか，足し算かを判断させる
    //例えば１２３４入力の時，bitsが1001なら，１→ 加える，２見送り，３見送り，４→加える（234を足す）
    //この時必ず最後の桁では１である必要がある（どんな分け方でも必ず最後で足し算の処理が入るため）
    for(ll bits = 1 << (len - 1); bits < (1 << len) ; bits++)
    {
        //cout << bitset<8>(bits) << endl;
        ll tmp = 0;
        for(ll left = 0 ,right = 0 ; right <= len;right++)
        {
            //cout << left << right << endl;
            if(bits & (1 << right)){
                //cout << "sum : " << s.substr(left,right - left + 1) << endl;
                tmp += stoll(s.substr(left,right - left + 1)); // 第２引数が取り出す長さなので0であってはならない→１を足す
                left = right + 1; //right自体はすでに取り出し済みなので，新しい左端の更新値は，取り出し済みの右端に＋１した値
            }
        }
        //cout << endl;
        sum += tmp;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char *argv[]){
  int h;
  int w;
  char isrd = 1;
  char mon1[10000];
  char mon2[10000];
  char mon3[10000];
  char tla[10];
  int i = 0,j=0,k=0,l=0;
  int goukei=0;
  long loopc=0;
  long lc=0;
  long a[10000],b[10000];
  long apoint=0,bpoint=0;
  
  scanf("%s",mon1);
  scanf("%s",mon2);
  scanf("%s",mon3);
  printf("%c%c%c",mon1[0],mon2[0],mon3[0]);
  
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s,t;
    cin >> s >> t;
    int cnt = 0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]!=t[i])cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3916
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long

int digsum(int n){
    int res = 0;
    while(n > 0){
        res ++;
        n /= 10;
    }
    return res;
}


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n; cin >> n;

    int ans = 0;
    for(int i = 1;i <= n;i ++){
        if(digsum(i) % 2 == 1) ans ++;
    }

    cout << ans << endl;
}







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

template<class T>
std::vector<T> read_vector(const uint64_t n) {
    auto v = std::vector<T>();
    v.reserve(n);

    for(uint64_t i = 0; i < n; ++i) {
        T t;
        std::cin >> t;
        v.push_back(t);
    }

    return v;
}

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

    const auto as = read_vector<uint64_t>(n);

    int sign = 1;

    int64_t x = 0;

    for(const auto a: as) {
        x += a * sign;
        sign *= -1;
    }

    std::cout << x << " ";

    for(int i = 0; i < n - 1; ++i) {
        x = 2 * as[i] - x;
        std::cout << x << " ";
    }

    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
const long long MAX = 101, INF = 1e9;

long long n, M[MAX][MAX];

void init(){
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            M[i][j] = INF;
        }
    }
}
int main(){
    int e, ans = 0;
    cin >> n >> e;
    init();
    vector<pair<int, pair<int, int>>> v;
    for (int i = 0; i < e; i++)
    {
        int s, t, u;
        cin >> s >> t >> u;
        M[s][t] = M[t][s] = u;
        v.push_back(make_pair(s, make_pair(t, u)));
    }
    for (int i = 1; i <= n; i++)
        M[i][i] = 0;
    for (int k = 1; k <= n; k++)
    {
        for (int i = 1; i <= n; i++)
        {
            if (M[i][k] == INF)continue;
            for (int j = 1; j <= n; j++)
            {
                if (M[k][j] == INF) continue;
                M[i][j] = min(M[i][j], M[i][k] + M[k][j]);
            }
        }
    }
    for (auto x : v){
        ans += (M[x.first][x.second.first] != x.second.second) ? 1 : 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
//*************************************JAI SAI RAM*************************************//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
ll mat[3000001],vis[3000001],parent[1000001],ranks[1000001];
ll P=998244353;
vector<pair<ll,ll>> path={{1,0},{0,1},{-1,0},{0,-1}};
ll find(ll x)
{
    if(parent[x]==x)
    return x;
    return parent[x]=find(parent[x]);
}
void unions(ll x,ll y)
{
    ll xp=find(x);
    ll yp=find(y);
    if(xp!=yp)
    {
        if(ranks[xp]>ranks[yp])
        parent[yp]=xp;
        else 
        {
            parent[xp]=yp;
            if(ranks[xp]==ranks[yp])
            ranks[yp]++;
        }
    }
}
vector<ll> adj[1000001];
void solve()
{
    ll i,j,k,l,m,n,o,r,p,q,ss,c;
    ll ans=0;
  //  cout<<ans<<endl;
    string s[1011];
    cin>>n>>m>>p;
    map<ll,ll> row,col;
    map<pair<ll,ll>,ll> mp;
    memset(mat,0,sizeof(mat));
    set<ll> ro,co;

    for(i=0;i<p;i++)
    {
        cin>>j>>k;
        row[j]++;
        col[k]++;
        mp[{j,k}]++;
    }
     ans=0;
    r=0;
    for(i=1;i<=n;i++)
    {
       r=max(r,row[i]); 
    }
    c=0;
    for(i=1;i<=m;i++)
    c=max(c,col[i]);
    for(i=1;i<=n;i++)
    {
        if(row[i]==r)
        ro.insert(i);
    }
    for(i=1;i<=m;i++)
    if(col[i]==c)
    co.insert(i);
    ans=(r+c-1);

    ll flag=0;
    for(auto x:ro)
    {
        for(auto y:co)
        {
            if(mp[{x,y}]==0)
            {
                ans++;
                flag=1;
                break;
            }
        }
        if(flag)
        break;
    }
    cout<<ans<<endl;
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);
     ll t=1;
   // cin>>t;
    ll o=1;
    while(t--)
    {

        solve();
        o++;
    }
     return 0;
}












































//manpreet.singh orz
//humane orz
//arnavvats orz
//leoamish300 orz
//cipher76 orz
//aug16arpit orz
//aayushindwan orz
//ig_monkey orz
//DeadlyCritic orz
//lucky_21 orz
//sak23 orz
//spookywooky orz
//supahotfire orz
//__FAILURE_orz
//Errichto orz
//tourist orz
//Um_nik orz
//300iq orz
//antontrygub_Oo orz
//boboniu orz
//MikeMirzayanov orz
//MiFaFaOvO orz
// Benq orz
//Radewoosh orz
//AshishGup orz
//Ashishchup orz
//aryanc403 orz
//ma_da_fa_ka orz
// Striver_79 orz
//Love babbar orz
// My Life of ultimate patience and hard work orz!!!!!!!


Measured memory_bytes: 134912
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define int long long
using namespace std;
int n;
pair<int, int>p[60];
int a, b;
int f() {
	int r = 0;
	map<pair<int, int>, bool>m;
	for (int i = 0; i < n; i++) {
		m[p[i]] = 1;
		if (!m[make_pair(p[i].first - a, p[i].second - b)])r++;
	}
	return r;
}
signed main() {
	cin >> n; for (int i = 0; i < n; i++)cin >> p[i].first >> p[i].second; sort(p, p + n);
	int ans = n;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			a = p[j].first - p[i].first;
			b = p[j].second - p[i].second;
			ans = min(ans, f());
		}
	}
	cout << ans << endl;
	cin >> n;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	x := makeAnsArray()
	for i := 1; i <= n; i++ {
		fmt.Println(x[i])
	}
}

func makeAnsArray() map[int]int {
	x := make(map[int]int, 2000000)
	for i := 1; i < 100; i++ {
		for j := 1; j < 100; j++ {
			for k := 1; k < 200 - i - j; k++ {
				x[(i + j + k) * (i + j + k) - i * j - j * k - i * k] += 1
			}
		}
	}

	return x
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> s(n, 0);
  rep(i,k) {
    int d;
    cin >> d;
    rep(j,d) {
      int a;
      cin >> a;
      a--;
      s[a] = 1;
    }
  }
  int sum = 0;
  rep(i,n) {
    if (s[i] == 0) sum++;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3620
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 

X=II()

for i in range(0, 1000):
    for j in range(-1000, 1000):
        if i**5-j**5==X:
            print(i,j)
            exit()

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

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if(A==B&&B==C){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
return 0;}
/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256