akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
)

func main() {
	sc := NewScanner()

	s := sc.NextLine()
	mp := map[string]struct{}{}
	mp["A"] = struct{}{}
	mp["C"] = struct{}{}
	mp["G"] = struct{}{}
	mp["T"] = struct{}{}
	mx := 0
	cnt := 0
	for i := 0; i < len(s); i++ {
		_, ok := mp[string(s[i])]
		if ok {
			cnt++
			if mx < cnt {
				mx = cnt
			}
		} else {
			cnt = 0
		}
	}
	fmt.Printf("%v\n", mx)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
a,b,c,d = map(int, input().split())
def gcd(u,v):
  while v: u,v = v,u%v
  return u
s = abs(c-a)
t = abs(d-b)
u = gcd(s,t)
print(u*((s+t)//u-1) if u else 0)


Measured memory_bytes: 2940
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) ->
      if x < y then Node (y, doit l, r)
      else Node (y, l, doit r) in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> f x; doit l; doit r in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> doit l; f x; doit r in
  doit t

let print t =
  inorder (fun e -> print_string " "; print_int e) t;
  print_newline ();
  preorder (fun e -> print_string " "; print_int e) t;
  print_newline ()

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r in
  doit t

let delete x t =
  let rec min_val = function
    | Nil -> assert false
    | Node (x, Nil, _) -> x
    | Node (_, l, _) -> min_val l in
  let rec remove_min = function
    | Nil -> assert false
    | Node (_, Nil, r) -> r
    | Node (x, l, r) -> Node (x, remove_min l, r) in
  let rec doit = function
    | Nil -> assert false
    | Node (y, l, r) ->
      if x = y then
        if l = Nil then r
        else if r = Nil then l
        else Node (min_val r, l, remove_min r)
      else if x < y then Node (y, doit l, r)
      else Node (y, l, doit r) in
  doit t

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let m = read_int () in
  let t = ref (create ()) in
  for _ = 0 to m - 1 do
    match read_line () |> split_on_char ' ' with
    | ["insert"; n] -> t := insert (int_of_string n) !t
    | ["find"; n] -> print_endline (if find (int_of_string n) !t then "yes" else "no")
    | ["delete"; n] -> t := delete (int_of_string n) !t
    | _ -> print !t
  done

Measured memory_bytes: 25292
#include <stdio.h>
int main(){
  int S, h, m, s;
  scanf("%d", &S);
  h = S / 3600;
  m = (S % 3600) / 60;
  s = (S % 3600) % 60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}


Measured memory_bytes: 2100
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 200005
#define mod 1000000007
#define rep(i,j,k) for (ll i=j;i<=k;++i)
#define per(i,j,k) for (ll i=j;i>=k;--i)
using namespace std;
inline ll read(){
	char ch=getchar(); ll x=0,f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}
ll n,m,ans=1;
int main(){
	n=read(); m=read();
	if (abs(n-m)>1) return puts("0")&0;
	rep(i,1,n) (ans*=i)%=mod;
	rep(i,1,m) (ans*=i)%=mod;
	if (n==m) (ans<<=1)%=mod;
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		ll n,k;
		cin>>n>>k;
		vector<ll> height;
		vector<ll> dp(n,1e9);
		for(ll i=0; i<n; i++) {
			ll x;
			cin>>x;
			height.push_back(x);
		}
 
		dp[0] = 0;
		dp[1] = abs(height[1] - height[0]);
 
		for(ll i=2; i<n; i++) {
			ll cur = 1, mini = 100000000;
			ll cost = 0;
			while((i-cur)>=0 && cur<=k) {
				cost = dp[i-cur] + abs(height[i-cur] - height[i]);
				dp[i] = min(dp[i],cost);
				cur++;
			}			
			
		}
 
		cout<<dp[n-1]<<endl;
 
		return 0;
	}

Measured memory_bytes: 2168
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
mod = 10**9+7


def main():
    N, M = map(int, input().split())
    A = deque([int(input()) for _ in range(M)])
    
    if N == 1:
        print(1)
        return
    
    prepre = 1
    pre = 1
    if A and A[0] == 1:
        pre = 0
        A.popleft()

    for i in range(2, N + 1):
        if A and A[0] == i:
            pre, prepre = 0, pre
            A.popleft()
        else:
            pre, prepre = (pre + prepre) % mod, pre
        #print("i={}, val={}".format(i, pre))
    print(pre)



if __name__ == "__main__":
    main()


Measured memory_bytes: 45404
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
const ll INF=1e9+5;
void min_self(ll &a,ll b)
{
    a=min(a,b);
    return;
}
int main()
{
    ll n,w;
    cin>>n>>w;
    vll weight(n),value(n);
    ll sum_value=0;
    for(ll i=0;i<n;i++){cin>>weight[i];cin>>value[i];}
    for(ll i=0;i<n;i++){sum_value+=value[i];}
    vll dp(sum_value+1,INF);
    dp[0]=0;
    // dp[i] - min total weight of items with value i
    for(ll item=0;item<n;item++)
    {
        for(ll value_already=sum_value-value[item];value_already>=0;value_already--)
        {
            min_self(dp[value_already+value[item]],dp[value_already]+weight[item]);
        }
    }
    ll ans=0;
    for(ll i=0;i<=sum_value;i++)
    {
        if(dp[i]<=w) ans=max(ans,i);
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 1024
a, b=map(int,input().split())
a_t=a/0.08
a_t2=a_t+0.9/0.08
b_t=b/0.1
if b_t<=a_t2 and b_t>=a_t:
  print(int(b_t))
else:
  if b_t>a_t2 or b_t+9<a_t:
    print(-1)
  for k in range(9):
    b_t+=1
    if b_t<=a_t2 and b_t>=a_t:
      print(int(b_t))
      break
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int k,x;
  cin>>k>>x;
  int l=max(-100000,x-k+1);
  int r=min(100000,x+k-1);
  rep(i,l,r+1) cout<<i<<" "; cout<<endl;
  return 0 ;
}


Measured memory_bytes: 256
#include<stdio.h>

int euclid(int a, int b)
{
  int tmp;

  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  if (b < 1) {
    return -1;
  }

  if (a % b == 0) {
    return b;
  }

  return euclid(b, a % b);
}

int main()
{
  int n;
  int g, a;
  int i;

  scanf("%d",&n);
  scanf("%d",&g);

  for (i = 2; i <= n; i++) {
    scanf("%d", &a);
    g = euclid(g,a);
  }

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

  return 0;
}


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

int a;

void input(){
  cin >> a;
}

void solve(){
  input();
  string ans = "No";
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= i; j++){
      if(i*j == a) ans = "Yes";
      //cout << j*i << " ";
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO()	{cin.tie(0);	cout.sync_with_stdio(false);}
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<(int)n;i++)
#define REP(i,n)	for(int i=0;i<=(int)n;i++)
#define srep(i,a,n)	for(int i=a;i<(int)n;i++)
#define SREP(i,a,n)	for(int i=a;i<=(int)n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll gcd(ll a, ll b) {
	return a%b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	cout<<"case #" << x << ": " << endl
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-15;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };

int main() {
	ll n, a, b;	cin >> n >> a >> b;
	vint ret(n);
	if (a*b<n||a+b>n+1) {
		cout << -1 << endl;
	}
	else {
		int i = 0;
		int loop = 0;
		while (i < n) {
			if (i == n)	break;
			loop++;
			int j = max(1LL, n - a*((i + a) / a) + 1);
			for(int k=0;k<a;k++,j++) {
				ret[i++] = j;
				if (i == n)	break;
			}
		}
		while (b - loop > n - loop*a) {
			loop--;
		}
		if (b > loop) {
			sort(ret.end() - b + loop, ret.end());
			reverse(ret.end() - b + loop, ret.end());
		}
		rep(i, n)	cout << (i ? " " : "") << ret[i];
		cout << endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

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

    ll a, b, k;
    cin >> a >> b >> k;

    for (int i = 0; i < k; ++i) {
        if (i % 2 == 0) { // A
            if (a % 2) --a;
            b += a / 2;
            a /= 2;
        }
        else { // B
            if (b % 2) --b;
            a += b / 2;
            b /= 2;
        }
    }

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<LL> a(n), sum(n + 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum[i + 1] = sum[i] + a[i];
	}
	sum.push_back(1LL << 60);
	LL b = sum[n] % 2;
	LL t = sum[n] / 2;
	LL pos = lower_bound(sum.begin(), sum.end(), t) - sum.begin();
	LL ans = abs(sum[pos] - (sum[n] - sum[pos]));
	if (pos > 1) {
		ans = min(ans, abs(sum[pos - 1] - (sum[n] - sum[pos - 1])));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6400
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
AB = []
for _ in range(m):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    AB.append(A[x]+B[y]-c)
AB.sort()
A.sort()
B.sort()
print(min(AB[0], A[0]+B[0]))


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

using namespace std;
typedef long long ll;

int main(void) {
	ll k, n, p = 0;
	cin >> k;
	n = k / 50;
	k %= 50;
	vector<ll> a(50);
	for (ll i = 0; i < 50; i++)
		a[i] = i + n;
	while (p < k) {
		for (int i = 0; i < 50; i++)
			a[i]--;
		a[p++] += 51;
	}
	printf("50\n");
	for (int i = 0; i < 50; i++)
		printf("%lld ", a[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
import numpy as np

def main():
    n, m, c = list(map(int, input().split()))
    b = np.array(list(map(int, input().split())))
    a = np.array([list(map(int, input().split())) for _ in range(n)])

    ans = sum([1 if x + c > 0 else 0 for x in list(np.dot(a, b))])
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 21644
a,b,c,d,e=[int(input()) for i in range(5)]
import math
A,B,C,D,E=[math.ceil(a/10),math.ceil(b/10),
math.ceil(c/10),math.ceil(d/10),math.ceil(e/10)]
x=[a%10,b%10,c%10,d%10,e%10]
m=0 
while m<=4:
 if x[m]==0:
  x[m]=x[m]+10
  m=m+1
 else:
  x[m]=x[m] 
  m=m+1
d=min(x)

print(int((A+B+C+D+E)*10-10+d))


Measured memory_bytes: 3064
import queue



"""
start : スタートの盤面を表す配列
# bf_search([8, 6, 7, 2, 5, 4, 3, 0, 1])
bf_search([1,2,3,4,5,0,7,8,6])
bf_search([1,3,0,4,2,5,7,8,6])
"""


def bf_search(start):
    # 隣接リスト
    adjacent = (
        # 0のコマから1or3へ移動できる
        (1, 3),  # 0
        # 1のコマから0or2or4へ移動できる
        (0, 2, 4),  # 1
        (1, 5),  # 2
        (0, 4, 6),  # 3
        (1, 3, 5, 7),  # 4
        (2, 4, 8),  # 5
        (3, 7),  # 6
        (4, 6, 8),  # 7
        (5, 7)  # 8
    )
    # 最終的に至りたい形
    GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]
    # 初期値の時点でゴールだったら
    if start == GOAL:
        print(0)
        return
    

    q = queue.Queue()
    
    # キューにStateオブジェクトを追加する
    q.put(State(start, start.index(0), None))
    
    # table:同一局面があるかチェックするための辞書（ハッシュ）
    table = {}
    
    # 配列をタプル型に変換してそれをキーとする
    # Trueなら一度見たことがある状態
    table[tuple(start)] = True

    # ゴールにたどり着くまでループ
    # キューが空になってループが終了　-> goalにたどり着けなかった
    while not q.empty():
        # キューから局面を取り出してaに格納
        a = q.get()
        #print(a.board)
        # adjacent[a.space]: 動かせるコマの位置
        """
        完成形から考えて
        空白0のインデックスが7だったら隣接リストより4,6,8の方向へを動かすことができるので
        
        最初のループでxに4が入る
        """
        #print("a.apace="+str(a.space))
        for x in adjacent[a.space]:
            #print("x="+str(x))
            # 元の局面をコピー(State型でなく状態のみ「startと同じ」)
            b = a.board[:]

            b[a.space] = b[x]
            # 0: 空き場所を表す
            b[x] = 0
            key = tuple(b)
            # 同一局面がないかチェック　あればcontinueでループをスキップ
            if key in table: continue
            # 同一局面がなければ新しい局面を生成
            c = State(b, x, a)
            if b == GOAL:
                # print("answer")
                min = Min()
                min.print_answer(c)
                min.result()
                return
            # 局面を追加
            q.put(c)
            table[key] = True


class State:
    def __init__(self, board, space, prev):
        # 盤面を表す配列
        self.board = board
        # 空き場所の位置
        self.space = space
        # ひとつ前の局面（Stateオブジェクト）
        self.prev = prev

class Min:
    def __init__(self):
        self.min = 0
    def increment(self):
        self.min = self.min + 1
    def result(self):
        print(self.min - 1)

    # 手順の表示
    def print_answer(self,x):
        if x is not None:
            self.increment()
            self.print_answer(x.prev)
            # print(x.board)



def main():
    p = []  ##appendのために宣言が必要
    # 入力受付
    i = 0
    while i < 3:
        try:
            p.append(list(map(int, input().split())))
            i = i + 1
        except:
            break;
    # ↓この形に変形したい
    # start =[1,3,0,4,2,5,7,8,6]
    start = sum(p,[])

    bf_search(start)

    return








if __name__ == '__main__':
    main()


Measured memory_bytes: 72792
N, M = map(int, input().split())

if M % N == 0:
    ans = M // N
else:
    for i in range(1, M // N + 1):
        if M % i == 0:
            ans = i
            if M // i > i and M // i <= M // N:
                ans = M // i
                break
        
print(ans)

Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element

int N, M, K;
vector<int> link[100010];
int cluster[100010];
int cluster_cnt[100010];
vector<int> friends[100010];
vector<int> block[100010];

signed main()
{
	cin >> N >> M >> K;
	REP(i, M)
	{
		int a, b;
		cin >> a >> b;
		link[a].push_back(b);
		link[b].push_back(a);
	}

	int cls = 1;
	for (int i = 1; i <= N; i++)
	{
		if (cluster[i] > 0) continue;
		queue<int> q;
		q.push(i);
		cluster[i] = cls;
		cluster_cnt[cls]++;
		while (q.size() > 0)
		{
			int q_cnt = q.size();
			for (int j = 0; j < q_cnt; j++)
			{
				int a = q.front();
				q.pop();

				for (int l : link[a])
				{
					if (cluster[l] == 0)
					{
						q.push(l);
						cluster[l] = cls;
						cluster_cnt[cls]++;
					}
				}
			}
		}
		cls++;
	}

	REP(i, K)
	{
		int c, d;
		cin >> c >> d;
		if (cluster[c] == cluster[d])
		{
			block[c].push_back(d);
			block[d].push_back(c);
		}
	}


	for (int i = 1; i <= N; i++)
	{
		int ans = cluster_cnt[cluster[i]] - link[i].size() - block[i].size()- 1;
		cout << ans << " ";
	}
	cout << endl;
}




Measured memory_bytes: 16884
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007

int divisorSum(ll n) 
{ 
    ll sum = 0; 
    for (int i = 1; i <= n; ++i) 
        sum += (n / i) * i*i; 
    return sum; 
} 
ll findDivisors(ll n) 
{ 
  
    // Array to store the count 
    // of divisors 
    ll sum=0;
    std::vector<ll> div(n+1); 
    //memset(div, 0, sizeof(div)); 
  memset(&div[0], 0, sizeof(div[0]) * div.size());
    // For every number from 1 to n 
    for (int i = 1; i <= n; i++) { 
  
        // Increase divisors count for 
        // every number divisible by i 
        for (int j = 1; j * i <= n; j++) 
            div[i * j]++; 
    } 
  
    // Print the divisors 
    for (int i = 1; i <= n; i++) 
        sum+=div[i]*i ;
    return sum; 
} 
              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
        	/*ll input,n,m,k;
        	std::vector<ll> a,b;
        	cin>>n>>m>>k;
        	REP(i,0,n-1){cin>>input;a.push_back(input);}
        	REP(i,0,m-1){cin>>input;b.push_back(input);}
        	ll i=0,j=0,count=0;
        	while(k>min(a[i],b[j])){
        		if(i>=n||j>=m){count=n+m;break;}
        		k=k-min(a[i],b[j]);
        		count++;
        		if(min(a[i],b[j])==a[i])
        			i++;
        		else j++;
        	}  
        	cout<<count;
       */
    	ll n;
    	cin>>n;
    	cout<<findDivisors(n);


             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


Measured memory_bytes: 81332
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define ps(s)     for(auto i:s){cout<<i<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll n,me;cin>>n>>me;
	ll m[n+1]={0};
	ll b[n+1]={0};
	for(int i=0;i<me;i++){
		str s;int a;
		cin>>a>>s;
		if(s=="AC"){
			m[a]=1;
		}
		else{
			if(!m[a]){
				b[a]+=1;
			}
		}
	}
	int r1=0,r2=0;
	for(int i=1;i<=n;i++){
		r1+=m[i];
		if(m[i]){
		r2+=b[i];}
	}
	cout<<r1<<" "<<r2;
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case "<<k<<": ";
		solve();
		//e;
	}
}

Measured memory_bytes: 5168
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>

using namespace std;
#define modd 1000000007
#define moda 1000003


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d,e, H, W, X;
long long A[200005] = {};
long long B[200005] = {};
long long C[200005] = {};
bool f, ff,fff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <pl>vpl[2];
vector <string> vs;
set<ll> llset;

struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;

bitset<5000> bits;

int main() {

	cin >> N;
	
	for (int i = 0; i < 2 * N; i++) {
		cin >> A[i];
		vl[0].push_back(A[i]);
	}

	sort(vl[0].begin(), vl[0].end());
	a = 0;
	for (int i = 0; i < 2 * N; i+=2) {
		a += vl[0][i];
		
	}

	cout << a << endl;

	return 0;

}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
  int N,a;
  scanf("%d",&N);
  int sum1[N],sum2[N];

  for(int i = 0;i < N;i++){
    sum1[i] = 0;
    scanf("%d",&a);
    sum1[i] += a;
    if(i != 0){
      sum1[i] += sum1[i-1];
    }
  }
  for(int i = 0;i < N;i++){
    sum2[i] = 0;
    scanf("%d",&a);
    sum2[i] += a;
    if(i != 0){
      sum2[i] += sum2[i-1];
    }
  }

  int max = sum2[N-1]+sum1[0];
  int count;

  for(int i = 1;i < N;i++){
    count = sum1[i]+sum2[N-1]-sum2[i-1];
    if(max < count){
      max = count;
    }
  }

  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int mod = 1e6 + 3;

int fact[2 * mod];

int powlog(int a, int b){
    if(b == 0) return 1;
    if(b % 2) return 1LL * a * powlog(a, b - 1) % mod;
    int ret = powlog(a, b / 2);
    return 1LL * ret * ret % mod;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    fact[0] = 1;
    for(int i = 1 ; i < 2 * mod ; i++){
        fact[i] = 1LL * i * fact[i - 1] % mod;
    }
    int T;
    cin >> T;
    while(T--){
        int x, d, n;
        cin >> x >> d >> n;
        if(d == 0){
            cout << powlog(x, n) << endl;
            continue;
        }
        if(n >= mod){
            cout << 0 << endl;
            continue;
        }
        x = 1LL * x * powlog(d, mod - 2) % mod;
        int ans = 1LL * fact[x + n - 1] * powlog(fact[x - 1], mod - 2) % mod;
        ans = 1LL * ans * powlog(d, n) % mod;
        cout << ans << endl;
    }
}


Measured memory_bytes: 8704
import numpy as np
import sys

input = sys.stdin.readline

md = 10 ** 9 + 7
n, k = map(int, input().split())
a = np.array([list(map(int, input().split())) for _ in range(n)], dtype="O")
c = np.eye(n, dtype="O")

while k:
    if k & 1:
        c = np.dot(a, c) % md
    a = np.dot(a, a) % md
    k >>= 1
print(np.sum(c) % md)


Measured memory_bytes: 13296
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
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);
}
/*-------------------------------------------*/

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

    int n, x, t;
    cin >> n >> x >> t;

    cout << (n + x - 1) / x * t << endl;

    return 0;
}

Measured memory_bytes: 3644
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  string s;
  cin >> n >> s;

  int cnt = 0;
  REP(i,n) if(s[i] == 'R') cnt++;

  if(cnt > n-cnt) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

namespace testAtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            //string temp = Console.ReadLine();
            string[] str = Console.ReadLine().Split();
            a = int.Parse(str[0]);
            string op = str[1];
            b = int.Parse(str[2]);

            if (op == "+")
            {
                Console.WriteLine(a + b);
            }
            else if (op == "-")
            {
                System.Console.WriteLine(a - b);
            }

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 2772
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n, q;
    cin >> n >> q;
    dsu d(n);
    int t, u, v;
    rep(i, q) {
        cin >> t >> u >> v;
        if(t)
            cout << d.same(u,v) << endl;
        else
            d.merge(u, v);
    }
    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    char s[3];
    int day=0;
    cin >> s;
    if('R'==s[0]) {
        day++;
        if('R'==s[1]) {
            day++;
            if ('R'==s[2])day++;
        }
    }else if('R'==s[1]){
        day++;
        if ('R'==s[2])day++;
    }else if ('R'==s[2]) day++;

    std::cout <<day<<std::endl;


    return 0;



}

Measured memory_bytes: 3552
#include<stdio.h>

#define MAX 100000


int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return i*2+1;
}



int main(){

  int H=0,i,A[MAX+1];

  scanf("%d",&H);

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

  
for(i=1;i<=H;i++){
  printf("node %d: key = %d, ",i,A[i]);
 

  if(parent(i)>=1) printf("parent key = %d, ",A[parent(i)]);
  if(left(i)<=H) printf("left key = %d, ",A[left(i)]);
  if(right(i)<=H) printf("right key = %d, ",A[right(i)]);

  printf("\n");
 }

 return 0;
}



Measured memory_bytes: 2112
#include <stdio.h>

int main(void) {
	int K, S, i, j, k, count = 0;

	scanf("%d%d", &K, &S);

	for (i = 0; i <= K; i++) {
		for (j = i; j <= K; j++) {
			for (k = j; k <= K; k++) {
				if (i + j + k == S) {
					if (i == j && j == k) {
						count++;
					}
					else if (i == j || j == k || k == i) {
						count += 3;
					}
					else {
						count += 6;
					}
				}
			}
		}
	}

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

	return 0;
}

int fact(int n) {
	if (n == 0 || n == 1) {
		return 1;
	}
	return n * fact(n - 1);
}

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

const int N = 105;

char c[N][N];
int dis[N][N];
vector <pair <pair <int, int>, int> > vec[N][N];
deque <pair <int, int> > q;

int main() {
	ios :: sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> c[i][j];
			dis[i][j] = N * N;
		}
	}
	if (c[1][1] == '#') {
		dis[1][1] = 1;
	}
	else {
		dis[1][1] = 0;
	}
//	q.push_back({1, 1});
//	while (q.size()) {
//		int x = q.front().first, y = q.front().second;
//		if (x + 1 <= n && dis[x + 1][y] == N * N) {
//			if (c[x + 1][y] == )
//		}
//	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i > 1) {
				if (c[i][j] == '#' && c[i - 1][j] == '.') {
					dis[i][j] = min(dis[i][j], dis[i - 1][j] + 1);
				}
				else {
					dis[i][j] = min(dis[i][j], dis[i - 1][j]);
				}
			}
			if (j > 1) {
				if (c[i][j] == '#' && c[i][j - 1] == '.') {
					dis[i][j] = min(dis[i][j], dis[i][j - 1] + 1);
				}
				else {
					dis[i][j] = min(dis[i][j], dis[i][j - 1]);
				}
			}
		}
	}
	cout << dis[n][m];
	return 0;
}


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

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

