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

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string S;
  cin >> S;
  int N = SZ(S);
  reverse(ALL(S));
  
  string a="maerd", b="remaerd", c="esare", d="resare";
  
  REP(i,N){
    string P = S.substr(0+i,5);
    string Q = S.substr(0+i,6);
    string R = S.substr(0+i,7);
    if(P == a){
      i += 4;
      continue;
    }
    if(P == c){
      i += 4;
      continue;
    }
    if(Q == d){
      i += 5;
      continue;
    }
    if(R == b){
      i += 6;
      continue;
    }
    cout << "NO" << endl;
    return 0;
  }
  
  cout << "YES" << endl;
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 62;
const int INF = 1 << 30;
const double PI = acos(-1);
int main()
{
    int n;
    ll m;
    int ans = 0;
    cin >> n >> m;
    ll radio = 1LL;
    vector<ll> a(n);
    set<ll> base; //n= [f]+t[s]
    rep(i, n)
    {
        cin >> a[i];
        base.insert(a[i] / 2);
    }
    int t = 0;
    int bef = *base.begin();
    while (bef % 2 == 0)
    {
        t++;
        bef /= 2;
    }
    for (auto itr = base.begin(); itr != base.end(); itr++)
    {
        if (!(*itr % (1<<t) == 0 and *itr / (1<<t) % 2 == 1))
        {
            cout << 0 << endl;
            clog << "!" << endl;
            return 0;
        }
        radio *= (*itr) / __gcd(radio, *itr);
        if (radio > m)
        {
            cout << 0 << endl;
            //   goto fin;
            return 0;
        }
    }
    //  fin:
    ll fa = radio, fb = radio * 3;
    ans = 1 + (m - fa) / (fb - fa);
    cout << ans << endl;
    return 0;
}
/*
    3+6n =3(1+2n) n=2,7,12 ...1+5b (9)
    5+10m=5(1+2m) m=1,4,7,....1+3a (12)
     50      10      1,4(9)  ...2

    7(1+2a)
    11(1+2b)
    20(1+2c) 
     100       5
     
    (1+2a)
    3(1+2b)      1,2...n
     1000000000  33333333
*/


Measured memory_bytes: 1024
import java.util.*;
import java.util.regex.*;

class Main{
	private final static Pattern addsubmuldiv = Pattern.compile("^(.*?)(-?\\d+)([+Z*/])(-?\\d+)(.*)$");
	private final static Pattern addsub = Pattern.compile("^(.*?)(-?\\d+)([+Z])(-?\\d+)(.*)$");
	private final static Pattern muldiv = Pattern.compile("^(.*?)(-?\\d+)([*/])(-?\\d+)(.*)$");

	private static String process(String s){
		Matcher m=muldiv.matcher(s);
		while(m.find()){
			if(m.group(3).equals("*"))
				s=m.group(1)+(Integer.parseInt(m.group(2))*Integer.parseInt(m.group(4)))+m.group(5);
			else
				s=m.group(1)+(Integer.parseInt(m.group(2))/Integer.parseInt(m.group(4)))+m.group(5);
			m=muldiv.matcher(s);
		}

		m=addsub.matcher(s);
		while(m.find()){
			if(m.group(3).equals("+"))
				s=m.group(1)+(Integer.parseInt(m.group(2))+Integer.parseInt(m.group(4)))+m.group(5);
			else
				s=m.group(1)+(Integer.parseInt(m.group(2))-Integer.parseInt(m.group(4)))+m.group(5);
			m=addsub.matcher(s);
		}
		return s;
	}

	private static String process2(String s){
		Matcher m=addsubmuldiv.matcher(s);
		while(m.find()){
			if(m.group(3).equals("*"))
				s=m.group(1)+(Integer.parseInt(m.group(2))*Integer.parseInt(m.group(4)))+m.group(5);
			else if(m.group(3).equals("/"))
				s=m.group(1)+(Integer.parseInt(m.group(2))/Integer.parseInt(m.group(4)))+m.group(5);
			else if(m.group(3).equals("+"))
				s=m.group(1)+(Integer.parseInt(m.group(2))+Integer.parseInt(m.group(4)))+m.group(5);
			else
				s=m.group(1)+(Integer.parseInt(m.group(2))-Integer.parseInt(m.group(4)))+m.group(5);
			m=addsubmuldiv.matcher(s);
		}
		return s;
	}

