akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char x,y;
    cin>>x>>y;
    if(x=='A'&&y=='A')cout<<"=";
    if(x=='A'&&y=='B')cout<<"<";
    if(x=='A'&&y=='C')cout<<"<";
    if(x=='A'&&y=='D')cout<<"<";
    if(x=='A'&&y=='E')cout<<"<";
    if(x=='A'&&y=='F')cout<<"<";
    if(x=='B'&&y=='A')cout<<">";
    if(x=='B'&&y=='B')cout<<"=";
    if(x=='B'&&y=='C')cout<<"<";
    if(x=='B'&&y=='D')cout<<"<";
    if(x=='B'&&y=='E')cout<<"<";
    if(x=='B'&&y=='F')cout<<"<";
    if(x=='C'&&y=='A')cout<<">";
    if(x=='C'&&y=='B')cout<<">";
    if(x=='C'&&y=='C')cout<<"=";
    if(x=='C'&&y=='D')cout<<"<";
    if(x=='C'&&y=='E')cout<<"<";
    if(x=='C'&&y=='F')cout<<"<";
    if(x=='D'&&y=='A')cout<<">";
    if(x=='D'&&y=='B')cout<<">";
    if(x=='D'&&y=='C')cout<<">";
    if(x=='D'&&y=='D')cout<<"=";
    if(x=='D'&&y=='E')cout<<"<";
    if(x=='D'&&y=='F')cout<<"<";
    if(x=='E'&&y=='A')cout<<">";
    if(x=='E'&&y=='B')cout<<">";
    if(x=='E'&&y=='C')cout<<">";
    if(x=='E'&&y=='D')cout<<">";
    if(x=='E'&&y=='E')cout<<"=";
    if(x=='E'&&y=='F')cout<<"<";
    if(x=='F'&&y=='A')cout<<">";
    if(x=='F'&&y=='B')cout<<">";
    if(x=='F'&&y=='C')cout<<">";
    if(x=='F'&&y=='D')cout<<">";
    if(x=='F'&&y=='E')cout<<">";
    if(x=='F'&&y=='F')cout<<"=";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n; cin >> n;
    long long int L[101];
    L[0] = 2;
    L[1] = 1;
    for (int i = 2; i <= n; i++) {
        L[i] = L[i - 1] + L[i - 2];
    }
    
    cout << L[n] << endl;

    return 0;
}

Measured memory_bytes: 888
DIV = 1_000_000_007
n = gets.to_i
l = n.times.map{ gets.chomp }
l.delete('-')
s = l.size
u = l.count('U')
d = l.count('D')
pos_u = [0]*s
pos_d = [-d]*s
l.each_with_index do |str, i|
  if str == 'U' then (i+1...s).each{ |j| pos_u[j]+= 1 }
  else               (0...i).each{   |j| pos_d[j]+= 1 }
  end
end
dp = (s+1).times.map{ [0]*(s+1) }
dp[0][0] = 1
for i in (1..s)
  for j in (0..i)
    dp[i][j] = dp[i-1][j-1]*(pos_u[i-1]-(j-1)) if j > 0
    dp[i][j] += dp[i-1][j]*(pos_d[i-1]-(j-i)) if j < i
    dp[i][j] %= DIV
  end
end
p dp[s][u]

Measured memory_bytes: 8968
N = int(input())
lst = [int(x) for x in input().split()]
dct = {}
for x in lst:
    n = dct.get(x, 0) + 1
    dct[x] = n

lst = []
for k, v in sorted(dct.items(), reverse=True):
    if v <= 1:
        continue
    lst.append(k)
    if len(lst) == 1 and v // 2 >= 2:
        lst.append(k)
    if len(lst) == 2:
        print(lst[0] * lst[1])
        exit()
print(0)


