akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const double eps = 1e-9;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  ll sum_all = 0;
  ll x = 0;
  ll y = 0;
  rep(i,n) {
    sum_all += a[i];
  }

  ll ans = INFLL;
  rep(i,n-1) {
    x += a[i];
    //y = sum_all - x;
    //ans = min(ans, abs(x-y));
    ans = min(ans, abs(sum_all-2*x));
  }

  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>

using namespace std;

void abc_150a();

void abc_151a();

void abc_152a();

void abc_154a();

void abc_156a();
void abc_157a();

int main()
{
  //abc_150a();
  //abc_151a();
  //abc_152a();
  //abc_154a();
  //abc_156a();
  abc_157a();
}

void abc_150a()
{
  int K, X;
  cin >> K >> X;

  if (500 * K >= X) cout << "Yes\n";
  else cout << "No\n";
}

void abc_151a()
{
  char C;
  cin >> C;

  cout << (char)((int)C + 1) << "\n";
}

void abc_152a()
{
  int N, M;
  cin >> N >> M;
  if (N == M) cout << "Yes\n";
  else cout << "No\n";
}

void abc_154a()
{
  string S, T;
  cin >> S >> T;
  int a, b;
  cin >> a >> b;
  string U;
  cin >> U;

  if (S == U) cout << a - 1 << " " << b << "\n";
  else cout << a << " " << b - 1 << "\n";

}


void abc_156a()
{
  int N, R;
  cin >> N >> R;

  if (N >= 10) cout << R << "\n";
  else cout << R + 100 * (10 - N) << "\n";
}

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

  if (N % 2 == 0) cout << N / 2 << "\n";
  else cout << N / 2 + 1 << "\n";
}


Measured memory_bytes: 3604
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>'50000000'},'ruby',$0);def f(i)a=H[i].map{|e|f e}.sort;r=0;a.map{|e|r=[r,e].max+1};r end;H=Hash.new{|h,k|h[k]=[]};2.upto(gets.to_i){|i|H[gets.to_i]<<i};p f 1

Measured memory_bytes: 225360
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll=long long;

const int N=5e3+10;

int main(){
    string s, t, u;
    int a, b;
    cin>>s>>t>>a>>b>>u;
    if(u==s)a--;
    else b--;
    cout<<a<<' '<<b;
}



















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  int Alice = 0, Bob = 0;
  
  rep(i, N){
    if(i%2 == 0) Alice += a[i];
    else Bob += a[i];
  }
  
  cout << Alice - Bob << endl;
}


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

#define vi vector<int>

int main() {

    int N;
    cin >> N;

    int tmp;
    vi A;
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        A.push_back(tmp);
    }

    bool flag = true;
    int count = 0;

    int minj;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) minj = j;
        }
        if (i != minj) {
            tmp = A[minj];
            A[minj] = A[i];
            A[i] = tmp;
            count++;
        }
    }

    for (int k = 0; k < N; k++) {
        cout << A[k];
        if (k != N - 1) {
            cout << " ";
        }
        else {
            cout << endl;
        }
    }

    cout << count << endl;

    return 0;
}



Measured memory_bytes: 3140
package main

import "fmt"