	public static void main(String[]z){
		Scanner x=new Scanner(System.in);
		for(;x.hasNext();){
			String s=x.next().replaceAll("-","Z");
			String ans=x.next();
			boolean a=process(s).equals(ans);
			boolean b=process2(s).equals(ans);
			if(a&&b)System.out.println("U");
			if(a&&!b)System.out.println("M");
			if(!a&&b)System.out.println("L");
			if(!a&&!b)System.out.println("I");
		}
	}
}

Measured memory_bytes: 26324
n = int(input())

a = list(map(int, input().split()))
is_ok = False

count = 0
while(True):
    i = 0
    for elem in a:
        if elem % 2 == 1:
            is_ok = True
            break
        a[i] = elem/2
        i += 1
    if is_ok:
        break
    count += 1
print(count)


Measured memory_bytes: 2940
package main

import (
	"fmt"
	"sort"
)

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

	prices := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&prices[i])
	}
	sort.Ints(prices)

	total := 0
	for i := 0; i < n-1; i++ {
		total += prices[i]
	}
	fmt.Println(total + prices[n-1]/2)
}


Measured memory_bytes: 512
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string Date = Console.ReadLine();
                string[] date = Date.Split(' ');
                int H = int.Parse(date[0]);     //???
                int W = int.Parse(date[1]);     //?¨?

                if (H == 0 && W == 0)       //H,W??±???0????????????
                {
                    break;
                }
                for (int i = 1; i <= H; i++)
                {

                    for (int j = 1; j <= W; j++)
                    {
                        if (i % 2 == 1)         //1???0????????´????????¨?§??????????"."???
                        {
                            if (j % 2 == 1)
                            {
                                Console.Write("#");
                            }
                            else
                            {
                                Console.Write(".");
                            }
                        }
                        else
                        {
                            if (j % 2 == 1)
                            {
                                Console.Write(".");
                            }
                            else
                            {
                                Console.Write("#");
                            }

                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
      }
}

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

char memory[64][8];

int judge_repeat(char str[], int counter) {
	int i;

	for(i = 0; strcmp(memory[i], str); i++);

	if(i == counter)
		return 0;

	return 1;
}

int judge(char str[], int counter) {
	int i = 0;

	while(memory[counter][i])
		i++;

	if(memory[counter][i - 1] == str[0])
		return 0;

	return 1;
}

int main() {
	char prog[8] = "aaa";
	char ai[8];
	int i = -1;
	int j;
	int flag = 0;

	while(1) {
		printf("?%s\n", prog);
		fflush(stdout);

		scanf("%s", ai);
		
		i++;
		strcpy(memory[i], prog);
		i++;
		strcpy(memory[i], ai);
		if(judge_repeat(ai, i) || judge(ai, i - 1))
			break;

		if(!strcmp(ai, "aa")) prog[1] = 'b';
		else if(!strcmp(ai, "a")) prog[1] = 'c';

		j = 0;
		while(ai[j]) j++;
		prog[0] = ai[j - 1];
	}

	printf("!OUT\n");

	return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

// 入力
int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

int main() {
	int N; cin >> N;
	for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

	// 初期化は既に 0 に初期化される
	// 初期条件も既に 0 で OK

	// ループ
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 3; ++k) {
				if (j == k) continue;
				chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
			}
		}
	}

	// 答え
	long long res = 0;
	for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
	cout << res << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main() {
	ll n, d;
	cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d)
			ans++;
	}
	cout << ans;
}


Measured memory_bytes: 3672
if __name__ == '__main__':
    k, n = map(int, input().split())
    a = list(map(int, input().split()))
    dis = [0] * n
    for i in range(n):
        if i == 0:
            dis[i] = a[-1] - a[0]
        else:
            dis[i] = k - a[i] + a[i - 1]
    print(min(dis))


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