Measured memory_bytes: 21128
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[123456], uiop[123456];
signed main() {
	int n, k, a, ans = 10000000000000000; cin >> n >> k;
	for (int h = 0; h < n; h++) {
		cin >> a; test[h] = a;
	}
	for (int h = 0; h < n - k + 1; h++) {
		ans = min(ans, test[h + k - 1] - test[h] + min(abs(test[h + k - 1]), abs(test[h])));
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
let inline scan () = System.Console.ReadLine()
let inline split (s: string) = s.Split(' ')

let n = scan () |> int
let (d, x) = scan () |> split |> (fun x -> (int x.[0], int x.[1]))
  
[ for i in 1 .. n do
    let a_i = scan () |> int
    yield (d - 1) / a_i + 1
] |> Seq.sum |> ((+) x) |> printfn "%i"



Measured memory_bytes: 14044
#include <iostream>
using namespace std;
int main(){

string s;
    s= "Sunny""Cloudy""Rainy";
    cin >> s;
    if (s=="Sunny") {cout << "Cloudy";}
    else if (s=="Cloudy") {cout << "Rainy";}
    else if (s=="Rainy") {cout << "Sunny";}}

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

queue < pair<string,int> > que;

int main()
{
    int n,q,t;
    scanf("%d%d",&n,&q);
    string name;
    for(int i=1; i<=n; i++)
    {
        cin >> name >> t;
        que.push(make_pair(name,t));
    }
    int sumt=0;
    pair <string,int> u;
    while(!que.empty())
    {
        u=que.front();
        que.pop();
        int temp=min(u.second,q);
        u.second-=temp;
        sumt+=temp;
        if(u.second>0)
            que.push(u);
        else
            cout << u.first << " " << sumt << endl;
    }
    return 0;
}

Measured memory_bytes: 6280
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int N,M,ans,a,b,c,i,j,k;
char S[100];

int main()
{
  cin>>S;
  
  N=strlen(S);
  ans=1;
  for(i=0;i<N;i++)
  {
    if(S[i]!=S[N-1-i])
    {
      ans=0;
    }
  }
  
  for(i=0;i<(N-1)/2;i++)
  {
    if(S[i]!=S[(N-1)/2-1-i])
    {
      ans=0;
    }
  }
  
    for(i=(N+1)/2;i<N;i++)
  {
    if(S[i]!=S[N+(N+1)/2-1-i])
    {
      ans=0;
    }
  }
  
  if(ans==1)
  {
    cout <<"Yes";
  }
  else
  {
    cout <<"No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
using namespace std;

//  
int main(){
    int k; cin>> k;
    string s; cin >> s;
    int l = s.length();
    if(k >= l) cout<< s << "\n";
    else{
        s.erase(k);
        s = s + "...";
        cout << s << "\n";
    }
    
}


Measured memory_bytes: 3628
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D

// g++ -std=c++11 file_name.cpp
// ./file_name.out
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
//#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define YES printf("YES\n") ;
#define NO printf("NO\n") ;
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((ll) a.size())
typedef long long ll ;
const int MAXN = 1e6 + 10;
ll inf  = 1e18 ;
using namespace std ;
ll mod = 1e9 + 7;
ll mul(ll a , ll b){return ((a%mod)*(b%mod))%mod;}
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a) ;}
ll powr(ll a , ll b) {if(b == 0) return 1LL ;ll x = powr(a,b/2) ;x = mul(x,x) ;if(b%2) return mul(a,x);return x;}
int main () {
    
    int N ;
    cin >> N ;
    ll a[N] ;
    for(int i = 0 ; i < N ;i++)
        cin >> a[i] ;
    ll f[N] , b[N] ;
    f[0] = a[0] ;
    for(int i = 1 ; i < N ;i++)
        f[i] = max(f[i-1] , a[i]) ;
    b[N - 1] = a[N - 1] ;
    for(int i = N - 2 ; i >= 0 ;i--)
        b[i] = max(b[i + 1] , a[i]) ;
    cout<<b[1]<<endl;
    for(int i = 1 ; i < N - 1; i++)
        cout<<max(f[i - 1] , b[i + 1])<<endl;
    cout<<f[N - 2]<<endl;
    
    return 0 ;
}


Measured memory_bytes: 7808
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../../../bits/stdc++.h"
#endif

#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define REP(i,n) FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))

using namespace std;

typedef pair<int, int> P;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

bool f[200000];
bool s[200000];


int main(){
  cin.tie(0);

  int N, M;
  cin>>N>>M;

  REP(i, M) {
    int a, b;
    cin>>a>>b;
    if(a==1)f[b-1] = true;
    if(b==N)s[a-1] = true;
  }
  
  bool r = false;

  REP(i, N-1) {
    if(f[i] && s[i])r = true;
  }

  if(r)cout<<"POSSIBLE"<<endl;
  else cout<<"IMPOSSIBLE"<<endl;

  return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int res = 0;
		String str = sc.next();
		int[] N = new int[str.length()];

		for(int i = 0;i<str.length();i++) {
			N[i]=str.charAt(i)-'0';
			//System.out.println(N[i]);
		}
		for(int n = 0;n<str.length()-1;n++) {
			if(N[n]==N[n+1]&&N[n+1]==0) {
				N[n+1]=1;
				res++;
			}else if(N[n]==N[n+1]&&N[n+1]==1) {
				N[n+1]=0;
				res++;
			}
		}

		System.out.println(res);
	}
}

Measured memory_bytes: 26964
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String[] A = new String[3];
        for(int i=0;i<3;i++){
            A[i] = sc.next();
            sb.append(A[i].charAt(i));
        }
        String ans = sb.toString();
        

        System.out.println(ans);
    }
}