char s[1000010];

inline int C(int n, int m) { return (n & m) == m; }

int main() {
	int n;
	scanf("%d%s", &n, s + 1);
	if(n == 1) putchar(s[1]), puts("");
	else {
		--n;
		int find1 = 0;
		for(int j = 1; j <= n; j++)
			s[j] = abs(s[j] - s[j + 1]), find1 |= s[j] == 1;
		if(!find1) for(int i = 1; i <= n; i++) s[i] >>= 1;
		find1 ^= 1;
		int t = 0;
		for(int j = 1; j <= n; j++) t ^= C(n - 1, j - 1) * (s[j] & 1);
		cout << (int(t) << find1) << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,z ;
    cin>>a>>b>>c;
    z=(a*100)+(b*10)+c;
    if(z%4==0)
    cout<<"YES";
    else
     cout<<"NO";
	
        
	return 0;
	}





Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;

int n, m;
vector<pair<int, int>> edges;
int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v;
        u--; v--;
        edges.emplace_back(u, v);
    }
    reverse(edges.begin(), edges.end());
    vector<vector<bool>> exist(n, vector<bool>(n, false));
    vector<bool> bad(n);
    for(int i = 0; i < n; i++){
        exist[i][i] = true;
        for(auto e: edges){
            int u = e.first, v = e.second;
            if(exist[i][u] && exist[i][v]){
                bad[i] = true;
                break;
            }
            else if(exist[i][u]){
                exist[i][v] = true;
            }
            else if(exist[i][v]){
                exist[i][u] = true;
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(bad[i] || bad[j]) continue;
            int cnt = 0;
            for(int k = 0; k < n; k++){
                if(exist[i][k] && exist[j][k]){
                    cnt++;
                }
            }
            if(cnt == 0) ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4328
#include<stdio.h>
int main(void){
  int x,y,n;
  scanf("%d %d",&x,&y);
  if(x == 1 && y == 1){
    printf("1000000");
    return 0;
  }
  switch(x){
    case 1:
      n = 300000;
      break;
    case 2:
      n = 200000;
      break;
    case 3:
      n = 100000;
      break;
    default:
      n = 0;
      break;
  }
  switch(y){
    case 1:
      n += 300000;
      break;
    case 2:
      n += 200000;
      break;
    case 3:
      n += 100000;
      break;
  }
  printf("%d",n);
  return 0;
}

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

int main() {
	long long n,m;cin>>n>>m;
	vector<long long> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<long long> s(n);
	s[0]=a[0];
	for(int i=1;i<n;i++){
		s[i]=s[i-1]+a[i];
	}
	for(int i=0;i<n;i++){
		s[i]%=m;
	}
	map<long long,long long> sm;
//	for(int i=0;i<m;i++){
//		sm[i]=0;
//	}
	for(int i=0;i<n;i++){
		sm[s[i]]++;
	}
	sm[0]++;
//	for(int i=0;i<m;i++){
//		cout<<sm[i]<<endl;
//	}
	long long ans=0;
	for(auto itr=sm.begin();itr!=sm.end();itr++){
		ans+=itr->second*(itr->second-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int k, n;
	cin >> k >> n;
	int A[n + 1];
	for (int i = 0; i < n; ++i)
		cin >> A[i];
	sort(A, A + n);
	A[n] = A[0] + k;

	int ans = 1e9;
	for (int i = 1; i <= n; ++i)
		ans = min(ans, k - (A[i] - A[i - 1]));
	cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <climits>

using namespace std;

typedef long long ll;


int main(){
  int n; cin >> n;
  //F_ijk means whether shop i is open or not in time zone jk
  int F[n+1][5+1][2+1];
  for(int i=1;i<=n;i++){
    for(int j=1;j<=5;j++){
      for(int k=1;k<=2;k++){
        cin >> F[i][j][k];
      }
    }
  }
  //P_i(c[i]) gives profit
  int P[n+1][10+1];
  for(int i=1;i<=n;i++){
    for(int j=0;j<=10;j++){
      cin >> P[i][j];
    }
  }
  //c_i means how many time zones both shop i and shop joisino are open
  int c[n+1];
  int ans=INT_MIN;
  for(int p = 1;p < (1 << 10); p++){
    for(int i=1;i<=n;i++) c[i]=0;
    int x = p;
    for(int i=0;i<10;i++){
      //x %2==0 means shop joisino is closed
      if(x %2==0){

      }else{
        for(int j=1;j<=n;j++){
          if(F[j][i/2 +1][i %2 +1] == 1) c[j]++;
        }
      }
      x = x/2;
    }
    int sum = 0;
    for(int i=1;i<=n;i++){
      sum = sum + P[i][c[i]];
    }
  //cout << sum << endl;
    ans = max(ans, sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
import Data.Ord(comparing)

main :: IO ()
main = do
     xs <- replicateM 10 getLine
     mapM_ print $ getHigher3 $ map read xs

getHigher3 :: [Int]->[Int]
getHigher3 xs = take 3 $ rSort xs

rSort :: (Ord a) => [a]->[a]
rSort = sortBy ( flip compare )

Measured memory_bytes: 3680
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, X, Y = il()
    x = il()
    y = il()
    if max(x) >= min(y) or X >= Y:
        print('War')
        exit()

    Z = range(max(x)+1, min(y) + 1)
    for z in Z:
        if X < z <= Y:
            print('No War')
            exit()
    else:
        print('War')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10132
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;

ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a,m);
        if(n%2==0)
            return (((res%m)*(res%m))%m);
        else
        {
            return (((((res%m)*a)%m)*res)%m);
        }
    }
}
int main()
{
   string s;
   cin>>s;
   int i,ok=1;
   int n=s.length();
   for(i=0;i<n;i++)
   {
       int p=i+1;
       if(p%2==1)
       {
           if(s[i]=='R'||s[i]=='U'||s[i]=='D')
           {
               continue;
           }
           else
           {
               ok=0;
               break;
           }
       }
       else
       {
           if(s[i]=='L'||s[i]=='U'||s[i]=='D')
           {
               continue;
           }
           else
           {
               ok=0;
               break;
           }
       }

   }
   if(ok)
    cout<<"Yes";
   else
    cout<<"No";
}


Measured memory_bytes: 256
x = int(input())

tmp = []

for i in range(1,10):
  for l in range(1,10):
    tmp.append(i*l)

cnt = 0
    
for n in tmp:
  if n == x:
    cnt += 1
    
if cnt == 0:
  print("No")
else:
  print("Yes")

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

int main ()
{
  int a,b,c,d,L,R;
  cin >> a >> b >> c >> d;
  L = a + b;
  R = c + d;
    
  if(L > R){
   cout << "Left" << endl; 
  }else if(L < R){
   cout << "Right" << endl; 
  }else{
   cout << "Balanced" << endl; 
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main()
{
	int n; scanf("%d",&n);
	for(int i=1; i<=n; ++i) scanf("%d", a+i);
	swap(*max_element(a+1, a+n+1), a[1]);
	int df=0, dfi=0;
	for(int i=2; i<=n; ++i){
		int tmp = min(a[1]-a[i], a[i]);
		if(tmp >= df){
			df = tmp; dfi = i;
		}
	}
	printf("%d %d\n", a[1], a[dfi]);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <cstring>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using edge = struct
{
    int to;
    int cost;
};

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

class SegmentTree
{
  private:
    int N = 1;
    vector<int> node;

  public:
    SegmentTree(vector<int> vec, int initial_value)
    {
        int size = vec.size();

        while (N < size)
            N *= 2;

        node.resize(2 * N - 1, initial_value);

        rep(i, size) node[i + N - 1] = vec[i];

        for (int i = N - 2; i >= 0; i--)
            node[i] = node[i * 2 + 1] + node[i * 2 + 2];
    }

    void add(int i, int value)
    {
        i += N - 1;
        node[i] += value;

        while(i > 0)
        {
            i = (i - 1) / 2;
            node[i] = node[i * 2 + 1] + node[i * 2 + 2];
        }
    }

    int getsum(int a, int b, int k = 0, int l = 0, int r = -1)
    {
        if(r < 0) r = N;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];

        int vl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);

        return vl + vr;
    }
};

int main()
{
    int N, Q;
    cin >> N >> Q;
    SegmentTree seg(vector<int>(N, 0), 0);

    rep(i, Q)
    {
        int com, x, y;
        cin >> com >> x >> y;
        if(com == 0)
        {
            seg.add(x - 1, y);
        }
        else
        {
            cout << seg.getsum(x - 1, y) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4160
#include<iostream>

using namespace std;

int n, sol, cnt;

int main () {
	cin >> n;
	int prosli = -1;
	for (int i=0; i<=n; i++) {
		int x;
		if (i < n) {
			cin >> x;
		} else {
			x = 1000000;
		}
		if (x == prosli) {
			cnt++;
		} else {
			sol += cnt/2;
			cnt = 1;
		}
		prosli = x;
	}
	cout << sol;
	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

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

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  int N, x, a;
  cin >> N >> x;
  int ans = 0;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> a;
    vec.at(i) = a;
  }
  sort(vec.begin(), vec.end());

  // 小さい順に配っていき、配りきったところまでをカウントする
  for(int i = 0; i < N; i++){
    x -= vec.at(i); // 小さい最初の値を減らす
    if(x < 0){
      break; // xがマイナスなら終了
    } else if(i != N-1 && x >= 0){ // iがN-1でない場合でかつxが0以上なら足す
      ans++;
    } else if(x == 0){ // xが0と同じでも足す
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n, i, j, a[100];
    scanf("%d",&n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (i = n - 1; 0 <= i - 1; i--)
        printf("%d ", a[i]);
    printf("%d\n", a[i]);
    return 0;
}

Measured memory_bytes: 596