int main()
{
	int n; std::cin >> n;
	
	int* A = new int[n];
	for (int i=0; i<n; i++) std::cin >> A[i];
	
	int q; std::cin >> q;
	for (int i=0; i<q; i++) {
		int k;
		std::cin >> k;
		int* lb = std::lower_bound(A, A+n, k);
		std::cout << lb - A << std::endl;
	}
	
	delete[] A;
	
	return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void){

    int A,B,C; cin>>A>>B>>C;

    int minkobai = (A*B)/__gcd(A,B);
    bool ok = false;
    for (int i = A; i <= minkobai; i+=A) {
        if(i%B==C){
            ok = true;
        }
    }
    if(ok) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll a,b,s,d,m;
  cin>>a>>b;
  s = a + b;
  m = a * b;
  d = a - b;

  if(s>=m && s>=d)
  cout<<s;
  else if(m>=s && m>=d)
  cout<<m;
  else
  cout<<d;
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    string res = "";
    rep(i, 0, s.size())
    {
        if (s[i] == '0' || s[i] == '1')
            res += s[i]; // string(1, s[i]);
        else if (res.size() == 1 || res.size() == 0)
            res = "";
        else
            res = res.substr(0, res.size()-1);
        // cout << res << endl;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
 
int main(){
	string s, t;
  	cin >> s >> t;
  
  	t.pop_back();
  	if(s == t) cout << "Yes" << endl;
  	else cout << "No" << endl;
  
  	return 0;
}

Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            bool[,] c;
            c = new bool[4, 13];
            foreach (var i in Enumerable.Range(0, n))
            {
                var ab = Console.ReadLine().Split().ToArray();
                var A = ab[0];
                var a = (0);
                var b = int.Parse(ab[1]);
                if (A == "S")
                {
                    a = 0;
                }
                if (A == "H")
                {
                    a = 1;
                }
                if (A == "C")
                {
                    a = 2;
                }
                if (A == "D")
                {
                    a = 3;
                }
                c[a,b-1]=true;
            }
            foreach (var i in Enumerable.Range(0, 13))
            {
                if (c[0, i] == false)
                {
                    Console.WriteLine("S {0}", i + 1);
                }
            }
            foreach (var i in Enumerable.Range(0, 13))
            {
                if (c[1, i] == false)
                {
                    Console.WriteLine("H {0}", i + 1);
                }
            }
            foreach (var i in Enumerable.Range(0, 13))
            {
                if (c[2, i] == false)
                {
                    Console.WriteLine("C {0}", i + 1);
                }
            }
            foreach (var i in Enumerable.Range(0, 13))
            {
                if (c[3, i] == false)
                {
                    Console.WriteLine("D {0}", i + 1);
                }
            }
        }
    }
}

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

