akhauriyash/Code-Regression huggingface dataset:
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
    i64 from, to, cost;
    edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
    edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

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

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}
//

#pragma endregion

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

vector< int64_t > divisor(int64_t n) {
    vector< int64_t > ret;
    for (int64_t i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main() {
    i64 n;
    cin >> n;
    auto d = divisor(n);
    i64 ans = 0;
    for (auto x : d) {
        if(x == 1) continue;
        if((n % (x - 1)) == n / (x - 1)) ans += x - 1;
    }
    cout << ans << endl;
}

// n = am + b (a == b)
// n = a(m + 1) 1, 2, 4, 8

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
	int a;
	cin >> a;
	int ans = a + a * a + a * a * a;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b){
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


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

int divisor(int a){
  int cnt = 0;
  for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
  return cnt;
}

int comb(int n, int k){
  return factorial(n) / (factorial(n-k)*factorial(k));
}

int answer(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}






int main(){
  int a,b;
  cin >> a >> b;
  if(b-a >= 0) cout << a << endl;
  else cout << a-1 << endl;
  
  return 0;
}









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

using namespace std;

int popcount(int x) {
    int ret = 0;
    for (int i = 0; i < 30; i++) {
        if (x & (1 << i))ret++;
    }
    return ret;
}

int main() {
    vector<int> dp(200001);
    for (int i = 1; i <= 200000; i++) dp[i] = dp[i % popcount(i)] + 1;

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

    int initPop = 0;
    for (auto c:s) {
        if (c == '1')initPop++;
    }

    int plus = 0, minus = 0;
    int plusBit = 1, minusBit = 1;
    vector<int> next(n);
    for (int i = 0; i < n; i++) {
        plus *= 2, minus *= 2;
        plus += s[i] - '0', minus += s[i] - '0';
        plus %= initPop + 1, minus %= max(1, initPop - 1);

        if (s[n - i - 1] == '0') next[n - i - 1] += plusBit;
        else next[n - i - 1] += max(1, initPop - 1) - minusBit;

        plusBit *= 2, minusBit *= 2;
        plusBit %= initPop + 1, minusBit %= max(1, initPop - 1);
    }
    for (int i = 0; i < n; i++) {
        if (s[i] == '0') next[i] += plus, next[i] %= initPop + 1;
        else next[i] += minus, next[i] %= max(1, initPop - 1);;
    }

    for (int i = 0; i < n; i++) {
        if (initPop == 1 && s[i] == '1')cout << 0 << endl;
        else cout << dp[next[i]] + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 5232
#include <stdio.h>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

int main(void){
	FOR(i, 1, 10) FOR(j, 1, 10) printf("%dx%d=%d\n", i, j, i*j);
}

Measured memory_bytes: 2572
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int     MOD = (int) 1E9 + 7;
    
    public static void main(String[] args) {
        int N = nint();
        Pair[] A = new Pair[N];
        
        for (int i = 0; i < N; i++) {
            A[i] = new Pair(nint(), i+1);
        }
        
        Arrays.sort(A, Pair.A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i].b + " ");
        }
    }

    static class Pair {
        long a;
        long b;
        public long getA() {return a;}
        
        public Pair(long a, long b) {
            super();
            this.a = a;
            this.b = b;
        }
        
        static Comparator<Pair> A = Comparator.comparing(Pair::getA);
        
        @Override
        public String toString() {
            return "a = " + a + ", b = " + b;
        }
    }
    
    private static int nint() {
        return sc.nextInt();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static double ndouble() {
        return sc.nextDouble();
    }

    private static double[] ndoubles(int n) {
        return ndoubles(n, 0, 0);
    }

    private static double[] ndoubles(int n, int padL, int padR) {
        double[] d = new double[n + padL + padR];
        for (int i = 0; i < n; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0, 0);
    }

    private static char[][] nchars2(int h, int w, int padLU, int padRD) {
        char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);
        return a2;
    }

    private static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    private static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    private static long abs(long a, long b) {
        return Math.abs(a - b);
    }
}


Measured memory_bytes: 95760
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int INF = 1<<30;

int main(){
  int n;cin>>n;
  int res=n;
  for(int i=0;i<=n;i++){
  	int tmp=0;
    int t=i;
    while(t>0)tmp+=t%6, t/=6;
    t=n-i;
    while(t>0)tmp+=t%9, t/=9;
    res = min(res, tmp);
  }
  cout<<res<<endl;
}

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

idx_of_min, idx_of_max = 0, 0
for i in range(n):
    if a[i] < a[idx_of_min]:
        idx_of_min = i
    if a[i] > a[idx_of_max]:
        idx_of_max = i

print(a[idx_of_max] - a[idx_of_min])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s,t;
    while(cin >> t){
        s+=t;
    }
    vector<int>cnt(26);
    for(int i=0;i<26;i++){
        cnt.at(i)=0;
    }
    for(int i=0;i<s.size();i++){
        if('a'<=s.at(i)&&s.at(i)<='z'){
            cnt.at(s.at(i)-'a')++;
        }
        if('A'<=s.at(i)&&s.at(i)<='Z'){
            cnt.at(s.at(i)-'A')++;
        }
    }
    for(int i=0;i<26;i++){
        cout << (char)('a'+i) << " : " << cnt.at(i) << endl;
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#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 mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<vi> adj(n);
    rep(i,n){
        int a; cin>>a; a--;
        adj[i].pb(a);
    }
    queue<int> que;
    que.push(0);
    vi dist(n,-1);
    dist[0] = 0;
    while(!que.empty()){
        int v = que.front(); que.pop();
        for(auto u:adj[v]){
            if (dist[u]!=-1) continue;
            dist[u]=dist[v]+1;
            que.push(u);
        }
    }
    cout<<dist[1]<<"\n";
    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
   if (a < b) {
     swap(a,b);
   }
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main() {
  int k;
  cin >> k;
  int64_t sum = 0;
  for(int i = 1; i <= k; i++) {
    for(int j = 1; j <= k; j++) {
      for(int l = 1; l <= k; l++) {
        int m = gcd(i,j);
        sum += gcd(m,l);
      }
    }
  }
  cout << sum << endl;
}




Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

class UnionFind{
    vector<int> par;
    vector<int> rank;
    
public:
    UnionFind(int n): par(n), rank(n){
        REP(i, n){
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int find(int x){
        if(x == par[x]) return x;
        else return par[x] = find(par[x]);
    }
    
    void unit(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        
        if(rank[x] < rank[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) ++rank[x];
        }
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main(){
    int n, m; cin >> n >> m;
    vector<int> p(n);
    UnionFind tree(n);
    REP(i, n){
        cin >> p[i]; --p[i];
    }
    
    REP(i, m){
        int x, y; cin >> x >> y; --x; --y;
        tree.unit(x, y);
    }
    int cnt=0;
    REP(i, n) if(tree.same(i, p[i])) ++cnt;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<string>
using namespace std;
int dp[301][301][301];
int main()
{
	string str;
	int q;
	cin>>str>>q;
	int l=str.size();
//	cout<<l<<endl;
	for(int i=l-1;i>=0;i--)
	{
		for(int k=0;k<=q;k++)
			dp[i][i][k]=1;
	}
	for(int i=l-1;i>=0;i--)
	{
		
		for(int j=i+1;j<=l-1;j++)
		{
			for(int k=0;k<=q;k++)
			{
				//dp[i][i][k]=1; 
				if(str[i]==str[j]) dp[i][j][k]=max(dp[i+1][j-1][k]+2,dp[i][j][k]);
				else
				{
					
					if(k!=0)
					{
						dp[i][j][k]=max(dp[i+1][j-1][k-1]+2,dp[i][j][k]);
					}
					dp[i][j][k]=max(dp[i+1][j][k],dp[i][j][k]);
					dp[i][j][k]=max(dp[i][j-1][k],dp[i][j][k]);
				}
			}
		}
	}
	int ans=0;
	for(int k=0;k<=q;k++)
			ans=max(ans,dp[0][l-1][k]);
	cout<<ans<<endl;
 } 

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

int main()
{
    char a[119999];
    scanf("%s",a);
    int len = strlen(a);
    int sum = 0;
    //cout<<sum<<endl;
    if(!(len%2))
    {
        if(a[0]==a[len-1])
            printf("First\n");
        else printf("Second\n");
    }
    else
    {
        if(a[0]==a[len-1])
            printf("Second\n");
        else printf("First\n");
    }

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005],k;
ll dp[100005];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>h[i];
	dp[1] = 0;
	for(int i=2;i<=n;i++){
		dp[i] = 1e18;
		for(int x=1;x<=k;x++){
			if(i-x<=0) break;
			dp[i] = min(dp[i],dp[i-x]+abs(h[i]-h[i-x]));
		}
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1408
n = int(input())
xy_l = [[] for i in range(n)]
cnt = 0
for i in range(n):
    a = int(input())
    for j in range(a):
        xy = list(map(int, input().split()))
        xy_l[i].append(xy)
# 　括りとして、x,yの組み合わせ、人ごとの証言の組み合わせでそれぞれ分ける

for k in range(1 << n):
    ev = [0]*n
    for l in range(n):
        if (k >> l) & 1:
            ev[l] = 1
    #         ここまでで仮定は完成
    f = True
    for p,q in enumerate(xy_l):  # 第一変数はindexで第二変数が要素
        if ev[p]:
            for r in q:  # xy_lの要素
                if r[1] != ev[r[0] - 1]:
                    f = False
    if f:
        cnt = max(cnt, ev.count(1))

print(cnt)

Measured memory_bytes: 3064
n = int(input())
c = list(input())

w = 0
r = c.count('R')
l = [0] * (n + 1)
l[0] = r
for i in range(n):
    if c[i] == 'W':
        w += 1
    else:
        r -= 1
    l[i + 1] = max(w, r)
    
print(min(l))

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

long gcd(long a, long b){
  if(a<b)return gcd(b, a);
  if(b==0)return a;
  else return gcd(b, a%b);
}

int main(){
  long a, b;
  cin >> a >> b;
  cout << a*b/gcd(a, b);
  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

counter = dict()
for i in s:
  counter[i] = counter.get(i, 0) + 1
for i in t:
  counter[i] = counter.get(i, 0) - 1

print(max(max(counter.values()), 0))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, x, cnt;
  cin >> a >> b >> c >> x;
  for(int i = 0; i <= a; i++){
    for(int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        if(i * 500 + j * 100 + k * 50 == x) cnt++;
      }
    }
  }
  cout << cnt << endl;
}
  


Measured memory_bytes: 256
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

x = iinput()
flag = x>=30
ans = "Yes" if flag else "No"
print(ans)


Measured memory_bytes: 37736
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	lint N, X;
	cin >> N >> X;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	lint sum1 = 0;
	rep(i, N) {
		sum1 += A[i];
	}
	for (int i = 1; i < N; i++) {
		 lint a = max(X - A[i - 1], lint(0));
		A[i] =min(a,A[i]);
	}
	A[0] = min(A[0],X - A[1]);
	lint sum2 = 0;
	rep(i, N) {
		sum2 += A[i];
	}
	cout << sum1 - sum2 << endl;
}

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

#define int long long
#define ll long long
#define pb push_back

main(){
    int k, a, b;
    cin >> k >> a >> b;
    if (b / k > a / k || a % k == 0 || b % k == 0) cout << "OK";
    else cout << "NG";
}


Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define st first
#define nd second
#define KW(a) ((a)*(a))
using namespace std;
 
const int maxN = 3002;

int dur[maxN], cost[maxN], suf[maxN];
int dp[maxN][maxN];

pair <int, int> in[maxN];

void solve()
{
	int n, t;
	scanf ("%d%d", &n, &t);
	FOR(i, 1, n+1)
		scanf("%d%d", &in[i].first, &in[i].second);
	sort(in+1, in+n+1);
	FOR(i, 1, n+1)
		tie(dur[i], cost[i]) = in[i];
	
	for (int i=n; i>=0; i--)
		suf[i] = max(cost[i], suf[i+1]);
	
	FOR(i, 1, t+1) FOR(j, 1, n+1)
	{
		dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		if (dur[j] <= i)
			dp[i][j] = max(dp[i][j], dp[i-dur[j]][j-1] + cost[j]);
	}
	
	int res = dp[t][n];
	FOR(i, 0, t) FOR(j, 0, n)
		res = max(res, dp[i][j] + suf[j+1]);
	printf("%d\n", res);
}
 
int main()
{
	int t;
	t=1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}



Measured memory_bytes: 35584
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]

x, y = map(int, input().split())

if x in group1:
    if y in group1:
        print('Yes')
    else:
        print('No')

if x in group2:
    if y in group2:
        print('Yes')
    else:
        print('No')

if x in group3:
    if y in group3:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#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 (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int N,K;
	cin>>N>>K;
	cout<<N-K+1<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100000
int A[N];
void parti(int [],int);

int main()
{
  int n,i;

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

  return 0;
}

void parti(int A[], int r)
{
  int j,i,swp,x,t;

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

  for(j=0; j<r; j++)
    {
      if(A[j]<=x)
        {
          i++;
          swp=A[i];
          A[i]=A[j];
          A[j]=swp;
        }
    }
  A[r]=A[i+1];
  A[i+1]=x;

  for(t=0; t<r+1; t++)
    {
        if(t==i+1)
        {
          printf("[%d]",A[t]);
          printf(" ");
        }
      else
        {
          printf("%d",A[t]);
          if(t!=r) printf(" ");
        }
    }
  printf("\n");
}


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

int main(){
  int N; cin>>N;
  int i=1;
  int ans=0;
  if(N==2||N==1){
    ans=4;
  }
  while(N!=4){
    if(N%2){
      N=3*N+1;
    }else
      N/=2;
    i++;
  }
  if(ans){}
  else{
    ans=i+3;
  }
  cout<<ans<<endl;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    if (a<b){
     cout<<"a < b"<<endl;
    } else if (a>b) {
     cout<<"a > b"<<endl;
    } else if (a == b) {
     cout<<"a == b"<<endl;
    }

}


Measured memory_bytes: 3076
num=input().rstrip().split(" ")
num1=int(num[0])
num2=int(num[1])
if num1%num2==0:
  print(0)
else:
  date0=num1%num2
  date1=num2-date0
  if date0>date1:
    print(date1)
  else:
    print(date0)

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

int d_max = 101;

int main() {
  int n;
  cin >> n;
  vector<int> ans(d_max);
  int d = 0;

  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    ans.at(j)++;
  }
  for (int i = 0; i < d_max; i++) {
    if (ans.at(i) >= 2) ans.at(i) = 1;
    if (ans.at(i) == 1) d++;
  }
  cout << d;
}


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

int main()
{
  long long int N;
  cin >> N;
  vector<long long int> a(N);
  for (int i = 0; i < N; i++)
  {
    cin >> a.at(i);
  }
  bool can = false;
  map<long long, long long> mp;
  for (int i = 0; i < N; i++)
    mp[a[i]]++;
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  if (mp.size() == 1 && a[0] == 0)
    can = true;
  if (mp.size() == 2)
  {
    if (N % 3 == 0 && a[0] == 0 && mp[a[0]] == N / 3)
      can = true;
  }
  if (N % 3 == 0 && mp[a[0]] == N / 3 && mp[a[1]] == N / 3 && mp[a[2]] == N / 3 && (a[0] ^ a[1] ^ a[2]) == 0)
    can = true;
  if (can)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main() {
    int n;
    cin >> n;
    map<string, int> d;
    
    rep(i,n) {
        string s;
        cin >> s;
        d[s] += 1;
    }

    int maxv;
    maxv = -1;
    for (const auto p : d) maxv = max(maxv, p.second);
    for (const auto p : d) {
        if (p.second != maxv) continue;
        cout << p.first << endl;
    }

    return 0;
}

Measured memory_bytes: 25216
def solve(n, k, al):
    bin_k = format(k,"b")
    len_k = len(bin_k)
    
    # search
    answer = 0
    enable_one = False
    zero_limit = n // 2
    for i in range(len_k,-1,-1):
        bit = 1 << i
        answer = answer << 1
        if enable_one or ((k & bit) != 0):
            # 0 or 1 case
            zero_count = 0
            for e in al:
                if (e & bit) == 0:
                    zero_count += 1
            if zero_count > zero_limit:
                answer += 1
            else:
                enable_one = True
    # print(answer)

    s = 0
    for e in al:
        s = s + (answer ^ e)
    print(s)

def main():
    n, k = map(int, input().split())
    al = list(map(int, input().split()))
    solve(n, k, al)

main()   

Measured memory_bytes: 14708
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int main()
{
	long long a, b;
	scanf("%lld%lld", &a, &b);
	
	long long temp;
	
	long long al;
	long long ah;
	temp = 25 * a;
	if (temp % 2 == 0)
		al = 25 * a / 2;
	else
		al = (25 * a / 2) + 1;
	
	temp = 25 * (a + 1);
	if (temp % 2 == 0)
		ah = 25 * (a + 1) / 2;
	else
		ah = (25 * (a + 1) / 2) + 1;
	ah--;
	
	long long bl = 10 * b;
	long long bh = 10 * b + 9;
	
	long long ll, hh;
	if (al < bl)
		ll = bl;
	else
		ll = al;
		
	if (ah < bh)
		hh = ah;
	else
		hh = bh;
		
	if (ll <= hh) {
		printf("%lld\n", ll);
	} else {
		printf("-1\n");
	}
			
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int N, i;
	cin >> N >> i;

	cout << N - i + 1;

	return 0;
}


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

int main() {
    int n, x, t;
    int a[1010];
    cin >> n;
    cin >> t >> x;
    for (int i = 1; i <= n; i++) cin >> a[i];
    
    int ans = 1;
    float gap = abs((float)(t - a[1] * 0.006) - x);
    for (int i = 2; i <= n; i++) {
        if (abs((float)(t - a[i] * 0.006) - x) < gap) {
            ans = i;
            gap = abs((float)(t - a[i] * 0.006) - x);
        }
    }
    cout << ans << '\n';
    return 0;
}


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


int main() {
  	int w, h, k; cin >> h >> w >> k;
  	char m[7][7];
  	for (int i = 0; i < h; i++)
      	for (int j = 0; j < w; j++)
          	cin >> m[i][j];
  	long long ans = 0;
  	for (int sr = 0; sr < (1<<h); sr++)
      	for (int sc = 0; sc < (1<<w); sc++) {
        	int count = 0;
          	for (int i = 0; i < h; i++)
              	for (int j = 0; j < w; j++)
                  	if (m[i][j] == '#' && (!(sr & (1<<i)) && !(sc & (1<<j)))) count++;
          	if (count == k) ans++;
        }
  	cout << ans << '\n';
}


Measured memory_bytes: 3600
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[13];
		Arrays.fill(S, 1);
		int[] H = new int[13];
		Arrays.fill(H, 1);
		int[] C = new int[13];
		Arrays.fill(C, 1);
		int[] D = new int[13];
		Arrays.fill(D, 1);
		
		for(int i = 0; i < n; i++) {
			String suit = sc.next();
			int r = sc.nextInt();
			switch(suit) {
				case "S":
					S[r - 1] = 0;
					break;
				case "H":
					H[r - 1] = 0;
					break;
				case "C":
					C[r - 1] = 0;
					break;
				case "D":
					D[r - 1] = 0;
					break;
			}
		}
		for(int i = 0; i < 13; i++) {
			if(S[i] == 1) {
				System.out.println("S " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++) {
			if(H[i] == 1) {
				System.out.println("H " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++) {
			if(C[i] == 1) {
				System.out.println("C " + (i + 1));
			}
		}
		for(int i = 0; i < 13; i++) {
			if(D[i] == 1) {
				System.out.println("D " + (i + 1));
			}
		}
		sc.close();
	}
}



Measured memory_bytes: 26404
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;
typedef pair<P,int>P1;
vector<P>v[100009];
int n,m,a1,a2,a3,a4;
int d[100009],pre[100009];
int xx[100009];
map<P,int>M;
int main(){
  while(cin>>n>>m,n){
    fill(d,d+n,(int)1e9);
    fill(xx,xx+n,(int)1e9);
    r(i,n)v[i].clear();
    r(i,m){
      cin>>a1>>a2>>a3>>a4;
      a1--,a2--;
      v[a1].push_back(P(a2,a3));
      v[a2].push_back(P(a1,a3));
      M[P(a1,a2)]=a4;
      M[P(a2,a1)]=a4;
    }
    priority_queue<P1,vector<P1>,greater<P1> >q;
    d[0]=0;
    int ans=0;
    q.push(P1(P(0,0),0));
    while(!q.empty()){
      P1 p=q.top();q.pop();
      int cost=p.first.first;
      int now=p.second;
      if(d[now]<cost)continue;
      d[now]=cost;
      xx[now]=min(xx[now],p.first.second);
      r(i,v[now].size()){
        P p=v[now][i];
        int next=p.first;
        int cost2=cost+p.second;
        if(d[next]>=cost2){
          q.push(P1(P(cost2,M[P(now,next)]),next));
        }
      }
    }
    r(i,n-1)ans+=xx[i+1];
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 30776
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        String s = sc.next();
        int k = sc.nextInt();
        String ans = "";
        char ch = s.charAt(k - 1);
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) != ch) {
                ans += "*";
            } else {
                ans += s.charAt(i);
            }
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
// Haiku

#include <iostream>

using namespace std;

int main(){
	string s;
	cin >> s;

	for (int i = 0; i < s.length(); ++i){
		if (s[i] == ',')
			cout << ' ';
		else
			cout << s[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000 
const long long  MOD =1e9+7;
#define MAXR 100000 
int main(){
    int N;
    cin >> N;
    long int L[N];
    int count =0;
    for(int i=0;i<N;i++)cin >> L[i];
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if((L[i]!=L[j])&&(L[j]!=L[k])&&(L[k]!=L[i])){
                    if((L[i]+L[j]>L[k])&&(L[j]+L[k]>L[i])&&(L[k]+L[i]>L[j]))count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <sstream>

bool match(std::string &s, const std::string &t)
{
    int N = s.size(), M = t.size();
    if (N < M) {
        return false;
    }

    for (int i = 0; i < M; i++) {
        if (s[i] != t[i]) {
            return false;
        }
    }

    s = s.substr(M);
    
    return true;
}

int main()
{
    constexpr int SIZE = 26 + 12;
    const std::string let[SIZE] = {
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
        "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
        "u", "v", "w", "x", "y", "z",
        "ld", "mb", "mp", "nc", "nd", "ng", "nt", "nw", "ps", "qu",
        "cw", "ts"
    };

    std::vector<std::vector<int>> count(SIZE, std::vector<int>(SIZE, 0));
    
    int N;
    std::cin >> N;
    std::cin.ignore();
    for (int i = 0; i < N; i++) {
        std::string s;
        std::getline(std::cin, s);
        std::stringstream ss{s};
        while (ss >> s) {
            int prev = -1;
            while (!s.empty()) {
                for (int j = SIZE - 1; j >= 0; j--) {
                    if (match(s, let[j])) {
                        if (prev != -1) {
                            count[prev][j]++;                         
                        }
                        prev = j;
                        break;
                    }
                }
            }            
        }        
    }
    
    for (int i = 0; i < SIZE; i++) {
        int max = -1, mi = -1;
        for (int j = 0; j < SIZE; j++) {
            if (count[i][j] > max) {
                max = count[i][j];
                mi = j;
            }
        }
        std::cout << let[i] << " " << let[mi] << " " << count[i][mi] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include <stdio.h>

int main(){
	int a, b;
	scanf("%d %d",&a,&b);
	if (a > b)
		printf("a > b\n");
	if (a < b)
		printf("a < b\n");
	if (a == b)
		printf("a == b\n");
	return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std ;
void Read ( int &x, char c = getchar(), bool f = 0 ) {
	for ( x = 0 ; !isdigit(c) ; c = getchar() ) if (c == '-') f = 1 ;
	for ( ; isdigit(c) ; c = getchar() ) x = 10*x + c - '0' ;
	if (f) x = -x ;
}
const int maxn = 1e5+5 ;
int n, m, cnt[maxn] ;
bool vis[maxn] ;
int main() {
	int i, x, u, _ ;
	Read(n) ; Read(_) ;
	for ( i = 1 ; i <= n ; i ++ ) cnt[i] = 1 ;
	memset ( vis, 0, sizeof vis ) ;
	vis[1] = 1 ;
	while(_--) {
		Read(x) ;
		Read(u) ;
		--cnt[x] ;
		++cnt[u] ;
		if (vis[x]) vis[u] = 1 ;
		if (cnt[x] == 0) vis[x] = 0 ;
	}
	for ( x = 0, i = 1 ; i <= n ; i ++ )
		if (vis[i]) ++ x ;
	printf ( "%d\n", x ) ;
	return 0 ;
}

Measured memory_bytes: 768
n = int(input())
x = list(input())
sta = 0
left = 0
for i in range(n):
    if x[i] == '(':
        sta += 1
    else:
        if sta == 0:
            left += 1
        else:
            sta -= 1
s = []
for i in range(left):
    s.append('(')
for i in range(n):
    s.append(x[i])
for i in range(sta):
    s.append(')')
print(''.join(s))

Measured memory_bytes: 38256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll t1, t2;
    cin >> t1 >> t2;
    ll a1, a2, b1, b2;
    cin >> a1 >> a2 >> b1 >> b2;

    if(t1*a1+t2*a2 == t1*b1+t2*b2) {
        cout << "infinity" << endl;
        return 0;
    }

    if(t1*a1+t2*a2 > t1*b1+t2*b2) {
        if(a1 > b1) {
            cout << 0 << endl;
            return 0;
        }
        ll hh = t1*a1+t2*a2 - (t1*b1+t2*b2);
        ll sa = t1*(b1-a1);
        cout << sa/hh*2+(sa%hh ? 1:0) << endl;
        return 0;
    }
    if(a1 < b1) {
        cout << 0 << endl;
        return 0;
    }
    ll hh = -(t1*a1+t2*a2) + (t1*b1+t2*b2);
    ll sa = t1*(a1-b1);
    cout << sa/hh*2+(sa%hh ? 1:0) << endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[tuple(map(int,input().split())) for _ in range(m)]
d=[[float("inf")]*n for _ in range(n)]

for a,b,c in l:
  d[a-1][b-1]=c
  d[b-1][a-1]=c

for k in range(n):
  for i in range(n):
    for j in range(n):
      d[i][j]=0 if i==j else min(d[i][j],d[i][k]+d[k][j])

ans=m
for a,b,c in l:
  f=False
  for s in range(n):
    if d[s][a-1]+c==d[s][b-1]:
      f=True
  if f:ans-=1

print(ans)

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

long long n, k;
long long ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> k;
	if(k == 0) ans = n * n;
	else{
		for(int i=k+1; i<=n; ++i){
			ans += (i-k)*((n-k)/i) + (1+min(n,(n-k)/i*i+i-1)-k-(n-k)/i*i);
//			cout << i << " " << ans << "\n";
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);
	
	void solve(){
		int[]a={s.nextInt(),s.nextInt(),s.nextInt()};
		Arrays.sort(a);
		System.out.println(a[2]-a[0]);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}


Measured memory_bytes: 22100
n,q=gets.split.map &:to_i
s=gets.chomp
if q==2||q==5
  puts (0...n).reduce(0){|a,i| (s[i].ord-48)%q==0 ? a+i+1 : a }
  exit
end
t=1
cs=[]
(n-1).downto(0){|i|
  cs[i]=t
  t=t*10%q
}
rcs=[0]*q
rcs[0]=1
t=0
n.times{|i|
  t=(t*10+s[i].ord-48)%q
  r=t*cs[i]%q
  rcs[r]+=1
}
puts rcs.reduce(0){|a,rc| rc>1 ? a+rc*(rc-1)/2 : a } 

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;


int main(){
  int n,k;
  double a[200010],b[200010];
  
  cin >> n >> k;
  for(int i=0;i<n;i++)
    cin >> a[i];
  
  for(int i=0;i<k;i++){
   b[0] += (a[i]+1)/2;
  }
  
  for(int i=0;i<n-k;i++){
  b[i+1] = b[i] -(a[i]-a[i+k])/2;
  }
  
 sort(b,b+n-k+1,greater<double>());
  
 
  cout <<setprecision(10) << b[0] << endl;
}
  

  


Measured memory_bytes: 3328
N = int(input())
A = list(map(lambda x:int(x) - 1, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
happy = 0
lastDish = -2
for i in A:
    happy += B[i]
    if i - 1 == lastDish:
        happy += C[i - 1]
    lastDish = i
print(happy)

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

typedef long long LL;

LL A, B;

LL solve(){
	if(A == B)	return 1;
	LL key;
    for(LL i=60; i>=0; i--){
		if((A>>i & 1) != (B>>i & 1)){
			key = i;
			break;
		}
    }

	LL key0 = -1;
    for(LL i=key-1; i>=0; i--){
		if(B >> i & 1){
			key0 = i;
			break;
		}
    }

	for(LL i=key0; i>=0; i--){
		B |= (1LL << i);
	}

    if(B < (A | (1LL << key))){
        return ((A | ((1LL << key) - 1)) - A + 1) + B - A + 1;
    } else {
        return (A | ((1LL<<(key+1)) - 1)) - A + 1;
    }
}

int main(){
	while(~scanf("%lld %lld", &A, &B)){
        printf("%lld\n", solve());
	}
	return 0;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

class SegTree:
    def __init__(self, N):
        self.N = N
        self._N = 1<<((N-1).bit_length())
        self.node = [0]*2*self._N

    def build(self,lis):
        for i in range(self.N):
            self.node[i+self._N-1] = lis[i]
        for i in range(self._N-2,-1,-1):
            self.node[i] = self.node[i*2+1] | self.node[i*2+2]
        return

    def update(self,i,x):
        i += self._N-1
        self.node[i] = x
        while i:
            i = (i-1)>>1
            self.node[i] = self.node[i*2+1] | self.node[i*2+2]

    def query(self,p,q,idx=0,a=0,b=None):
        if b is None:
            b = self._N
        if q <= p or b <= p or q <= a:
            return 0
        elif p <= a and b <= q:
            return self.node[idx]
        else:
            res1 = self.query(p,q,idx*2+1,a,(a+b)//2)
            res2 = self.query(p,q,idx*2+2,(a+b)//2,b)
            return res1 | res2

n = ni()
oa = ord('a')
conv = lambda x: 1<<(ord(x)-oa) 
s = list(map(conv, list(input())))
q = ni()
S = SegTree(n)
S.build(s)
for _ in range(q):
    x,y,z = input().split()
    if x == '1':
        y = int(y)
        S.update(y-1, conv(z))
    else:
        y = int(y)
        z = int(z)
        # print(S.node[S._N-1:], y, z)
        v = S.query(y-1,z)
        # print(v, bin(v))
        print(str(bin(v)).count('1'))


Measured memory_bytes: 47636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	int tmp, sum = 0;
	REP(i, 5){
		cin >> tmp;
		if (tmp < 40) sum += 40;
		else sum += tmp;
	}

	cout << sum / 5 << endl;
}


Measured memory_bytes: 3120
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

long long func(long long a){
	return (a>0)?a:-a;
}

int main(){
	long long x,y,cnt=0;
	cin>>x>>y;
	if(x>y){
		if(y>0)cout<<2+x-y<<endl;
		else{
			if(x>=0)cout<<1+func(func(x)-func(y))<<endl;
			else cout<<2+func(func(x)-func(y))<<endl;
		}	
	}else{
		if(x>=0)cout<<y-x<<endl;
		else{
			if(y>0)cout<<1+func(func(y)-func(x))<<endl; 
			else cout<<func(func(y)-func(x))<<endl;
		}
	}
	return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
   ll t=1;
   //cin>>t;
   while(t--)
   {
       ll a,b,c;
       ll k;
       cin>>a>>b>>c>>k;
       while(b<=a&&k>0)
       {
           b=b*2;
           k--;
       }
       if(k<0)
        cout<<"No"<<endl;
       else
       {
           while(c<=b&&k>0)
           {
               c=c*2;
               k--;
           }
           if(c>b&&b>a)
            cout<<"Yes"<<endl;
           else
            cout<<"No"<<endl;
       }
   }

}


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

int gcd(int x, int y)
{
	if (x < y)
	{
		int temp = y;
		y = x;
		x = temp;
	}
	int t = x%y;
	while (t)
	{
		x = y;
		y = t;
		t = x%y;
	}
	return y;
}

int main()
{
	long long x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;
	return 0;
}

Measured memory_bytes: 3088
#include <cstdio>
#include <utility>
#include <vector>
#include <unordered_map>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int n; (n = in());) {
		int c = 0;
		vector<int> s(n), p(n);
		for (int &x: s)
			x = in();

		for (; s != p; c++) {
			p = s;
			unordered_map<int, int> m;
			for (int x: s)
				m[x]++;
			for (int i = 0; i < n; i++)
				s[i] = m[p[i]];
		}
		outl(c - 1);
		out(s);
	}
}


Measured memory_bytes: 2552