Measured memory_bytes: 19924
s = ["+","-"]
t = input()
for i in range(2**3):
    a = ""
    for j in range(3):
        a +=s[i>>j&1]

    ans = t[0]+a[0]+t[1]+a[1]+t[2]+a[2]+t[3]
    if eval(ans) == 7:
        print(ans + "=7")
        exit()

Measured memory_bytes: 3060
import java.util.*;

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

    int r = sc.nextInt();
    int D = sc.nextInt();
    int x = sc.nextInt();

    for (int i = 0; i < 10 ; i++ ) {
      int result = r * x - D;
      System.out.println(result);

      x = result;
    }
  }
}


Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
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;
}
const long long INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    string s,t,u = "";
    cin >> s >> t;
    for(int i = 0; i < n; i++) {
        u += s[i];
        u += t[i];
    }
    cout << u;
    return 0;
}



Measured memory_bytes: 256
let rec divList (i : int) (arr : int []) =
  Array.map (fun x -> if x%2=0 then true else false) arr
  |> Array.reduce (&&)
  |> function
      | true -> divList (i+1) (Array.map (fun x -> x/2) arr)
      | false -> i

let N = stdin.ReadLine()

stdin.ReadLine().Split(' ')
|> Array.map int
|> divList 0
|> printfn "%d"

Measured memory_bytes: 11996
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
 string S;
cin>>N;
  
   int x=0;
  for(int i=0;i<N;i++){
  cin>>S;
   if(S=="Y"){
      x=1;
  }
    else{
    continue;
    }
 }
  
  
  if(x==0){
  cout<<"Three";
  }
  else{
  cout<<"Four";
  }
}

Measured memory_bytes: 256
s=input()
q=int(input())
l=""
r=""
flg=True

for i in range(q):
    p=list(map(str,input().split()))
    if p[0]=="1":
        flg=not flg
    else:
        z,f,c=p
        if f=="1":
            if flg:
                l=c+l
            else:
                r=r+c
        else:
            if not flg:
                l=c+l
            else:
                r=r+c
s=l+s+r

if flg:
    ans=s
else:
    ans=s[::-1]
print(ans)

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