func main() {
	var N, T, A float64
	fmt.Scan(&N, &T, &A)

	var h float64
	min := float64(999)
	ans := 0
	for i := 0; i < int(N); i++ {
		fmt.Scan(&h)
		t := T - h*0.006
		a := A - t
		if a < 0 {
			a *= -1
		}
		if a < min {
			min = a
			ans = i + 1
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
int main(void){
  int a;
  std::vector<int> v;

  std::cin >> a;
  v.push_back(a);
  std::cin >> a;
  v.push_back(a);
  std::cin >> a;
  v.push_back(a);

  std::sort(v.begin(), v.end());

  if (v[0] == 5 && v[1] == 5 && v[2] == 7){
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

// order statistics tree
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
             tree_order_statistics_node_update> indexed_set;

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

const int N = 101;

int n;
map<string, vector<pii>> city_score_idx;

int main() {
  cin.tie(0); cin.exceptions(cin.failbit);
  scanf("%d", &n);
  rep(i, 1, n+1){
    string city;
    int score;
    cin >> city >> score;
    city_score_idx[city].PB({score, i});
  }

  trav(csi, city_score_idx){
    // sort in descending order of score
    sort(csi.S.begin(), csi.S.end(), greater<pii>());

    trav(si, csi.S){
      printf("%d\n", si.S);
    }
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		final int NUM = 100000;
		final double r = 1.05;
		int ans = NUM;
		int n = scan.nextInt();
		// 計算
		for (int i = 0; i < n; i++) {
			ans *= r;
			ans = kiriage(ans);
		}
		// output
		System.out.println(ans);
	}
	
	static int kiriage(int n) {
		int k = 0,ans = 0;
		boolean ch = false;
		int[] tmp = new int[10000];
		// 1桁ごとに分解
		for (k = 0; n != 0; k++) {
			tmp[k] = n % 10;
			n /= 10;
		}
		// 桁上がりがあるかチェック
		for (int i = 0; i < 3; i++) {
			if(tmp[i] != 0) {
				ch = true;
				tmp[i] = 0;
			}
		}
		// 桁上がりあり
		if(ch) tmp[3]++;
		// それぞれ足す
		for (int i = 0; i < k; i++) ans += tmp[i]*Math.pow(10, i);
		
		return ans;
	}
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int L, R;
  
  L = A + B;
  R = C + D;

	if( L > R) {
    cout << "Left" << endl;
    }
	else if( L == R) {
      cout << "Balanced" << endl;
    }
	else{
      cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int N; cin >> N;
  string s; cin >> s;
  char prev = '0';
  int ans = 0;
  for (char c:s) {
    if (prev != c) {
      prev = c;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
open Printf
open Scanf

let (++) = Int64.add
let (--) = Int64.sub
let lnotl = Int64.lognot
let landl = Int64.logand
let lorl = Int64.logor
let lxorl = Int64.logxor
let lsll = Int64.shift_left

let read_int _ = bscanf Scanning.stdin " %d " (fun x -> x)
let read_long _ = bscanf Scanning.stdin " %Ld " (fun x -> x)

let bit_cnt cnt v =
  let rec bit_cnt' i =
      if i >= 60
      then ()
      else
        let () = cnt.(i) <- (cnt.(i) + if landl v (lsll 1L i) <> 0L then 1 else 0) in
        bit_cnt' (i+1) in
  bit_cnt' 0

let collect n cnt =
  let rec collect' i v =
    if i >= 60
    then v
    else
      let v' = if cnt.(i)*2 < n then lorl v (lsll 1L i) else v in
      collect' (i+1) v' in
  collect' 0 0L

let msb b =
  let rec msb' c = function
    | i when i >= 60 -> c
    | i -> if landl b (lsll 1L i) <> 0L then msb' i (i+1) else msb' c (i+1) in
  msb' 0 0

let masks b m =
  let rec masks' i =
    if i > m
    then []
    else if landl b (lsll 1L i) <> 0L
    then lorl (b -- (lsll 1L i)) (lsll 1L i -- 1L) :: masks' (i+1)
    else masks' (i+1) in
  masks' 0

let () =
  let n = read_int () in
  let k = read_long () in
  let a = Array.init n read_long in
  let cnt = Array.make 60 0 in
  Array.iter (bit_cnt cnt) a;
  let x = collect n cnt in
  let m = msb k in
  let ms = masks k m in
  let calc x = Array.fold_left (fun a b -> a ++ (lxorl b x)) 0L a in
  let r = List.fold_left (fun accum mask -> max accum (calc (landl x mask))) (calc (landl k x)) ms in
  printf "%Ld\n" r


Measured memory_bytes: 6784
#include <cstdio>

template<int N, typename T, T M>
struct factorial_mod
{
	T mod[N + 1];
	T inv_mod[N + 1];

	constexpr factorial_mod() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}

	constexpr T power(T a, T b)
	{
		T r = 1;
		while (b > 0)
		{
			if ((b & 1) != 0) r = (r * a) % M;
			a = (a * a) % M;
			b >>= 1;
		}
		return r;
	}

	constexpr T comb(T n, T r)
	{
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
};


factorial_mod<200000, long long, 1000000007> facmod;

int main()
{
	long long h, w, a, b;
	scanf("%lld %lld %lld %lld", &h, &w, &a, &b);
	long long ans = 0;

	const long long c1 = h - 1 - a + b;
	const long long c2 = w - 1 - b + a;
	while (a < h && b < w)
	{
		ans = (ans + ((facmod.comb(c1, b) * facmod.comb(c2, a)) % 1000000007)) % 1000000007;
		++a; ++b;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=1000;
int n;long long Ans;
long long ans1,ans2,ans3,ans4;
struct node{int a,b;}s[MAXN+5];
bool cmp1(node A,node B){
	return A.a*1.0/A.b<B.a*1.0/B.b;
}
bool cmp2(node A,node B){
	return A.a*1.0/A.b>B.a*1.0/B.b;
}
long long h(long long x,long long y){
	if(x<y)swap(x,y);
	if(y==0)return x;
	return h(y,x%y);
}
void print(){
	puts("");
	for(int i=1;i<=n;i++)
		printf("%d %d\n",s[i].a,s[i].b);
	puts("");
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&s[i].a,&s[i].b);
		long long t=h(s[i].a,s[i].b);
		s[i].a/=t,s[i].b/=t;
	}	
	ans1=ans2=ans3=ans4=1;
	/*sort(s+1,s+n+1,cmp1);
	//print();
	for(int i=1;i<=n;i++){
		long long t=max(ans1/s[i].a,ans2/s[i].b);
		while(t*s[i].a<ans1||t*s[i].b<ans2)t++;
		ans1=t*s[i].a;ans2=t*s[i].b;
	}
	//sort(s+1,s+n+1,cmp2);
	print();*/
	for(int i=1;i<=n;i++){
		long long t=max(ans3/s[i].a,ans4/s[i].b);
		while(t*s[i].a<ans3||t*s[i].b<ans4)t++;
		ans3=t*s[i].a;ans4=t*s[i].b;
	}
	//Ans=min(ans1+ans2,ans3+ans4);
	Ans=ans3+ans4;
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 128
R, G, B, N = map(int, raw_input().strip().split())

ans = 0
for r in xrange(N + 1):
    for g in xrange(N + 1):
        cur = R * r + G * g
        if cur > N: break
        rem = N - cur
        if rem % B != 0: continue
        b = rem // B
        ans += 1

print ans

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



// last submission

typedef long long  int ll;
#define s(n) scanf("%lld",&n)
#define s2(n,m) scanf("%lld%lld",&n,&m)



int main()
{
    string s;
    cin>>s;
    int l = s.size();
    if(l==2) cout<<s<<endl;
    else
    {
        for(int i=l-1;i>=0;i--) cout<<s[i];
        cout<<endl;
    }



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,a,b;
  cin>>k>>a>>b;
  if((a/k)*k+k<=b)cout<<"OK"<<endl;
  else if(a%k==0)cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#define n 10000

int main(){
  int A[n],a,j,num,num2,count=0,i;

  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
  }
  
  scanf("%d",&num2);
  for(i=0;i<num2;i++){
    scanf("%d",&a);
    for(j=0;j<num;j++){
      if(a==A[j]){
	count++;
	break;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2104
/**                                                     **\
 *    created by:   Divianshu Bansal                     *
 *    e-mail id:    god_coder@icloud.com                 *
*                                                        */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>


using namespace std;
using namespace __gnu_pbds;


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>new_data_set;
#define MOD 1000000007
#define int long long
#define BIG 998244353
#define pf push_front
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589


int power(int x, int y) {
    int r = 1, z = x;
    while (y) {
        if (y & 1)r *= z;
        z *= z; y = y >> 1;
    }
    return r;
}
int powerm(int x, int y, int p) {
    int r = 1;
    while (y) {
        if (y & 1)r = (r * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return r % p;
}
int modinv(int x, int m) {
    return powerm(x, m - 2, m);
}
int logarithm(int a, int b) {
    int x = 0;
    while (a > 1) {
        x++;
        a /= b;
    }
    return x;
}
int max3(int a, int b, int c) {
    return max(a, max(b, c));
}
int min3(int a, int b, int c) {
    return min(a, min(b, c));
}
int32_t main() {
    fast;
    int l, r, d;
    cin >> l >> r >> d;
    cout << ((r / d) - ((l - 1) / d));
    return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

bool solve(string &st, int s, int t)
{
    vi dp(st.size(), 0);
    dp[s] = 1;
    for (int i = s; i < t; i++) {
        if (dp[i]) {
            if (in(i+1, 0, st.size()) && st[i+1] == '.') dp[i+1] = 1;
            if (in(i+2, 0, st.size()) && st[i+2] == '.') dp[i+2] = 1;
        }
    }
    //for (int i = s; i < t+1; i++) cout << dp[i] << " ";
    return dp[t];
}

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

    int3(n, a, b);
    int2(c, d);
    a--; b--; c--; d--;
    string st;
    cin >> st;
    
    if (c > d) {
        for (int i = b; i <= d; i++) {
            if (in(i-1, 0, n) && in(i+1, 0, n)) {
                if (st[i-1] == '.' && st[i] == '.' && st[i+1] == '.') {
                    b = i;
                    if (solve(st, a, i-1)) {
                        a = i+1;
                    } else {
                        std::cout << "No" << std::endl;
                    }
                    if (solve(st, a, c) && solve(st, b, d)) {
                        std::cout << "Yes" << std::endl;
                    } else {
                        std::cout << "No" << std::endl;
                    }
                    return 0;
                }
            }
        }
        std::cout << "No" << std::endl;
        return 0;
    }

    if (solve(st, b, d) && solve(st, a, c)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;


int main(){
    string s;
    cin >> s;
    int ans = 0;
    int ind =0;
    bool flag = true;
    if(s[0] == 'W') flag = false;

    while(1){
        if(s[ind] == 'B' and flag == false){
            ans +=1;
            flag = true;
        }
        else if( s[ind] == 'W' and flag == true){
            ans += 1;
            flag = false;
        }
        ind+=1;
        if(ind == s.length()) break;
    }
    cout << ans << endl;
}

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

int main(int argc, char const *argv[]) {

    int cards[4][13] = {};

    int n;
    cin >> n;

    char suit;
    int value;

    for (int i = 0; i < n; i++) {
        cin >> suit >> value;
        
        switch (suit) {
            case 'S':
                cards[0][value-1] =  1;
                break;
            case 'H':
                cards[1][value-1] =  1;
                break;
            case 'C':
                cards[2][value-1] =  1;
                break;
            case 'D':
                cards[3][value-1] =  1;
                break;
        }
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            if(cards[i][j] != 1) {
                switch (i) {
                case 0:
                    cout << "S " << j+1 << endl;
                    break;
                case 1:
                    cout << "H " << j+1 << endl;
                    break;
                case 2:
                    cout << "C " << j+1 << endl;
                    break;
                case 3:
                    cout << "D " << j+1 << endl;
                    break;
                
                }


            }
        }
    }


    return 0;
}



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

template <typename T>
struct Dinic {
  const T INF;
  struct edge {
    int to;
    T cap;
    int rev;
  };

  vector<vector<edge>> g;
  vector<int> level;
  vector<int> itr;

  Dinic (int V) : INF(numeric_limits<T>::max()) {
    g.resize(V);
  }

  void add_edge(int from, int to, T cap) {
    g[from].emplace_back((edge){to, cap, (int)g[to].size()});
    g[to].emplace_back((edge){from, 0, (int)g[from].size() - 1});
  }

  bool bfs(int s, int t) {
    level.assign(g.size(), -1);
    queue<int> que;
    level[s] = 0;
    que.push(s);
    while (!que.empty()) {
      int u = que.front(); que.pop();
      for (auto &e : g[u]) {
        if (e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[u] + 1;
          que.push(e.to);
        }
      }
    }
    return level[t] != -1;
  }

  T dfs(int u, int t, T flow) {
    if (u == t) return flow;
    for (int &i = itr[u]; i < g[u].size(); i++) {
      edge &e = g[u][i];
      if (e.cap > 0 && level[u] < level[e.to]) {
        T d = dfs(e.to, t, min(flow, e.cap));
        if (d > 0) {
          e.cap -= d;
          g[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  T max_flow(int s, int t) {
    T flow = 0;
    while (bfs(s, t)) {
      itr.assign(g.size(), 0);
      T f = 0;
      while ((f = dfs(s, t, INF)) > 0) flow += f;
    }
    return flow;
  }
};

int main(){
  int n;
  cin >> n;
  vector<P> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i].first >> b[i].second;
  }

  Dinic<int> g(2*n+2);
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i].first < b[j].first && a[i].second < b[j].second) {
        g.add_edge(i, n + j, 1);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    g.add_edge(2*n, i, 1);
    g.add_edge(i + n, 2*n+1, 1);
  }

  cout << g.max_flow(2*n, 2*n+1) << endl;
  return 0;
} 

Measured memory_bytes: 384
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    static int nMax = 8;
    static boolean[][] graph = new boolean[nMax][nMax];

    public static void main(String[] args) {
        int n = scanner.nextInt(), m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            int a = scanner.nextInt() - 1, b = scanner.nextInt() - 1;
            graph[a][b] = graph[b][a] = true;
        }
        boolean[] visited = new boolean[nMax];
        visited[0] = true;
        System.out.println(dfs(0, n, visited));
    }

    static int dfs(int v, int n, boolean[] visited) {
        boolean allVisited = true;
        for (int i = 0; i < n; i++)
            if (!visited[i])
                allVisited = false;
        if (allVisited)
            return 1;
        int ret = 0;
        for (int i = 0; i < n; i++) {
            if (graph[v][i] && !visited[i]) {
                visited[i] = true;
                ret += dfs(i, n, visited);
                visited[i] = false;
            }
        }
        return ret;
    }
}

Measured memory_bytes: 23252
#include <stdio.h>
#include<iostream>
#include<string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <map>
using namespace std;
int x[200005],y[200005];
int main() {
    int mn1 = INT_MAX, mx1 = INT_MIN, mn2=INT_MAX,mx2=INT_MIN,p=1e9;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]), mn1 = min(mn1, x[i] + y[i]), mx1 = max(mx1, x[i] + y[i]),mn2=min(mn2,p-x[i]+y[i]),mx2=max(mx2,p-x[i]+y[i]);
    cout << max(mx1-mn1,mx2-mn2)<< endl;
    return 0;
}


Measured memory_bytes: 5240
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define int long long
 main(){
  int n,k;
  cin>>n>>k;
  map<int,int>m;
  set<int>st;
  r(i,n){
    int a;
    cin>>a;
    m[a]++;
    st.insert(a);
  }
  int x=st.size();
  vector<P>v;
  for(map<int,int>::iterator it=m.begin();it!=m.end();it++){
    v.push_back(P(((*it).second),((*it).first)));
  }
  sort(v.begin(),v.end());
  int ans=0,y=0;
  while(x>k){
    ans+=v[y].first;
    y++;
    x--;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 24308
#include <stdio.h>


long long temp[100000];

void MergeSort(long long x[], long long left, long long right);


void MergeSort(long long x[], long long left, long long right)
{
	long long mid, i, j, k;

	if (left >= right)              
		return;                    

									
	mid = (left + right) / 2;      
	MergeSort(x, left, mid);        
	MergeSort(x, mid + 1, right);  

									
	for (i = left; i <= mid; i++)
		temp[i] = x[i];

	
	for (i = mid + 1, j = right; i <= right; i++, j--)
		temp[i] = x[j];

	i = left;        
	j = right;       

	for (k = left; k <= right; k++)   
		if (temp[i] <= temp[j])      
			x[k] = temp[i++];
		else
			x[k] = temp[j--];
}

int main()
{
	long long n, i, b, k;
	long long a[100000];
	long long c = 0;
	scanf("%lld", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}

	MergeSort(a, 0, n - 1);

	for (i = 0; i < n; i++) {
		if (a[i] == a[i + 1]) {
			c+=2;
			i++;
		}
	}
	printf("%lld", n - c);
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>

struct Card{
    int num;
    char suit;
};

void bubbleSort(Card *a, int n){

    int tmp;

    for(int i = n-1; i > 0; i--){
        for(int j = n-1; j > n-i-1; j--){
            if(a[j].num < a[j-1].num){
                std::swap(a[j], a[j-1]);
            }
        }
    }

    for(int c = 0; c < n; c++){
        if(c == n-1){
            std::cout << a[c].suit << a[c].num  <<std::endl;
        }else{
            std::cout << a[c].suit << a[c].num << " ";
        }
    }
}

void selectionSort(Card *a, int n){

    int min_idx;

    for(int i = 0; i < n; i++){
        min_idx = i;
        for(int j = i+1; j < n; j++){
            if(a[min_idx].num > a[j].num){
                min_idx = j;
            }
        }
        if(i != min_idx){
            std::swap(a[min_idx], a[i]);
        }
    }

    for(int c = 0; c < n; c++){
        if(c == n-1){
            std::cout << a[c].suit << a[c].num  <<std::endl;
        }else{
            std::cout << a[c].suit << a[c].num << " ";
        }
    }
    
}

bool isStable(Card *a, Card *b, int n){
    for(int i = 0; i < n; i++){
        if(a[i].suit != b[i].suit){
            return false;
        }
    }
    return true;
}

int main(){

    int n, tmp;
    std::cin >> n;

    Card a[n], b[n];

    for(int i = 0; i < n; i++){
        std::cin >> a[i].suit >> a[i].num;
    }

    for(int i = 0; i < n; i++){
        b[i] = a[i];
    }

    bubbleSort(a, n);
    std::cout << "Stable" << std::endl;

    selectionSort(b, n);
    if(isStable(a, b, n)){
        std::cout << "Stable" << std::endl;;
    }else{
        std::cout << "Not stable" << std::endl;
    }

}


Measured memory_bytes: 3088
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        long m = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        n -= 2 <= n ? 2 : 0;
        m -= 2 <= m ? 2 : 0;
        long result = n * m;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    for i in 1..6 {
        let x:usize = read();
        if x != i {
            println!("{}",i);
        }
    }
}


Measured memory_bytes: 2076
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

int main(void)
{
  ll n;
  cin >> n;
  vector<ll> a(4, 0);
  string s;
  
  for (int i=0;i<n;i++){
    cin >> s;
    if (s == "AC"){
      a[0]++;
    }else if (s == "WA"){
      a[1]++;
    }else if (s == "TLE"){
      a[2]++;
    }else {
      a[3]++;
    }
  }
  
  cout << "AC x " << a[0] << endl;
  cout << "WA x " << a[1] << endl;
  cout << "TLE x " << a[2] << endl;
  cout << "RE x " << a[3] << endl;
  
  
  return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  string s;
  cin >> s;
  REP(i, s.size()-1) {
    if (s[i] == s[i+1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int r,g,b;
    cin>>r>>g>>b;
    if((10*g+b)%4==0){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
long double calc(ll x) {
    long double prob = 1./x;
    return ((x-1)/2+1)*prob;
}
vl to[200005];
vl ans;
void dfs(int v, int p = -1) { //最初は枝0、親-1
    for(int u : to[v]) { //Uに枝全部入る
        cerr<<v<<" "<<u<<'\n';
        if(u == p) continue; //枝の先が親の時はスルー(逆走しない)
        ans[u] += ans[v];//一個上の親の保持する数字を足す
        dfs(u, v);
    }
}
int main() {
    SS(int,n,q);
    ans.resize(n);
    rep(i, n - 1) {
        SS(ll,a,b);
        --a; -- b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i, q) {
        SS(ll,p,x);
        --p;
        ans[p] += x;
    }
    dfs(0);
    rep(i, n) {
        cout << ans[i] << endl;
    }
}

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

int main() {
  
  int a,b;
  cin >> a >> b;
  
  if(a==1 || a==3 || a==5 || a==7 || a==8 || a==10 || a==12)
  {
    if(b==3 || b==5 || b==7 || b==8 || b==10 || b==12) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(a==4 || a==6 || a==9 || a==11) {
    if(b==6 || b==9 || b==11) cout << "Yes" << endl;
    else{
      cout << "No" << endl;
    }
  }
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 305;
const int mod = 1e9 + 7;

int n, m, ans, f[MAXN][MAXN][MAXN];
vector <pii> a[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	for (int i = 1, l, r, x; i <= m; i ++)
		l = Read(), r = Read(), x = Read(), a[r].pb(mp(l, x));
	f[1][0][0] = 3;
	for (int i = 1; i < n; i ++)
		for (int j = 0; j <= i; j ++)
			for (int k = 0; k <= j; k ++)
				if (f[i][j][k])
				{
					bool flg = true;
					for (auto x : a[i])
						if ((j >= x.xx) + (k >= x.xx) + 1 ^ x.yy)
							flg = false;
					if (flg)
					{
						f[i + 1][j][k] = (f[i + 1][j][k] + f[i][j][k]) % mod;
						f[i + 1][i][k] = (f[i + 1][i][k] + f[i][j][k]) % mod,
						f[i + 1][i][j] = (f[i + 1][i][j] + f[i][j][k]) % mod;
					}
					else
						f[i][j][k] = 0;
				}
	for (int i = 0; i <= n; i ++)
		for (int j = 0; j <= i; j ++)
		{
			bool flg = true;
			for (auto x : a[n])
				if ((i >= x.xx) + (j >= x.xx) + 1 ^ x.yy)
					flg = false;
			if (flg)
				ans = (ans + f[n][i][j]) % mod;
		}
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 108800
import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from numpy.linalg import norm


def main():
    N = int(input())
    points = []
    for _ in range(N):
        x, y = map(int, input().split())
        points.append([x, y])

    ans = np.zeros(N)
    try:
        hull = ConvexHull(points)
    except QhullError:
        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5
        print(*ans, sep='\n')
        return

    v = hull.vertices
    prv_v, nxt_v = np.roll(v, -1), np.roll(v, 1)
    diff_prev = hull.points[prv_v]-hull.points[v]
    diff_next = hull.points[nxt_v]-hull.points[v]
    deg = np.arccos(np.einsum("ij, ij->i", diff_prev, diff_next) /
                    norm(diff_prev, axis=1) / norm(diff_next, axis=1))
    ans[v] = (np.pi - deg) / (2 * np.pi)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 16940
using System;

namespace abc128A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = A * 3 + B;
            int D = C / 2;
            Console.WriteLine(D);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
using namespace std;
 void call(int n);

int main(){

int n,x,f[10000] = {0};
cin >> n;

for(int i = 1; i <= n; i++){
    x = i;
    if (x%3 == 0){
        cout << " " << i;
    }else {   
    while ( x != 0 ){
        if(x%10 == 3 && f[i-1] == 0){
            cout << " " << i; 
            f[i-1] = 1;
        }
        x /= 10;
    }
    }
}
cout << endl;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (b/a < c) cout << b/a << endl;
  else cout << c << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	string s;
  	string t;
  	string u;
  	int a;
  	int b;
  
	cin >> s >> t;
    cin >> a >> b;
  	cin >> u;
  
 	if (s==u){
		a--;
	}else{
    	b--;
    }
	cout << a << " " << b;
	return 0;
}



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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
char S[30];
ll Sn;

ll i, j, k;
int main(){
    scanf("%s", S);
    Sn = strlen(S);
    fornum(i,0,Sn){
        fornum(j,i+1,Sn){
            if(S[i]==S[j]){
                printf("no\n");
                return 0;
            }
        }
    }
    printf("yes\n");

    return 0;
}

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

int main(void) {
  int n, m;
  cin >> n >> m;

  int A[100][100] = {};
  int B[100] = {};

  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }

  for(int i = 0; i < m; i++) {
    cin >> B[i];
  }

  int sum;
  for(int i = 0; i < n; i++) {
    sum = 0;
    for(int j = 0; j < m; j++) {
      sum += A[i][j] * B [j];
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 3132
s = input()

count = 0
max_count = 0
for c in s:
    if c in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0

if count > max_count:
    max_count = count
    
print(max_count)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main() {
	
	string str;
	int q,a,b;
	cin >> str>>q;
	string com;
	for (int i = 0;i < q;i++) {
		cin >> com >> a >> b;
		if (com == "replace") { cin >> com;
			for (int j = a;j < b + 1;j++) {
				str[j] = com[j-a];
			}
			
		}
		if (com == "reverse") {
			com = str;
			for (int j = a;j < b + 1;j++) {
				str[j] = com[b-(j-a)];
			}
		}
		if (com == "print") {
			for (int j = a;j < b + 1;j++) {
				cout << str[j];
			}cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3172
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#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++)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	retur5n a * (b / g);
}*/

int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

int main() {
	int n;
	VI c = { 0,0,0,0,0,0,1,1,1,2 };
	VI d = { 1,1,1,2,2,3,2,2,3,3 };
	VI f = { 2,3,4,3,4,4,3,4,4,4 };
	cin >> n;
	VS s(n);
	rep(i, n) cin >> s[i];

	vector<ll> a(5);
	rep(i, n) {
		if (s[i][0] == 'M') a[0]++;
		else if (s[i][0] == 'A') a[1]++;
		else if (s[i][0] == 'R') a[2]++;
		else if (s[i][0] == 'C') a[3]++;
		else if (s[i][0] == 'H') a[4]++;
	}
	//rep(i, 5) cout << a[i];
	ll ans = 0;
	for (int i = 0; i < 10; i++) {
		ans += a[c[i]] * a[d[i]] * a[f[i]];
	}
	cout << ans << endl;

}

Measured memory_bytes: 6144
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int a,b,c,d,e,f;
bool visitsuger[3010],visitwater[3010];

int main()
{
    double ans=0;
    int answater=0,anssugar=0;
    cin>>a>>b>>c>>d>>e>>f;
    a*=100;b*=100;
    for(int i=1;i<=f;i++)
    {
        int temp=i;
        if(temp%a==0) {visitwater[i]=true;}
        else
        while(temp>0)
        {
            if(temp%b==0) {visitwater[i]=true;}
            temp-=a;
        }
        temp=i;
        if(temp%c==0) {visitsuger[i]=true;}
        else
        while(temp>0)
        {
            if(temp%d==0) {visitsuger[i]=true;}
            temp-=c;
        }
    }

    for(int i=100;i<=f;i+=100)
    {if(visitwater[i])
        for(int j=min(i/100*e,f-i);j>=1;j--)
            {
                if(visitsuger[j]){
                    double temp;
                    temp=(double)j/(i+j);
                    if(ans<temp)
                    {
                        answater=i;anssugar=j;ans=temp;
                    }
                }
            }
    }
    if(ans!=0)
    cout<<answater+anssugar<<' '<<anssugar;
    else cout<<a<<' '<<0;
    return 0;
}


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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
#define int long long

signed main(){
    int n; cin >> n;
    set<int> s;
    rep(i,n){
        int d; cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 256
def main():
    O = list(input())
    E = list(input())

    ans = []

    for i in range(len(O) - 1):
        ans.append(O[i])
        ans.append(E[i])

    ans.append(O[-1])

    if len(O) == len(E):
        ans.append(E[-1])

    print("".join(ans))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
def main():
    n=int(input())
    s=input()
    a=0
    b=0
    for i in range(n):
        if(s[i]=='R'):
            a+=1
        else:
            b+=1
    if(a>b):
        print("Yes")
    else:
        print("No")
if __name__=="__main__":
    main()

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

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n,s1,s2,k,mini;
  cin>>n;
  int a[n];
  for (int i = 0; i < n; i++)
  {
  	cin>>a[i];
  }
  mini=1000000;
  for (int t = 1; t < n; t++)
  {
  	s1=0;
  	s2=0;
  	for (int i=0;i<n;i++)
  	{
  		k=a[i];
  		if (i>t)
  		{
  			s2+=k;
  		}
  		else
  		{
  			s1+=k;
  		}
  	}
  	mini=std::min(mini,abs(s1-s2));
  }
  cout<<mini;
  return 0;
}

Measured memory_bytes: 256
C = [list(map(int, input().split())) for i in range(3)]

a = [0]
b = []
result = 'Yes'

b.append(C[0][0])
b.append(C[0][1])
b.append(C[0][2])
a.append(C[1][0] - b[0])
a.append(C[2][0] - b[0])

for i in range(3):
    for j in range(3):
        if C[i][j] != a[i] + b[j]:
            result = 'No'
            
print(result)



Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> B(N-1), A(N);
    for(int i=0; i<N-1; i++) {
        cin >> B[i];
    }

    A[0] = B[0];
    A[N-1] = B[N-2];
    for(int i=1; i<N-1; i++) {
        A[i] = min(B[i-1], B[i]);
    }

    cout << accumulate(A.begin(), A.end(), 0) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Scanner;

public class Main
{
    private static InputStream debugInput() {
        String s = "20 2 5";
        return new ByteArrayInputStream(s.getBytes());
    }

    private static InputStream stdin() {
        return System.in;
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(stdin());
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int total = 0;
        for (int i = 1; i <= n; i++) {
            int x = i;
            int sum = 0;
            while (x > 0) {
                sum += (x % 10);
                x /= 10;
            }

            if (sum >= a && sum <= b) {

                total += i;
            }
        }

        System.out.println(total);
   }
}


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

int n;
string s;
int main() {
  cin >> n >> s;
  long sum =
    (long)count(s.begin(), s.end(), 'R') *
    count(s.begin(), s.end(), 'G') *
    count(s.begin(), s.end(), 'B');
  
  for (int j = 0; j < n; ++j) {
    for (int d = 1; d < n; ++d) {
      int i = j - d;
      int k = j + d;
      if (i < 0) continue;
      if (k >= n) continue;
      if (s[i] == s[j]) continue;
      if (s[j] == s[k]) continue;
      if (s[k] == s[i]) continue;
      --sum;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


bool was[N];
int n, m, v, u;
db dp[N], dp1[N], ans = INF;
vi g[N];





main () {
//	file("");
	cin >> n >> m;
	while (m--) {
		cin >> v >> u;
		g[v].pb(u);
	}

	forn (i, 0, n - 1) {
		if (sz(g[i]) == 1)
			continue;
		forn (j, 1, n)
			dp[j] = 0;

		forev (j, n - 1, 1) {
		    db mx = 0;
			for (auto to : g[j])  {
				dp[j] += dp[to]; 
				if (dp[to] > mx)
					mx = dp[to];
			}

			if (j == i) 
				dp[j] = (dp[j] - mx) / (sz(g[j]) - 1);
			else
				dp[j] = dp[j] / sz(g[j]);
			++dp[j];		
		}
		ans = min(ans, dp[1]);				
	}	                      

	cout << fixed << setprecision(11);
	cout << ans << endl;
}


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

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x(N);
    vector<int> y(M);
    rep(i, N) cin >> x[i];
    rep(i, M) cin >> y[i];
    sort(x.rbegin(), x.rend());
    sort(y.begin(), y.end());
    FOR(i, x[0] + 1, y[0] + 1) {
        if (X < i && i <= Y) {
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256