int main(void) {
	int x, y;
	while (1) {
		cin >> x >> y;
		if (!x && !y)
			break;
		if (x < y)
			cout << x << ' ' << y << endl;
		else
			cout << y << ' ' << x << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from operator import itemgetter
n, k = map(int, input().split())

arr = []
k_sum = 0
for i in range(n):
  a, b = map(int, input().split())
  d = {}
  d['num'] = a
  d['count'] = b
  arr.append(d)
  
arr = sorted(arr, key=itemgetter('num'))

for i in range(n):
  k_sum += arr[i]['count']
  if k <= k_sum:
    print(arr[i]['num'])
    exit(0)
    

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int h, w, m; cin >> h >> w >> m;
    vector<P> exist;
    map<P, int> bomb;
    vi cx(h, 0);
    vi cy(w, 0);

    rep(i, m){
        int x, y; cin >> x >> y; x--; y--;
        cx[x]++;
        cy[y]++;
        bomb[{x, y}]++;
        exist.pb({x, y});
    }
    
    vector<P> cntx(h), cnty(w);
    rep(i, h) cntx[i] = {cx[i], i};
    rep(i, w) cnty[i] = {cy[i], i};
    
    sort(rall(cntx));
    sort(rall(cnty));
    
    /*
    for(auto [c, i] : cntx) cout << c << " " << i << endl;
    cout << endl;
    for(auto [c, i] : cnty) cout << c << " " << i << endl;
    */
    
    int ans = 0;
    for(auto [x, y] : exist){
        ans = max(ans, cx[x] + cy[y] - 1);
    }
    
    int mx = cntx[0].fi + cnty[0].fi;
    // cout << mx << endl << endl;
    if(ans >= mx) {
        cout << ans << endl;
        return;
    }
    
    vi candx, candy;
    rep(i, h){
        if(cntx[i].fi == cntx[0].fi) candx.pb(cntx[i].se);
        else break;
    }
    rep(i, w){
        if(cnty[i].fi == cnty[0].fi) candy.pb(cnty[i].se);
        else break;
    }

    for(auto x : candx){
        for(auto y : candy){
            // cout << x << " " << y << endl;
            //*
            if(bomb[{x,y}] == 0){
                cout << mx << endl;
                return;
            }
            //*/
        }
    }
    cout << mx - 1 << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 35744
def getval():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    return n,k,h 

def main(n,k,h):
    if k>=n-1:
        print(abs(h[-1]-h[0]))
    else:
        dp = [abs(h[i]-h[0]) for i in range(k)]
        for i in range(n):
            if len(dp)<n:
                dp.append(dp[i]+abs(h[i]-h[i+k]))
            for j in range(k-1):
                if i+j+1>=n:
                    break
                dp[i+j+1] = min(dp[i+j+1],dp[i]+abs(h[i]-h[i+j+1]))
        print(dp[-1])

if __name__=="__main__":
    n,k,h = getval()
    main(n,k,h)

Measured memory_bytes: 89492
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int x;
    cin >> x;
    for (ll i = 1; ; ++i) {
        ll l = (i-1)*i/2, r = i*(i+1)/2;
        if (l <= x && x <= r) {
            cout << i << endl;
            return 0;
        }
    }
}

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

int main() {
    int n;
    cin >> n;
    int h[n];
    rep(i, n) cin >> h[i];

    int ans = 0;
    while (count(h, h+n, 0) < n) {
        int l = 0, r = n;
        rep(i, n) {
            if (h[i] > 0) {
                l = i;
                break;
            }
        }
        for (int i = l; i < n; i++) {
            if (h[i] == 0) {
                r = i;
                break;
            }
        }
        for (int i = l; i < r; i++) h[i]--;
        ans++;
    }

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


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

int main()
{
	int n;
	char mark;
	int lank;
	int Slank[13]={0}, Hlank[13]={0}, Clank[13]={0}, Dlank[13]={0};
	int i;
	
	cin >> n;
	
	for(i=0;i<n;i++){
		cin >> mark >> lank;
		if(mark=='S')
			Slank[lank-1]=lank;
		else if(mark=='H')
			Hlank[lank-1]=lank;
		else if(mark=='C')
			Clank[lank-1]=lank;
		else if(mark=='D')
			Dlank[lank-1]=lank;
	}
	
	for(i=0;i<13;i++){
		if(Slank[i]==0)
			cout << 'S' << ' ' << i+1 << endl;
	}
	
	for(i=0;i<13;i++){
		if(Hlank[i]==0)
			cout << 'H' << ' ' << i+1 << endl;
	}
	
	for(i=0;i<13;i++){
		if(Clank[i]==0)
			cout << 'C' << ' ' << i+1 << endl;
	}
	
	for(i=0;i<13;i++){
		if(Dlank[i]==0)
			cout << 'D' << ' ' << i+1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
def solve(lx, rx):
    diff = min(rx) - max(lx)
    ans = diff+1 if diff >= 0 else 0
    return ans


if __name__ == '__main__':
    n, m = map(int, input().split())
    lx = []
    rx = []

    for i in range(m):
        l, r = map(int, input().split())
        lx.append(l)
        rx.append(r)

    print(solve(lx, rx))


Measured memory_bytes: 10996
#include <stdio.h>

int main(void)
{
	char ch[250] = { 0 };
	char a[250] = { 0 };
	int h;
	int i, j, k, l, n, m;

	while (1){
		i = 0;
		while (1){

			scanf("%c", &ch[i]);
			if (ch[i] == '\n') {
				break;
			}

			i++;
		}

		if (i == 1 && ch[0] == '-'){
			break;
		}

		scanf("%d", &m);

		for (j = 0; j < m; j++){
			scanf("%d", &h);

			for (k = 0; k < i - h; k++) {
				a[k] = ch[h + k];
			}
			for (k = 0; k < h; k++){
				a[i - h + k] = ch[k];
			}
			for (k = 0; k < i; k++){
				ch[k] = a[k];
			}
		}
		for (k = 0; k < i; k++) {
			printf("%c", ch[k]);
		}
		printf("\n");
		scanf("%c", &ch[0]);
	}


	return 0;

}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(abs(a-b)<=w)
  cout<<0<<endl;
  else {
    int c=min(a,b);
    int d=max(a,b);
    cout<<d-(c+w)<<endl;
  }
}

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

// clang-format off
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define endl '\n'
#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
    double d;
    cin >> d;
    
    cout << pow(d / 3, 3) << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N ()
#define ll long long
#define itn int
#define scafn scanf
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define CM cerr<<(&MOP2-&MOP1)/1024.0/1024.0<<endl
using namespace std;
template <class T> inline T Min(T x, T y){
    return x<y?x:y;
}
template <class T> inline T Max(T x, T y){
    return x>y?x:y;
}
bool MOP1;
int a,b;
bool MOP2;
int main(){
	scanf("%d%d",&a,&b);
	printf("%d\n",Max(a+b,Max(a-b,a*b)));
	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <ios>
#include <iomanip>
using namespace std;

#define rep(i,N) for(int i=0; i<N; i++)
#define revrep(i,N) for(int i=N-1; i>=0; i--)

typedef long long ll;
typedef unsigned int uint;

int main(void)
{
    int A,B;
    cin >> A >> B;

    int ret = 0;
    rep(i,2) { 
        if (A>B){
            ret += A;
            A--;
        } else {
            ret += B;
            B--;
        }
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char s[105];
int main(){
	scanf("%s",s);int l=strlen(s);
	for(int i=0,j=l-1;i<j;++i,--j)
		if(s[i]!=s[j])
			return puts("No"),0;
	for(int i=0,j=(l-3)/2;i<j;++i,--j)
		if(s[i]!=s[j])
			return puts("No"),0;
	return puts("Yes"),0;
}

Measured memory_bytes: 128
#include<iostream>
 
using namespace std;
 
int main(){
  static bool cmp[1000000]={true};
  static int npr[1000000];
  for(int i=2;i<1000000;i++){
    if(!cmp[i]){
      for(int j=2;j*i<1000000;j++){
    cmp[i*j]=true;
      }
    }
    npr[i]=npr[i-1]+!cmp[i];
  }
  for(int n;cin>>n;n++){
    cout<<npr[n]<<endl;
  }
  return 0;
}

Measured memory_bytes: 6044
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[100];
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(i!=N-1){
            cout<<A[i]<<' ';
        }else{
            cout <<A[i]<<endl;
        }
    }
    for(int i=1;i<N;i++){
         int v = A[i];
         int j = i - 1;
         while((j >= 0) && (A[j] > v)){
             A[j+1] = A[j];
             j--;
         }
         A[j+1] = v;
         for(int i=0;i<N;i++){
             if(i!=N-1){
             cout<<A[i]<<' ';
             }else{
                 cout <<A[i]<<endl;
             }
         }
    }
    return 0;
     
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define LL long long
#define FAST_READ ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int a[1000001] = {0};
int main()
{
    int a, b;
    cin >> a >> b;
    LL d = a*b;
    if(d%2 == 0){
        cout << "Even\n";
    }
    else{
        cout << "Odd\n";
    }
    return 0;
}


Measured memory_bytes: 256
using System;

public class Hello{
    public static int SizeX, SizeY;
    public static int[,] MapInfo;
    public static int[,] Step;
    public static void Main(){
        while(true){
            string[] X_Y = System.Console.ReadLine().Split(' ');
            SizeX = int.Parse(X_Y[0]);
            SizeY = int.Parse(X_Y[1]);
            if(SizeX == 0 && SizeY == 0) break;
            
            MapInfo = new int[SizeY,SizeX];
            Step = new int[SizeY,SizeX];
            for(int y = 0; y < SizeY; y++){
                string[] LineX = System.Console.ReadLine().Split(' ');
                for(int x = 0; x < SizeX; x++){
                    MapInfo[y,x] = int.Parse(LineX[x]);
                    Step[y,x] = Solve(x, y);
                }
            }
            
            int RoutesSum = 0;
            for(int x = 0; x < SizeX; x++){
                RoutesSum += Step[SizeY - 1, x];
                try{
                    RoutesSum += MapInfo[SizeY - 2, x] == Consts.JUMP ? Step[SizeY - 2, x] : 0 ;
                }
                catch(IndexOutOfRangeException){
                    continue;
                }
            }
            System.Console.WriteLine(RoutesSum);
        }
    }
    
    public static int Solve(int x, int y){
        int PartialRoutesSum = 0;
        
        switch(MapInfo[y,x]){
            case Consts.EMPTY:
                if(y == 0){ return 1; }
                else{
                    for(int PartialX = x - 1; PartialX < x + 2; PartialX++){
                        try{ PartialRoutesSum += MapInfo[y-1,PartialX] != Consts.JUMP ? Step[y-1,PartialX] : 0; }
                        catch(IndexOutOfRangeException){
                            continue;
                        }
                    }
                    try{ PartialRoutesSum += MapInfo[y-2,x] == Consts.JUMP ? Step[y-2,x] : 0; }
                    catch(IndexOutOfRangeException){}
                }
                break;
            case Consts.JUMP:
                try{
                    PartialRoutesSum += MapInfo[y-1,x] == Consts.EMPTY ? Step[y-1,x] : 0;
                    PartialRoutesSum += MapInfo[y-2,x] == Consts.JUMP ? Step[y-2,x] : 0;
                }
                catch(IndexOutOfRangeException){}
                break;
            case Consts.OBSTACLE:
                return 0;
            default:
                break;
        }
        
        return PartialRoutesSum;
    }
}

public static class Consts{
    public const int EMPTY = 0;
    public const int OBSTACLE = 1;
    public const int JUMP = 2;
}

Measured memory_bytes: 8960
#!/usr/bin/python
# coding: UTF-8

s = input()
a, b = map(int,(s[:2],s[2:]))

flag = "00"
dict = {
  "00": "NA",
  "10": "MMYY",
  "01": "YYMM",
  "11": "AMBIGUOUS",
}

if 0 < a < 13:
  flag = "1" + flag[1]

if 0 < b < 13:
  flag = flag[0] + "1"
  
print(dict[flag])


Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc106/tasks/abc106_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int_fast32_t i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int_fast32_t i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

// 約数の個数
template <int_fast64_t max_N> struct Prime {
    int cnt[max_N] = {0};
    constexpr Prime() : cnt() {
        for (int_fast64_t i = 1; i < max_N; ++i) {
            for (int_fast64_t j = i; j < max_N; j += i)
                cnt[j]++;
        }
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    // １の倍数＋２の倍数＋３の倍数＋・・・
    constexpr auto d = Prime<65535>();
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        ans += (d.cnt[i] == 8);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4676
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll q,q8, h,h4, s,s2, d,n,ans=0;
	std::cin >> q >> h >> s >> d >> n;

	q8 = 8 * q;
	h4 = 4 * h;
	s2 = 2 * s;
	
	if (d < min(q8,min( h4, s2))) {
		ll tmp = n / 2;
		n -= tmp*2;
		ans += d * tmp;
	}
	if (s2 < min(q8, h4)) {
		ans += s * n;
	}
	else if (h4 < q8) {
		ans += h * 2 * n;
	}
	else {
		ans += q * 4 * n;
	}

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


Measured memory_bytes: 256
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
	
	int n,a,b;
	cin >> n >> a >> b;
	if(a>b){
		cout << 0 << endl;
		return 0;
	}
	if(a==b){
		cout << 1 << endl;
		return 0;
	}
	if(n==1){
		cout << 0 << endl;
		return 0;
	}
	int l = a*(n-1)+b;
	int r = b*(n-1)+a;
	cout << r-l+1 << endl;
	

return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll tmp = 0;
    for (ll i = 0; i < n - 1; i++)
    {
        if (i % 2)
        {
            tmp += a[i];
        }
        else
        {
            tmp -= a[i];
        }
    }
    tmp += a[n - 1]; // m_nがこれ
    vector<ll> m(n);
    m[n - 1] = tmp;
    m[0] = 2 * a[n - 1] - m[n - 1];
    for (ll i = 0; i < n - 2; i++)
    {
        m[i + 1] = 2 * a[i] - m[i];
    }
    for (ll i = 0; i < n; i++)
    {
        cout << m[i] << ' ';
    }
    cout << endl;
}

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

const int MAX_N=1e5+5;

int d_a[MAX_N],d_b[MAX_N];

vector<int> G[MAX_N];
void dfs(int *d,int now,int di){
	if(d[now]!=0)return;
	d[now]=di;
	for(int i=0;i<G[now].size();i++){
		dfs(d,G[now][i],di+1);
	}
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(d_a,1,1);
	dfs(d_b,n,1);
	int a=0,b=0;
	for(int i=1;i<=n;i++){
		if(d_a[i]<=d_b[i])a++;
		else b++;
	}
	if(a>b)cout<<"Fennec"<<endl;
	else cout<<"Snuke"<<endl;

}


Measured memory_bytes: 11136
#include <stdio.h>

int main(void)
{
    int i, n, x[100];
    scanf("%d", &n);

    for (i = 1; i <= n; i++)
    {
        scanf("%d", &x[i]);
    }
    for (i = n; i >= 2; i--)
        printf("%d ", x[i]);
    printf("%d\n", x[1]);

    return 0;
}


Measured memory_bytes: 2756
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
}

Measured memory_bytes: 26028
#include "bits/stdc++.h"
 
using namespace std;
 
#define int long long
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FORR(i, a, b) for (int i = (a); i >= (b); i--)
 
#define pb push_back
#define VDEL(v, n) v.erase(v.begin() + (n))
#define ALL(v) v.begin(), v.end()
 
#define INT_INF 200000000
 
#define TINT(str) atoi(str.c_str())
#define TSTR(num) to_string(num)
 
typedef long long ll;
typedef pair<int, int> PINT;
typedef vector<int> VI;
typedef vector<vector<int>> VII;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
 
//the end of library zone
 
int A[200000];

int C[50][2];

int N, K;

int funcMaxv(int sum, int y, int ans){
	if(y == -1) return ans;

	if((sum + (((int)1) << y)) <= K){
		if(C[y][0] >= C[y][1]){
			return funcMaxv(sum, y - 1, ans + C[y][0]);
		}
		else{
			return funcMaxv(sum + (((int)1) << y), y - 1, ans + C[y][1]);
		}
	}
	else{
		return funcMaxv(sum, y - 1, ans + C[y][0]);
	}
}

signed main(){
	cin >> N >> K;

	REP(i, N){
		cin >> A[i];
	}

	REP(y, 41){
		int zero = 0;
		int one = 0;
		REP(i, N){
			int u = (A[i] >> y) & 1;
			if(u == 0){
				zero++;
			}
			else{
				one++;
			}
		}

		C[y][0] = one << y;
		C[y][1] = zero << y;
	}

	cout << funcMaxv(0, 40, 0) << endl;

    return 0;
}



Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
dp0 = 0
dp1 = 0
dp2 = 0
for i in range(1,n+1):
  ai = a[i-1]
  if i%2:
    dp1 = max(dp0,dp1)
    dp0 += ai
  if i%2 == 0:
    dp2 = max(dp1,dp2)
    dp1 += ai
  if i >= 3 and i%2:
    dp2 += ai
if n%2 == 0:
  print(max(dp0,dp1))
else:
  print(max(dp1,dp2))

Measured memory_bytes: 105412
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <stdio.h>
#include <iomanip>
using namespace std;

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

#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()

const int N = 100100;
int n, ans[N];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		ans[x] = i;
	}	
	for (int i = 1; i <= n; i++) 
		cout << ans[i] << ' ';
	cout << '\n';
}


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

int m;
const int mx = 1e5+5;
int tasks[mx][3];
int diario[3][mx];
int cosa(int a, int i){
	if(i == m){
     return 0;
     }

	if(diario[a][i] != -1) {
        return diario[a][i];
    }
	int& ans = diario[a][i];

        if(a==0){
		ans=max(ans, cosa(1, i+1)+tasks[i][0]);
		ans=max(ans, cosa(2, i+1)+tasks[i][0]);
	}
        if(a==1){
		ans=max(ans, cosa(0, i+1)+tasks[i][1]);
		ans=max(ans, cosa(2, i+1)+tasks[i][1]);
        }
	if(a==2){
		ans=max(ans, cosa(0, i+1)+tasks[i][2]);
		ans=max(ans, cosa(1, i+1)+tasks[i][2]);
	}

	return ans;
}
int main(){
	cin>>m;
	for(int i=0; i<m; i++) {
        cin>>tasks[i][0]>>tasks[i][1]>>tasks[i][2];
	}
	memset(diario, -1, sizeof diario);
	cout<<max(cosa(0,0),max(cosa(1,0),cosa(2,0)))<<"\n";
	return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    itn n,m;
    cin >> n >> m;
    int p[m],k[m],s[m][n];
    for(int i = 0;i < m;i++){
        cin >> k[i];
        for(int j = 0;j < k[i];j++)cin >> s[i][j];
    }
    for(int i = 0;i < m;i++)cin >> p[i];
    
    int ans = 0;
    for(int i = 0;i < (1 << n);i++){
        int sum = 0;
        for(int j = 0;j < m;j++){
            int count = 0;
            for(int p = 0;p < n;p++){
                if(i & (1 << p)){
                    for(int q = 0;q < k[j];q++)if(s[j][q]-1 == p)count++;
                }
            }
            if(count % 2 == p[j])sum++;
        }
        if(sum == m)ans++;
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

   
n, m = map(int, input().split())
E = [list(map(int, input().split())) for _ in range(m)]

ans = 0
for i in range(m):
  uf = UnionFind(n)
  for j in range(m):
    if i==j:
      continue
    uf.union(E[j][0]-1, E[j][1]-1)
  if uf.group_count()>1:
    ans += 1
print(ans)

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

int main() {
  int n;
  int cnt = 0;
  cin >> n;
  int a[n];
  rep(i, n) {
    cin >> a[i];
    if (i % 2 == 0 && a[i] % 2 == 1) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int r=0, g=0, b=0,m=0;
	cin >> r>> g>> b;
	 m= (r* 100) + (g * 10) + b;
	if (m % 4 == 0)
		cout << "YES";
	else
		cout << "NO";
}


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

int main()
{
	map<int, int> si[100001];
	int n, m;
	cin >> n >> m;
	int p, y;
	pair<int, int> input[100001];
	for (int i = 0; i < m; ++i)
	{
		cin >> p >> y;
		si[p][y] = 1;
		input[i] = make_pair(p, y);
	}
	for (int i = 0; i <= n; ++i)
	{
		int count = 1;
		for (auto itr = si[i].begin(); itr != si[i].end(); ++itr)
		{
			itr->second = count++;
		}
	}
	for (int i = 0; i < m; ++i)
	{
		printf("%06d%06d\n", input[i].first, si[input[i].first][input[i].second]);
	}
	return 0;
}

Measured memory_bytes: 11648
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _007_B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] pArray = ReadInts();
            var aArray = new int[n];
            for(int i = 0; i < n; i++)
            {
                aArray[i] = n * i + 1;
            }
            var bArray = new int[n];
            bArray[n - 1] = 1;
            bool lower = true;
            var lowerList = new List<int>();
            var upperList = new List<int>();
            for (int i = 0; i < n; i++)
            {
                if (pArray[i] == n)
                {
                    lower = false;
                    continue;
                }
                if (lower)
                {
                    lowerList.Add(pArray[i]);
                }
                else
                {
                    upperList.Add(pArray[i]);
                }
            }
            lowerList.Reverse();
            int baseVal = bArray[n - 1] + aArray[n - 1];
            int val = baseVal - 1;
            for(int i = 0; i < lowerList.Count; i++)
            {
                bArray[lowerList[i] - 1] = val - aArray[lowerList[i] - 1];
                val--;
            }
            val = baseVal + 1;
            for (int i = 0; i < upperList.Count; i++)
            {
                bArray[upperList[i] - 1] = val - aArray[upperList[i] - 1];
                val++;
            }
            for(int i = 0; i < n; i++)
            {
                Console.Write(aArray[i]+" ");
            }
            Console.WriteLine();
            for (int i = 0; i < n; i++)
            {
                Console.Write(bArray[i]+" ");
            }
            Console.WriteLine();
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 19552
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

int main()
{
	int n;
	vector<pair<INT, INT>> a;
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		INT tmpA, tmpB;
		cin >> tmpA >> tmpB;
		a.push_back(make_pair(tmpA, tmpB));
	}
	sort(a.begin(), a.end(), [](pair<INT, INT> p, pair<INT, INT> q) {return (p.first + p.second) > (q.first + q.second); });

	INT ans = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			ans += a[i].first;
		}
		else
		{
			ans -= a[i].second;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2420