int main() {
    
  int a;
  string s;
  cin >> a >> s;
    if(a==3200)
      cout << s << endl;
  if(a>3200)
    cout << s << endl;
  if(a<3200)
    cout << "red" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

struct arm{
    ll min, max;
};
bool cmp_max(const arm &x, const arm &y){
    return x.max <= y.max;
}

int main(){
    int n;
    cin >> n;
    vector<arm> Arm;
    for(int i=0;i<n;i++){
        ll x, l;
        cin >> x >> l;
        arm a;
        a.min = x - l;
        a.max = x + l;
        Arm.push_back(a);
    }
    sort(Arm.begin(), Arm.end(), cmp_max);
    int ans = 1;
    ll max = Arm[0].max;
    for(int i=1;i<n;i++){
        if(max <= Arm[i].min){
            ans++;
            max = Arm[i].max;
        }
    }

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

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

int main(){
int N;
cin>>N;
string S;
int AB=0,A=0,B=0,C=0;
int l;
bool flag;
for(int i=0;i<N;i++){
cin>>S;
l=S.size();
flag = false;
for(int j=1;j<l;j++){
if(S[j-1]=='A' && S[j] == 'B') AB++;
if(S[j] == 'A') flag == true;
else flag = false;
}
if(S[0] == 'B' && S[l-1] == 'A') C++;
else if(S[0] == 'B') B++;
else if(S[l-1] == 'A') A++;
}
//cout << A << "  " << B <<"  "<< C << "  "<< AB << endl;
if(C == 0){
cout<<AB+min(A,B)<< endl;
return 0;
}
if(A == 0 && B == 0){
cout << AB+C-1 << endl;
return 0;
}
if(A == 0 || B == 0){
cout << AB+C << endl;
return 0;
}
AB += C+1;
A--;
B--;
C = 0;
cout << AB+min(A,B) << endl;
}


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 - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 1000010
using namespace std;

void sort2vectors(deque<ll> &av, deque<ll> &bv){
   ll n = av.size();
   deque<ll> p(n), av2(n), bv2(n);
   iota(p.begin(), p.end(), 0);
   sort(p.begin(), p.end(), [&](ll a, ll b) { return av[a] < av[b]; });
   for (ll i = 0; i < n; i++) {
       av2[i] = av[p[i]];
       bv2[i] = bv[p[i]];
   }
   av = av2;
   bv = bv2;
}

int main(){
  ll n;
  cin >> n;
  deque<ll> x(n),l(n);
  REP(i,n) cin >> x[i] >> l[i];
  deque<ll> a(n) ,b(n);
  REP(i,n){
    a[i] = x[i] - l[i];
    b[i] = x[i] + l[i];
  }
  
  sort2vectors(a,b);

  ll ans = 0;
  REP(i,n-1){
    if(b[0] <= a[1]){ //アクセスはO(1)
      a.pop_front(); //vectorは最後の要素以外O(n)のゴミ
      b.pop_front();
    }
    else if(b[0] < b[1]){
      int tmp = a.front();
      a.pop_front();
      a.pop_front();
      a.push_front(tmp);
      tmp = b.front();
      b.pop_front();
      b.pop_front();
      b.push_front(tmp);
      ans++;
    }
    else{
      a.pop_front();
      b.pop_front();
      ans++;
    }
  }
  
  cout << n-ans;
  
  return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  if (S.at(1) == 'B') {
    cout << "ARC" << endl;
  }
  
  if (S.at(1) == 'R') {
    cout << "ABC" << endl;
  }
  
}

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

using namespace std;

const int N = 100101;

int main() {
	int n, m; cin >> n >> m;
	if(n > m) {
		for(int i = 0; i < n; ++i) {
			cout << m;
		}
		cout << endl;
	}else {
		for(int i = 0; i < m; ++i) {
			cout << n;
		}
		cout << endl;
	}
}


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

int main() {
	int n;
	while (cin >> n, n) {
		int t[16][17];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n + 1; j++) {
				cin >> t[i][j];
			}
		}
		int dp[1 << 16];
		dp[0] = 0;
		for (int i = 1; i < 1 << n; i++) {
			dp[i] = 1000000000;
			for (int j = 0; j < n; j++) {
				if (i & 1 << j) {
					dp[i] = min(dp[i], dp[i ^ 1 << j] + t[j][0]);
					for (int k = 0; k < n; k++) {
						if ((i ^ 1 << j) & 1 << k) {
							dp[i] = min(dp[i], dp[i ^ 1 << j] + t[j][k + 1]);
						}
					}
				}
			}
		}
		cout << dp[(1 << n) - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3280
char a[100],b[100];i;
main(f)
{
	gets(a);gets(b);
	if(strlen(a)!=strlen(b))
	{
		puts(strlen(a)<strlen(b)?"LESS":"GREATER");
	}
	else
	{
		for(;i<strlen(a)&&f;i++)
		{
			if(a[i]!=b[i])
			{
				puts(a[i]<b[i]?"LESS":"GREATER");
				f=0;
			}
		}
		f&&puts("EQUAL");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

int d[55][55];

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

signed main() {
  INIT;
	VAR(int, H, W);
	vector< string > s(H);
	REP(hi, H) {
		cin >> s[hi];
	}

	REP(hi, H) REP(wi, W) d[hi][wi] = INF;
	
	queue< PAIR > q;
	q.push({0, 0});
	d[0][0] = 0;

	while (!q.empty()) {
		int fx, fy;
		tie(fy, fx)= q.front(); q.pop();

		REP(i, 4) {
			int nx = fx + dx[i];
			int ny = fy + dy[i];

			if (!(0 <= nx && nx < W &&
						0 <= ny && ny < H) || s[ny][nx] == '#') continue;
			
			if (d[ny][nx] > d[fy][fx] + 1) {
				
				d[ny][nx] = d[fy][fx] + 1;
				q.push({ny, nx});
			}
		}
		
	}
	
	if (d[H - 1][W - 1] == INF) {
		OUT(-1)BR;
		return 0;
	}
	
	
	int ans = H * W - d[H - 1][W - 1] - 1;
	REP(hi, H) {
		REP(wi, W) {
			// OUT(d[hi][wi])SP;
			if (s[hi][wi] == '#') ans--;
		}
		// BR;
	}
	OUT(ans)BR;
	
	
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int n, r;
  cin >> n >> r;
  if(n>=10) cout << r << endl;
  else cout << r+100*(10-n) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <atcoder/dsu>
using namespace std;
using ll = long long;

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

    int n, q;
    cin >> n >> q;

    atcoder::dsu dsu(n);

    while (q--) {
        int t, u, v;
        cin >> t >> u >> v;

        if (t == 0) {
            dsu.merge(u, v);
        } else {
            cout << dsu.same(u, v) << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 3820
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N;
    cin >> N;
    string S;
    cin >> S;

    int left_cost[N];
    int right_cost[N];
    int first = 0;
    FOR(i,1,N)
    {
        if(S[i] == 'E') first++;
    }
    right_cost[0] = first;
    left_cost[0] = 0;

    FOR(i,1,N)
    {
        if(S[i] == 'E')
        {
            right_cost[i] = right_cost[i-1] - 1;
        }
        else
        {
            right_cost[i] = right_cost[i-1];
        }

        if(S[i-1] == 'W') left_cost[i] = left_cost[i-1] + 1;
        else left_cost[i] = left_cost[i-1];

    }
    int total_cost[N];
    int min = MOD;
    REP(i,N)
    {
        total_cost[i] = left_cost[i] + right_cost[i];
        if(total_cost[i] < min) min = total_cost[i];
    }

    cout << min << endl;
}


Measured memory_bytes: 4244
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int a,b;
    scanf("%d%d", &a,&b);

    if((abs(a-b))%2) {
        printf("IMPOSSIBLE\n");
    }
    else {
        printf("%d\n", (a+b)/2);
    }


    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
  int i,cost,num,totalcost=0,cnt=0;
  int avenum=0;
  char comma;

  while( scanf("%d,%d" , &cost, &num) != EOF ){
    cnt++;

    avenum += num;
    totalcost += cost*num;

  }
  printf("%d\n%d\n",totalcost ,(int)((double)avenum/(double)cnt+0.5));
  return 0;
}

Measured memory_bytes: 592
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int a = 0;
    int b = 0;
 
    int[] l = new int[n];
    for (int i=0; i<n; i++){
      l[i] = sc.nextInt();
    }
    for (int j=0; j<k; j++){
      for (int i=j; i<n; i++){
        if (l[j] < l[i]){
          b = l[j];
          l[j] = l[i];
          l[i] = b;
        }
      }
      a += l[j];
    }
    System.out.println(a);
  }
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

map<ll, ll> mp;

int main()
{
    int n;
    cin>>n;
    VLL a(n);
    ll all = 0;
    REP(i,n) {
        cin>>a[i];
        all ^= a[i];
    }

    REP(i,n) {
        cout<<(a[i] ^ all);
        if (i != n-1) cout<<" ";
    }
    newline;

    return 0;
}


Measured memory_bytes: 4744
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a) distance((v).begin(),upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a) distance((v).begin(),lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
#define MOD 1000000007

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int n,k;
  cin>>n>>k;
  vi h(n);
  cin>>h;
  rep(i,k) h.pb(0);
  vi dp(n+k,INF);
  dp[0] = 0;
  rep(i,n){
    srep(j,1,k+1)
      chmin(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
  }

  cout<<dp[n-1]<<endl;
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 1024
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

// 0-indexed
template <class T, class Op = T (*) (T, T)>
struct Segtree {
  int n;
  vector<T> dat;
  Op op;
  T unit;
  Segtree(int al, Op op = Op(), T unit = T()): op(op), unit(unit) {
    n = 1;
    while(n < al) {
      n *= 2;
    }
    dat = vector<T>(2 * n - 1, unit);
  }
  Segtree(const vector<T> &arr, Op op = Op(), T unit = T()): op(op), unit(unit) {
    int al = arr.size();
    n = 1;
    while(n < al) {
      n *= 2;
    }
    dat = vector<T>(2 * n - 1, unit);
    copy(arr.begin(), arr.end(), dat.begin() + n - 1);
    for(int i=n-2; i >= 0; i--) {
      dat[i] = op(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  void update(int k, T x) {
    k += n - 1;
    dat[k] = x;
    while(k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  // accumlate [a, b)
  T accum(int a, int b, int k = 0, int l = 0, int r = -1) {
    if(r < 0) r = n;
    if(r <= a || b <= l) return unit;
    if(a <= l && r <= b) return dat[k];
    T vl = accum(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = accum(a, b, k * 2 + 2, (l + r) / 2, r);
    return op(vl, vr);
  }
};

struct edge {
  int l, r;
  ll c;
  bool operator<(edge &other) {
    return r < other.r;
  }
};

constexpr ll INF = 1ll << 60;

int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<edge> es(m);
  FOR(e,es) {
    cin >> e.l >> e.r >> e.c;
    e.l--;
    e.r--;
  }
  sort(es.begin(), es.end());
  Segtree<ll> t(n, [](ll x, ll y) { return min(x, y); }, INF);
  t.update(0, 0);
  FOR(e,es) {
    ll d = t.accum(e.l, e.r);
    ll current = t.accum(e.r, e.r+1);
    t.update(e.r, min(d + e.c, current));
  }
  ll ans = t.accum(n-1, n);
  if (ans == INF) {
    ans = -1;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000; //
const ll LINF = (ll) 4000000000000000000; //
const ll MOD = (ll) 1000000007; //
const double PI = 3.1415926535898; //
const int limit = 100010;

#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep2(i,n) REP(i,1,n+1)
#define rep3(i,n) REP(i,0,n+1)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define repll(i,n) REPLL(i,0,n)
#define repll2(i,n) REPLL(i,1,n+1)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())

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

struct point {
    int x, y;
    char color;
};

bool comp(point& p1, point& p2) {
    return p1.x != p2.x ? p1.x < p2.x : p1.y < p2.y;
}

int main() {
    int n;
    cin >> n;
    point p[2 * n];

    rep(i, 2 * n) cin >> p[i].x >> p[i].y;

    rep(i, 2 * n) {
        if (i < n) p[i].color = 'r';
        else p[i].color = 'b';
    }

    sort(p, p + 2 * n, comp);

    vector<point> red;
    int ans = 0;

    rep(i, 2 * n) {
        if (p[i].color == 'r') red.push_back(p[i]);
        else {
            if (red.empty()) continue;
            int Max_y = -1;
            auto Max_itr = red.begin();
            auto itr = red.begin();
            for (auto r : red) {
                if (Max_y < r.y && r.y < p[i].y) {
                    Max_itr = itr;
                    Max_y = r.y;
                }
                itr++;
            }

            if (Max_y != -1) {
                ans++;
                red.erase(Max_itr);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    double a;
    while(cin>>a){
        if(a<=48)puts("light fly");
        else if(a<=51)puts("fly");
        else if(a<=54)puts("bantam");
        else if(a<=57)puts("feather");
        else if(a<=60)puts("light");
        else if(a<=64)puts("light welter");
        else if(a<=69)puts("welter");
        else if(a<=75)puts("light middle");
        else if(a<=81)puts("middle");
        else if(a<=91)puts("light heavy");
        else puts("heavy");
    }
    return 0;
}

Measured memory_bytes: 1180
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int n, k, x, y;
    scanf("%d%d%d%d", &n, &k, &x, &y);
    if (n >= k)
    printf("%d\n", k*x + (n - k)* y);
    else printf("%d\n", n*x);
}

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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	int n, m, k; cin >> n >> m >> k;
	rep(i, 0, n+1){
		rep(j, 0, m+1){
			if(i*m+j*n-2*i*j==k){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <string>
#include <tuple>
#include <map>

int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);

  std::set<int> x{a, b, c};
  if (x.size() == 2) {
    puts("Yes");
  } else {
    puts("No");
  }
}


Measured memory_bytes: 256
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

l = readInt()
a = l/3
print(a*a*a)

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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var ans = str[0] <= 5 ? 0 : str[0] <= 12 ? str[1] / 2 : str[1];

            Console.Write(ans);
        }
    }

    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


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

		Scanner sc = new Scanner(new InputStreamReader(System.in));
		String c = sc.next();

		if(c.equals("a") || c.equals("i")||c.equals("u")||c.equals("e")||c.equals("o")){
			System.out.println("vowel");
	    }else{
	    	System.out.println("consonant");
	    }
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    string s;
    ll N;
    cin >> N;
    set<string> st{};

    for (int i = 0;i < N;i++){
        cin >> s;
        st.insert(s);
    }

    cout << st.size() << endl;

    return 0;

}

Measured memory_bytes: 19248
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define i_inf int(1e9)
#define i_half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int max_n = i_half_inf;
ll n, c, k, t[max_n];


void solve() {
    sort(t, t + n);
    ll ans = 0, due = 0, curnum = 0;
    rep(i, n) {
        if (t[i] > due || curnum >= c) {
            ans++;
            curnum = 1;
            due = t[i] + k;
        } else {
            curnum++;
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> n >> c >> k;
    rep(i, n) cin >> t[i];
    solve();
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
sums = [0]

for i in range(N-1):
    sums.append(sums[-1] + A[i])

sums = list(reversed(sums))
A = list(reversed(A))

ans = 1
flag = True
for i in range(N):
    if sums[i] * 2 >= A[i] and flag:
        ans += 1
    else:
        flag = False

print(ans)


Measured memory_bytes: 14320
#include <stdio.h>          // printf(), putchar(), scanf()
#include <stdlib.h>         // qsort()
#include <string.h>         // strcpy()
#include <stdbool.h>

#define MAX_N 10

typedef struct rank_tbl
{
	char name[21];
	int seq;
	int score;
} rank_t;

int
cmp_func(const void *l_, const void *r_)
{
	const rank_t *l = (const rank_t*) l_;
	const rank_t *r = (const rank_t*) r_;

	if (l->score < r->score)
		return 1;

	if (l->score > r->score)
		return -1;

	if (l->seq < r->seq)
		return -1;

	if (l->seq > r->seq)
		return 1;

	return 0;
}

int
main(int argc, char **argv)
{
	rank_t rank[MAX_N];

	bool f = false;
	while (true)
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
			break;

		for (int i = 0; i < n; ++i)
		{
			char name[21];
			int w, d;
			scanf("%s %d%*d%d", name, &w, &d);

			rank[i].seq = i;
			strcpy(rank[i].name, name);
			rank[i].score = 3 * w + d;
		}

		qsort(rank, n, sizeof(rank_t), cmp_func);

		if (f)
			putchar('\n');

		for (int i = 0; i < n; ++i)
			printf("%s,%d\n", rank[i].name, rank[i].score);

		f = true;
	}

	return 0;
}

Measured memory_bytes: 1740
#include <stdio.h>
#include <limits.h>
#define MAX 200000
#define INF INT_MAX
typedef long long ll;

void merge(int*, int, int, int);
void mergesort(int*, int, int);

ll answer;

int n, data[MAX];

int main(){
  int i;

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

  mergesort(data,0,n);

  printf("%lld\n" ,answer);

  return 0;
}

void merge(int data[], int left, int mid, int right){
  int n1 = mid - left, n2 = right - mid;
  int L[n1+1], R[n2+1], i, j, k;

  for(i = 0 ; i < n1 ; i++){
    L[i] = data[left + i];
  }

  for(i = 0 ; i < n2 ; i++){
    R[i] = data[mid + i];
  }

  L[n1] = R[n2] = INF;

  for(i = 0, j = 0, k = left ; k < right ; k++){
    if(i < n1 && (j == n2 || L[i] <= R[j])){
      data[k] = L[i++];
    }else{
      answer += (n1 + n2) / 2 - i;
      data[k] = R[j++];
    }
  }
}

void mergesort(int data[], int left, int right){
  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;
    mergesort(data, left, mid);
    mergesort(data, mid, right);
    merge(data, left, mid, right);
  }
}



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

using namespace std;

typedef long long ll;

int main(){
    ll x, y;
    cin >> x >> y;
    ll a, b, c;
    cin >> a >> b >> c;
    ll p[a], q[b], r[c];
    for (ll i = 0; i < a; i++)
        cin >> p[i];
    for (ll i = 0; i < b; i++)
        cin >> q[i];
    for (ll i = 0; i < c; i++)
        cin >> r[i];
    sort(p, p + a, greater<ll>());
    sort(q, q + b, greater<ll>());
    sort(r, r + c, greater<ll>());
    
    ll s1 = 0, s2 = 0;
    for (ll i = 0; i < x; i++)
        s1 += p[i];
    for (ll i = 0; i < y; i++)
        s2 += q[i];
    
    ll i = x - 1, j = y - 1, z = 0;
    while(true){
        if (i < 0 && j < 0)
            break;
        if (i < 0 || j < 0){
            ll m;
            if (i < 0){
                m = q[j];
                if (r[z] < m)
                    break;
                s2 += r[z] - q[j];
                j--;
                z++;
            }
            else{
                 m = p[i];
                if (r[z] < m)
                    break;
                s1 += r[z] - p[i];
                i--;
                z++;
            }
            
        }
        else{
            ll m = min(p[i], q[j]);
            if (r[z] <= m)
                break;
            if (p[i] < q[j]){
                s1 += r[z] - p[i];
                i--;
            }
            else{
                s2 += r[z] - q[j];
                j--;
            }
            z++;
        }
        if (z >= c)
            break;
    }
    
    cout << s1 + s2 << endl;
    return 0;
}


Measured memory_bytes: 2688
// B - Cut and Count
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, h = 0, n, w, ans = 0, count = 0;
  string s, t, u;
  vector<pair<char, lli>> pr;
  cin >> n;
  cin >> s;

  rep(i, 0, n - 1)
  {
    t = s.substr(0, i + 1);
    u = s.substr(i + 1, n - (i + 1));
    vlli d(26, 0), e(26, 0);
    rep(j, 0, t.size())
    {
      for (char c = 'a'; c <= 'z'; ++c)
      {
        if (t[j] == c)
        {
          d[count]++;
        }
        count++;
      }
      count = 0;
    }
    rep(j, 0, u.size())
    {
      for (char c = 'a'; c <= 'z'; ++c)
      {
        if (u[j] == c)
        {
          e[count]++;
        }
        count++;
      }
      count = 0;
    }

    rep(j, 0, 26)
    {
      if (d[j] >= 1 && e[j] >= 1)
      {
        ans++;
      }
    }
    h = max(h, ans);
    ans = 0;
  }
  cout << h << endl;
}

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        ArrayList<Long> A = new ArrayList<>();
        long xor = 0;
        for (var i = 0; i < N; i++) {
            long a = sc.nextLong();
            A.add(a);
            xor = xor ^ a;
        }
        for (var i = 0; i < N; i++)
            System.out.printf("%d ",xor ^ A.get(i));
    }
}

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

int main() {
  ll n, k; cin >> n >> k;
  ll z = 0;
  for(ll i = k; i <= n + 1; i++) {
    z += ((2 * n - i + 1) * i / 2) - (i * (i - 1) / 2) + 1;
    z %= 1000000007;
  }
  cout << z << endl;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	long long k,x;
	cin >> k >> x;
	for (int i=k-1;i>=0;i--)
	{
		cout << x-i << " ";
	}
	for (int i=1;i<k;i++)
	{
		cout << x+i << " ";
	}
	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ld(a) while(a--)
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define tcf(v,i) for(auto i : v)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator
#define INF 		0x3f3f3f3f
#define LLINF       1000111000111000111LL
#define PI 			3.14159265358979323
#define endl '\n'
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int N=1000006;
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<ii,vii,greater<ii> > spq;
const ll MOD=1000000007LL;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
int32_t main(){
	int a,b; cin>>a>>b;
	if(a+b>=10) cout<<"error";
	else cout<<a+b;
}



Measured memory_bytes: 256