akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	ll n,k;
	
	while(cin>>n>>k){
		ll ans=n/k;
		if(!(n%k)) cout<<0<<endl;
		else cout<<1<<endl; 
	}
	
} 

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(int(2e5+999))

def solve():
    n,m=map(int,input().split()[0:2])

    fa=list(range(0,n+1))
    sz=[1]*(n+1)
    def gf(x) :
        if x==fa[x] :
            return x
        fa[x]=gf(fa[x])
        return fa[x]

    for i in range(m) :
        a,b=map(gf,map(int,input().split()[0:2]))
        if a!=b :
            fa[a]=b
            sz[b]+=sz[a]

    ans=1
    for i in range(1,n+1) :
        ans=max(ans,sz[gf(i)])
    return ans

print(solve())


Measured memory_bytes: 231888
import java.lang.Integer
import java.lang.Long

fun main(args: Array<String>) {
    val N = readInputLine().toInt()

    // i>=2 の場合、a_i,jは[0,2]となり、この計算は差を見るため全体を1引いても問題なし
    val a = readInputLine().map { it - '1' }.toIntArray()

    val isOdd = a.foldIndexed(false) {
        index, acc, a ->
        if (a % 2 == 0) {
            acc
        } else {
            if (lucas(N - 1, index, 2) == 1) {
                !acc
            } else {
                acc
            }
        }
    }

    if (isOdd) {
        println(1)
    } else {
        if (a.contains(1)) {
            println(0)
        } else {
            val isTwo = a.foldIndexed(false) {
                index, acc, a ->
                if (a == 0) {
                    acc
                } else {
                    if (lucas(N - 1, index, 2) == 1) {
                        !acc
                    } else {
                        acc
                    }
                }
            }
            if (isTwo) {
                println(2)
            } else {
                println(0)
            }
        }
    }
}

fun readInputLine(): String {
    return readLine()!!
}

// nCm mod p (p is prime number)
fun lucas(n: Int, m: Int, p: Int): Int {
    if (m > n) {
        return 0
    }

    var ret = 1L

    val nDec = Integer.toString(n, p)
    val mDec = Integer.toString(m, p).padStart(nDec.length, '0')

    for (i in 0 until nDec.length) {
        val nNum = Long.parseLong(nDec[i].toString(), p)
        val mNum = Long.parseLong(mDec[i].toString(), p)

        if (mNum > nNum) {
            return 0
        }

        for (j in LongRange(1L, nNum)) {
            ret *= j
        }
        for (j in LongRange(1L, mNum)) {
            ret /= j
        }
        for (j in LongRange(1L, mNum - nNum)) {
            ret /= j
        }
    }

    return ret.toInt()
}


Measured memory_bytes: 128448
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x;
    std::cin >> x;
    long long int sum=0;
    for (int i = 1; i <= x; i++) {
        sum+=i;
        if(sum>=x){
            std::cout << i << std::endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


// 1白
// 2黒

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,now,a,b,w;
	cin >> n;
	vector<int> co(n,0);
	vector<vector<P>> tree;
	tree.resize(n);
	FOR(i,0,n-1){
		cin >> a >> b >> w;
		a--;b--;
		tree[a].push_back(make_pair(b,w&1));
		tree[b].push_back(make_pair(a,w&1));
	}
	stack<int> q;
	q.push(0);
	co[0] = 1;
	while(!q.empty()){
		now = q.top();
		q.pop();
		for(auto to:tree[now]){
			if(co[to.first]==0){
				co[to.first] = (3-co[now])*(to.second==1)+co[now]*(to.second!=1);
				q.push(to.first);
			}
		}
	}
	FOR(i,0,n){
		cout << co[i]-1 << endl;
	}
}


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

string s;
long long sumnum=0;

long long mathplus(string instr){
  string nowstr;
  long long ans =0;
  for(int i=0;i<instr.size();i++){
    if(instr.at(i)=='+'){
    ans+= stoll(nowstr.c_str());
    nowstr="";
    }
    else{
     nowstr+=instr.at(i);
    }
  }
  ans+= stoll(nowstr.c_str());
  return ans;
}
void sumrepeat(int si,string instr){
	if(si<0){
      sumnum+=mathplus(instr);
      return;
    }
  	sumrepeat(si-1,instr);
  
  	if(si>0){
      instr.insert(si,"+");
      sumrepeat(si-1,instr);
    }
  
}

int main(){
  cin >> s;
  sumrepeat(s.size()-1,s);
  cout << sumnum << endl;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int a[n],next = 0;
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = 0; i < n; i++){
        if(next == 1){
            cout << i << endl;
            return 0;
        }else next = a[next] - 1;
    }
    cout << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <ctime>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <chrono>
#include <stack>
#include <cassert>
#include <queue>
#include <deque>
#include <climits>
#include <cstring>
#include <random>
#include <bitset>

using namespace std;

typedef long double ld;

const ld uu = 0.006;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif
    
    int n;
    cin >> n;
    ld t;
    cin >> t;
    ld a;
    cin >> a;
    vector<ld> tmp(n);
    for (auto &t : tmp) {
        cin >> t;
    }
    
    int best = 0;
    for (int i = 0; i < n; i++) {
        if (abs(a - (t - uu * tmp[i])) < abs(a - (t - uu * tmp[best]))) {
            best = i;
        }
    }
    cout << best + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<double> VL;
typedef vector<string> VS;
typedef vector<PLL> VP;
typedef vector<ll> VLL;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    vector<vector<int>> s(11, vector<int>(11));
    cin >> N >> M;
    VI k(M),p(M);
    rep(i,M){
        cin >> k[i];
        rep(j,k[i]){
            cin >> s[i][j];
        }
    }
    rep(i,M){
        cin >> p[i];
    }

    int switch_count=0;
    int denkyu_count=0;
    int ans=0;
    for(int i=0; i<(1<<N); i++){
        rep(j,M){
            rep(l,k[j]){  
                if((i>>(s[j][l]-1))&1){
                    switch_count++;
                }
            }
            if(switch_count%2==p[j]){
                denkyu_count++;
            }
            switch_count=0;
        }
        if(denkyu_count==M){
            ans++;
        }
        denkyu_count=0;
    }
    cout << ans << endl;
}


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

if 400 <= X and X  <= 599:
    print(8)
elif 600 <= X and X <= 799:
    print(7)
elif 800 <= X and X <= 999:
    print(6)
elif 1000 <= X and X <= 1199:
    print(5)
elif 1200 <= X and X <= 1399:
    print(4)
elif 1400 <= X and X <= 1599:
    print(3)
elif 1600 <= X and X <= 1799:
    print(2)
elif 1800 <= X and X <= 1999:
    print(1)

Measured memory_bytes: 9196
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}
bool b[200001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	char c;
	int N = 0;
	while ((c = getchar_unlocked()) >= '0') N = N * 10 + c - '0';

	bool a[200001];
	rep1(i, N) {
		a[i] = getchar_unlocked() - '0';
		getchar_unlocked();
	}

	int kazu = 0;
	for (int i = N; i > 0; i--) {
		bool k = a[i];
		for (int j = i + i; j <= N; j += i) {
			k ^= b[j];
		}
		if (k) {
			kazu++;
			b[i] = true;
		}
	}
	if (kazu == 0) {
		*di++ = '0';
		*di++ = '\n';
	}
	else putint(kazu);
	rep1(i, N) {
		if (b[i]) putint(i);
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n)  for (int i = 0; i < n; i++)
#define loop(i,a,n)  for (int i = a; i <= n; i++)
#define deb(x) cout << #x << " = " << x <<'\n'
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int same = 0;
    for(int i = 0; i < n; ++i){
        int a,b;
        cin >> a >> b;
        if(same == 3){
            break;
        }
        if(a == b){
            same++;
        }else{
            same = 0;
        }
        
    }
    if(same >= 3){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;
}

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

using namespace std;

int main(void) {
    vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << v[--K] << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		int x = parseInt(sc.next());
		sc.close();
		out.println(a<=x&&x<=(a+b)?"YES":"NO");
	}
}


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

int main()
{
	unsigned long long n, m;

	cin >> n;

	while (n) {
		m = 0;
		unsigned long long i = 1;

		while (n > 0) {
			unsigned long long t = n % 8;
			if (t < 4)
				m += t * i;
			else if (t == 4)
				m += 5 * i;
			else
				m += (t + 2) * i;

			n /= 8;
			i *= 10;
		}

		cout << m << endl;

		cin >> n;
	}

	return 0;
}


Measured memory_bytes: 3000
//#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int m, d;
	int days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int sum = 0;
	string wd[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };


	while (cin >> m >> d){
		if (m == 0)break;
		sum = 0;

		for (int i = 1; i < m; i++){
			sum += days[i];
		}
		sum += d;

		cout << wd[(sum+2) % 7] << endl;

	}


	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <set>
#include<math.h>
#include<cmath>
#include<vector>
#include<map>
#include<random>
#include<sstream>
using namespace std;

int main(){
    int N,T;cin >> N >> T;
    int c[1000],t[1000] = {};
    int f = 0;
    int m = 1000;
    int mId = 0;
    for(int i = 0;i < N;i++){
        cin >> c[i] >> t[i];
        if(T >= t[i]){f = 1;}
        if(m >= c[i] && t[i] <= T){
            m =c[i];
            mId = i;
        }
    }
    if(f == 0)cout << "TLE" << endl;
    else cout << m << endl;

    

}

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

int AllSum(int a) {
	int count = 0;
	while (a >= 10000) {
		count++;
		a -= 10000;
	}
	while (a >= 1000) {
		count++;
		a -= 1000;
	}
	while (a >= 100) {
		count++;
		a -= 100;
	}
	while (a >= 10) {
		count++;
		a -= 10;
	}
	while (a > 0) {
		count++;
		a--;
	}
	return count;
}

int main() {
	int a, box;
	int min, max;
	cin >> a >> min >> max;
	int res = 0;

	for (int i = 1; i <= a;i++) {
		box = AllSum(i);
		if (min <= box && box <= max) {
			res+=i;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int data[3];
int ans;

int main(){
	for(register int i=0; i<3; i++)
		scanf("%d", &data[i]);
	
	sort(data, data+3);
	
	for(register int i=1; i<3; i++){
		ans += abs(data[i] - data[i-1]);
	}
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
      int A, P;
      cin >> A >> P;
      cout << (A * 3 + P) / 2 << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        400005
#define mod         1000000007
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    k=k*2;
    k++;
    if(n%k==0){
        cout<<n/k;
    }
    else{
        n=n/k;
        n++;
        cout<<n;
    }
}


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

bool binarySearch(int A[], int key){
  int left = 0;
  int right = n;
  int mid;
  while (left < right){
    mid = (left + right) / 2;
    if(key == A[mid]) return true;
    if(key > A[mid]){
       left = mid + 1;
    } else {
      right = mid;
    }
  }
  return false;
}

int main() {
  int q, key, sum = 0;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  cin >> q;
  for (int i = 0; i < q; i++){
    cin >> key;
    if(binarySearch(A, key)) sum++;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3488
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
int N;
ll T[1001], A[1001];

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

  cin >> N;
  rep(i, N) cin >> T[i] >> A[i];

  ll cnt = T[0] + A[0];
  rep(i, N-1){
    if (T[i+1] == T[i] && A[i+1] == A[i]) continue;
    if (T[i+1] > T[i] && A[i+1] > A[i]){
      cnt = T[i+1] + A[i+1];
      continue;
    }
    ll s = max((A[i]+A[i+1] -1ll)/A[i+1], (T[i]+T[i+1] -1ll)/T[i+1]);
    cnt = s*(T[i+1]+A[i+1]);
    T[i+1] *=s;
    A[i+1] *=s; 
  }

  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = list(input())
ans_0 = []
ans_1 = []

cnt = 0
for i in range(n):
    if s[i] == "1" and cnt == 0:
        ans_0.append(i)
        cnt += 1
    elif s[i] == "0":
        cnt = 0
cnt = 0
for i in range(n):
    if s[n-1 - i] == "1" and cnt == 0:
        ans_1.append(n-1-i)
        cnt += 1
    elif s[n-1 - i] == "0":
        cnt = 0
ans_1.sort()
ans_list = []
if len(ans_0) == 0:
    print(n)
elif len(ans_0) == 1:
    if k == 1:
        print(max(n-ans_0[0], ans_1[0]+1))
    else:
        print(n)
elif len(ans_0) < k:
    print(n)
else:
    if 0 not in ans_0:
        ans_0.append(0)
        ans_1.append(0)
        ans_0.sort()
        ans_1.sort()
    if n-1 not in ans_1:
        ans_0.append(n-1)
        ans_1.append(n-1)
    for i in range(len(ans_0) - k):
        ans_list.append(ans_1[i+k] - ans_0[i])
    print(max(ans_list) + 1)

Measured memory_bytes: 9436
n, m = map(int, input().split())

rslts = [[] for _ in range(n)]
for i in range(m):
    x, y = input().split()
    rslts[int(x) - 1].append(y)
#print(rslts)

ac, p = 0, 0
for j in range(n):
    seq = rslts[j]
    if 'AC' in seq:
        ac += 1
        for k in seq:
            if k == 'WA':
                p += 1
            else:
                break

print(ac, p)

Measured memory_bytes: 20376
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }

#define INF 1 << 30
int t[100][100];
int main() {
	int N;
	ll S = 0;
	cin >> N;
	vector<int> a(3 * N);
	rep(i, 0, 3 * N)cin >> a[i];
	sort(all(a));
	rep(i, N, 3 * N)S += a[i++];
	printf("%lld\n", S);
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int>> x(N);
  vector<vector<int>> y(N);

  int X, Y;
  rep(i, N) {
    cin >> A[i];
    rep(j, A[i]) {
      cin >> X >> Y;
      X--;
      x[i].pb(X);
      y[i].pb(Y);
    }
  }

  int ans = 0;
  rep(b, bit(N)) {
    vector<int> B(N);
    int cnt = 0;
    rep(i, N) {
      if ((b >> i) & 1) {
        B[i] = 1;
        cnt++;
      } else
        B[i] = 0;
    }

    bool ok = true;
    rep(i, N) {
      if (!B[i])
        continue;
      rep(j, A[i]) {
        int to = x[i][j];
        if (B[to] != y[i][j])
          ok = false;
      }
    }
    if (ok)
      chmax(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 305;
int dp[N][N][N];

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

    string s;
    int k;
    cin >> s >> k;

    int n = s.size();

    for (int i = 0; i + 1 < n; i++) {
        if (s[i] == s[i + 1]) {
            dp[i][i + 1][0] = 2;
        }
        else {
            dp[i][i + 1][1] = 2;
        }
    }

    for (int i = 0; i < n; i++) {
        dp[i][i][0] = 1;
    }

    for (int i = 0; i < n; i++) {
        for (int l = 0, r = i; r < n; l++, r++) {
            for (int h = 0; h <= k; h++) {
                if (l > 0)
                    dp[l - 1][r][h] = max(dp[l - 1][r][h], dp[l][r][h]);
                if (r + 1 < n)
                    dp[l][r + 1][h] = max(dp[l][r + 1][h], dp[l][r][h]);
                if (l > 0 && r + 1 < n) {
                    if (s[l - 1] == s[r + 1]) {
                        dp[l - 1][r + 1][h] = max(dp[l - 1][r + 1][h], dp[l][r][h] + 2);
                    }
                    if (h < k) {
                        dp[l - 1][r + 1][h + 1] = max(dp[l - 1][r + 1][h + 1], dp[l][r][h] + 2);
                    }
                }
            }
        }
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            for (int h = 0; h <= k; h++) {
                ans = max(ans, dp[i][j][h]);
            }
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 110848
#include <stdio.h>

int main () {
	char S[100001];
	scanf ("%s", S);
	int idx=1, sum=0;
	while (S[idx]!='\0'){
		if (S[idx]!=S[idx-1])
			sum++;
		idx++;
	}
	printf ("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
input = STDIN.read.split("\n").map{|l| l.split(" ").map{|a| a.to_i}}

K = input[0][0]
A = input[0][1]
B = input[0][2]

def check()
    trade_per = (B - A - 1)
    if trade_per <= 2 
        return K + 1
    end

    res = (K - A + 1) 
    if res <= 0
        return K + 1
    end
    su = (res / 2).floor * (B - A) + A
    if res % 2 == 1
        su = su + 1
    end
    return su
end

puts check()

Measured memory_bytes: 1788
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main_prev(): 
    A, B = LI()

    if A == B:
        print(A)
        return
    if B - A < 20:
        xor = B
        for i in range(A, B):
            xor ^= i
        print(xor)
        return

    to_xor = []
    while A%4 != 0:
        to_xor.append(A)
        A += 1
    while B%4 != 3:
        to_xor.append(B)
        B -= 1
    xor = 0
    for i in to_xor:
        xor ^= i
    print(xor)

def xor_to(a):
    evens = a//2 - 1 if a%2 == 0 else a//2
    evens_xor = 0 if evens%2 == 0 else 1
    return evens_xor^a if a%2 == 0 else evens_xor

def main():
    A, B = LI()
    print(xor_to(A-1)^xor_to(B))


main()

Measured memory_bytes: 3064
n = int(input())
ans = 1

nums = list(map(lambda x : int(x),input().split()))

for i in range(n):
    if nums[i] == 0:
        ans = 0
        break
        
for k in range(n):
    ans *= nums[k]
    if ans > 10**18:
        ans = -1
        break

print(ans)

Measured memory_bytes: 21792
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#define INF 100000000
#define MAX_C 100
using namespace std;
map<int, int> mp;
int main()
{
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	cout << a + b + c + max({ a, b, c }) * ((1 << k) - 1) << endl;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    
    int ans = 1;
    rep(i, n){
        if(ans > k){
            ans += k;
        }else ans *= 2;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    int cur_min = 0, ans = INF*-1;
    rep(i, n) {
        int x; cin >> x;
        if (cur_min==0) cur_min = x;
        else ans = max(ans, x-cur_min);
        if (x<cur_min) cur_min = x;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n,m,x;
int s[13][13];
int c[N],a[N];
const LL inf=1e18;
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>m>>x;
  LL an=inf;
  for(int i=1;i<=n;i++){
  	cin>>c[i];
  	for(int j=1;j<=m;j++)cin>>s[i][j];
  }
	for(int i=0;i<(1<<n);i++){
		vector<int>v;
		for(int j=0;j<n;j++){
			if((1<<j)&i){
				v.pb(j);
			}
		}
		for(int j=1;j<=m;j++)a[j]=0;
		LL ans=0;
		for(auto k:v){
			ans+=c[k+1];
			for(int j=1;j<=m;j++){
				a[j]+=s[k+1][j];
			}
		}
		int sta=1;
		for(int j=1;j<=m;j++){
			sta&=(a[j]>=x);
		}
		if(sta)an=min(an,ans);
	}
	if(an==inf)cout<<-1<<'\n';
	else cout<<an<<'\n';
 	return 0;
}

Measured memory_bytes: 3668
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          string s = Input.ScanStr();
          string res="";
          switch(s){
            case "A":res="T";break;
            case "T":res="A";break;
            case "C":res="G";break;
            case "G":res="C";break;
          }
          
          Console.WriteLine(res);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstdint> // int64_t, int*_t
using namespace std;

int main() {
    int64_t N; cin >>N;
    int64_t sum = 0;
    for(int64_t i = 1 ; i <= N ; i++){
        if (  i % 3 != 0  && i % 5 !=0){
            sum += i;
        }
    }
cout << sum << endl;
}


Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

int gcd(int c,int d){
    return d ? gcd(d, c % d) : c;
}



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

    int a,b,c,d; cin >> a >> b >> c >> d;
    int all = b-a+1;
    int dc = b/c - (a-1)/c;
    int dd = b/d - (a-1)/d;
    int gcdcd = c / gcd(c,d) * d;
    int dcd = b/gcdcd - (a-1)/gcdcd;

    cout << all - dc - dd + dcd << endl;

}



Measured memory_bytes: 256
n=int(input())
a=input()
b=input()
mod=10**9+7
x=[]
j=True
for i in range(n):
    if a[i]!=b[i]:
        if j:
            x.append(2)
            j=False
        else:
            j=True
    else:
        x.append(1)
res=1
j=0
for t in x:
    if t==1:
        if j==0:
            res*=3
        elif j==1:
            res*=2
        else:
            res*=1
        j=1
    else:
        if j==0:
            res*=6
        elif j==1:
            res*=2
        else:
            res*=3
        j=2
print(res%mod)

Measured memory_bytes: 38256
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let n:usize = read();
    let t:i32 = read();
    let mut c:i32 = 100000;
    for _i in 0..n{
	let cost:i32 = read();
	let time:i32 = read();
	if time <= t && cost < c{
	    c = cost;
	}
    }
    if c==100000{
	println!("TLE");
    }else {
	println!("{}",c);
    }
}


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

int main()
{
	int n,k;
	cin >> n >> k;
	int hoge = (n-2)*(n-1)/2;
	if(hoge<k)
	{
		cout << -1 << endl;
		return 0;
	}
	vector<pair<int,int>> ans,dis2;

	for(int i = 2;i<=n;i++)
	{
		ans.emplace_back(1,i);
	}

	for(int i = 2;i<n;i++)
	{
		for(int j = i+1;j <= n;j++)
		{
			dis2.emplace_back(i,j);
		}
	}
	while(dis2.size()!=k)
	{
		ans.push_back(dis2.back());
		dis2.pop_back();
	}
	cout << ans.size() << endl;

	for(auto i:ans)
	{
		cout << i.first << ' '<<i.second << endl;
	}
	
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
	int k;
	cin>>k;
	int n=k%10;
	if(n==3){
		cout<<"bon"<<"\n";
	}
	else if(n==0||n==1||n==6||n==8){
		cout<<"pon"<<"\n";
	}
	else
	{cout<<"hon"<<"\n";}
	
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    string s; cin >> s;
    int n = s.size();
    if(n&1){
        cout << "No" << endl;
        return 0;
    }
    bool ok = true;
    rep(i,n){
        if(i&1 && s[i] != 'i') ok = false;
        else if(i%2 == 0 && s[i] != 'h') ok = false;
    }
    cout << (ok?"Yes":"No") << endl;
}

    



Measured memory_bytes: 256
from math import sqrt
from collections import deque
M = 10**6
prime = [1]*(M+1)
prime[0] = prime[1] = 0
for i in xrange(2, int(sqrt(M))+1):
    if prime[i]:
        for j in xrange(i*i, M+1, i):
            prime[j] = 0
P = {(0, 0): 1}; R = [None, (0, 0)]
c = 1; i = 1; p = 1
x = y = 0
while c < M:
    for j in xrange(i):
        x += p; c += 1
        P[x, y] = c; R.append((x, y))
    for j in xrange(i):
        y -= p; c += 1
        P[x, y] = c; R.append((x, y))
    p = -p
    i += 1
deq = deque()
dd = [-1, 0, 1]
while 1:
    m, n = map(int, raw_input().split())
    if m == n == 0:
        break
    deq.append(n)
    cnts = {n: prime[n]}
    used = set()
    while deq:
        v = deq.popleft()
        x, y = R[v]
        for dx in dd:
            t = P.get((x+dx, y+1), M+1)
            if t <= m:
                cnts[t] = max(cnts[v] + prime[t], cnts.get(t, 0))
                if t not in used:
                    deq.append(t)
                    used.add(t)
    vals = sorted((v, k) for k, v in cnts.items() if prime[k])
    print "%d %d" % vals[-1] if vals else "0 0"

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  string S;
  for (int i = B; i < D; i++) S += 'U';
  for (int i = A; i < C; i++) S += 'R';
  for (int i = B; i < D; i++) S += 'D';
  for (int i = A; i < C; i++) S += 'L';
  S += 'L';
  for (int i = B; i <= D; i++) S += 'U';
  for (int i = A; i <= C; i++) S += 'R';
  S += 'D';
  S += 'R';
  for (int i = B; i <= D; i++) S += 'D';
  for (int i = A; i <= C; i++) S += 'L';
  S += 'U';
  cout << S << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
template<class T>
T gcd(T a,T b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
template<class T>
T lcm(T a,T b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
template<class T>
inline bool isp(T n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S,T;
    cin >> S >> T;
    ll s = S.size() * 2;
    S += S;
    rep(i,s / 2){
        rep(j,s - i){
            if(S.substr(i,j) == T){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}


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

using namespace std;

#define int long long
#define double long double

void solve() {
    int n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; ++i) cin >> p[i];
    int ans = 0, sum = 0;
    for (int i = 0; i < k; ++i) {
        ans += p[i];
    }
    sum = ans;
    for (int j = 0; j + k < n; ++j) {
        ans -= p[j];
        ans += p[j + k];
        sum = max(sum, ans);
    }
    cout.precision(10);
    cout << (sum + k) / 2.0;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

static const long long MOD = 1e9+7;

long long inv(long x, long n){
    if(n == 1) return x;
    long long cur = inv(x, n / 2);
    cur = cur * cur % MOD;
    if(n % 2 == 0){
        return cur;
    }else{
        return cur * x % MOD;
    }
}

long long combination(long long n, long long k){
    long long upper = 1;
    long long bellow = 1;
    for(long long i = n - k + 1; i <= n; i++){
        long long temp = upper;
        upper *= i;
        upper %= MOD;
    }
    for(long long i = 1; i <= k; i++){
        bellow *= inv(i, MOD-2);
        bellow %= MOD;
        // std::cout << bellow << std::endl;
    }
    return (upper * bellow) % MOD ;
}

int main(void){
    // int n = 5;
    // int x = 2;
    // combination(n, x);
    //  std::cout << combination(n, x) << std::endl;
    long long x, y, k, m;
    std::cin >> x >> y;
    k = (- x + 2 * y) / 3;
    m = (2 * x - y) / 3;
    if(k + 2 * m == x && 2 * k + m == y && k >= 0 && m >= 0){
        std::cout << combination(k+m, k) << std::endl;
    }else{
        std::cout << 0 << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3592
def gen_divisor(n):
    ps = []
    for i in range(1, int(1 + n ** 0.5)):
        if n % i == 0:
            yield i
            ps.append(n // i)
    if n // ps[-1] == ps[-1]:
        del ps[-1]
    for p in reversed(ps):
        yield p

N, M = map(int, input().split())

def solve():
    for di in gen_divisor(M):
        if di >= N:
            ans = M // di
            return ans

print(solve())

Measured memory_bytes: 3064
#include<stdio.h>
typedef long long ll;

ll gcd(ll a, ll b) {
    if (a == 0) return b;
    else return gcd(b%a, a);
}
int main() {
    ll a,b;
    scanf("%lld %lld", &a,&b);
    int ans = gcd(a,b);
    printf("%lld\n",ans);
    return 0;
}



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

int main() {
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    if(n == 0 or m == 0)
    {
        cout << 0;
        return 0;
    }
    n--; m--;
    cout << n*m << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a; i<=b; ++i)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using vl=vector<ll>;
using vp=vector<pll>;
const ll INF=1e18;
const ll MOD=1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll a=1,b=2,c=1;
    FOR(i,1,n){
        a=(a*10)%MOD;
        b=(b*9)%MOD;
        c=(c*8)%MOD;
    }
    cout<<(a-b+c+MOD)%MOD;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <boost/math/common_factor.hpp>
using namespace std;
 
template< class t>
long long int gcd( t g,t h )
{
    return ( h==0 ? g : gcd(h,g%h) );
}
 
 
struct Comp {
  bool operator()(const std::pair<int, int> &a, const std::pair<int, int> &b) {
    if (a.first != b.first) {
      return a.first < b.first;
    }
    return a.second > b.second;
  }
 
}comp_functor;

 
int main() 
{
    ios_base::sync_with_stdio(false) ; cin.tie(0) ;
    
    long long int i,j,t,n,l,c=0,q,ans=0,a[200005]={0},f=0,x,temp,h[200005]={0};
    
    string s1,s2;
    
    cin>>n;
    
    temp=1;
    
    for(i=0;i<n;i++)
    {
        cin>>x;
        x--;
        ans+=x;
        
        
    }
    
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n, k; cin >> n >> k;
    vector<int> L(n);
    rep(i, n) cin >> L[i];
    sort(L.rbegin(), L.rend());
    int ans = 0;
    rep(i, k) ans += L[i];
    cout << ans;
}


Measured memory_bytes: 256
//
// Created by yamunaku on 2020/01/18.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n;
    cin >> n;
    vi a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    int ans = IINF;
    rep(t, 1 << n){
        vi v(n);
        rep(i, n){
            if(t & (1 << i)){
                v[i] = b[i];
            }else{
                v[i] = a[i];
            }
        }
        sort(all(v));
//        rep(i, n){
//            cout << v[i] << " ";
//        }
//        cout << endl;
        vi num(n, -1);
        rep(i, n){
            if(t & (1 << i)){
                rep(j, n){
                    if(v[j] == b[i] && j % 2 != i % 2){
                        if(num[j] != -1) continue;
                        num[j] = i;
                        break;
                    }
                }
            }else{
                rep(j, n){
                    if(v[j] == a[i] && j % 2 == i % 2){
                        if(num[j] != -1) continue;
                        num[j] = i;
                        break;
                    }
                }
            }
        }
//        rep(i, n){
//            cout << num[i] << " ";
//        }
//        cout << endl;
        int tmp = 0;
        rep(i, n){
            if(num[i] == -1) goto next;
        }
        rep(i, n){
            repl(j, i+1, n){
                if(num[i] > num[j]) tmp++;
            }
        }
        ans = min(ans, tmp);
        next:;
    }
    if(ans == IINF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int N = 60;
int n,m;
int a[N];
int main() {
	scanf("%d %d", &n, &m);
	for(int i = 0; i < m; ++i) {
		int u,v; scanf("%d %d", &u, &v);
		a[u]++, a[v]++;
	}
	for(int i = 1; i <= n; ++i) {
		printf("%d\n", a[i]);
	}
	return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9

int main() {

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = 0;

    ans = max(a*c,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);
    
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3624
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#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 pi              pair<int,int>
#define pll             pair<ll,ll>
#define pb              push_back
#define F               first
#define S               second
#define vi              vector<int>
#define vll             vector<ll>
#define endl            '\n'
#define all(v)          (v).begin(),(v).end()
#define MP(a,b)         make_pair(a,b)
#define debug(x)        cerr<< #x << " : " << x << endl;
#define debugp(p)       cerr<< #p << " : " << "(" << (p).first << "," << (p).second << ")\n";
#define debugv(v)       cerr<< #v << " : " << "["; for(int i = 0; i < (v).size(); i++) cerr << v[i] << " "; cerr<<"]\n";
#define debugs(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<*itr << " "; cerr << "]\n";
#define debugm(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<"(" << itr->first << "," << itr->second << ") "; cerr << "]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/

inline ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;

void Solve(){
    int n;
    cin >> n;
    map<string , int> cnt;
    while (n--){
        string s;
        cin >> s;
        cnt[s]++;
    }
    cout << "AC x " << cnt["AC"] << endl;
    cout << "WA x " << cnt["WA"] << endl; 
    cout << "TLE x " << cnt["TLE"] << endl; 
    cout << "RE x " << cnt["RE"] << endl; 

}
int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        Solve();
    }
    #ifdef LOCAL
    cerr << "Time elapsed\t: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
}



Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
        int N;
        cin >> N;
        int primes = N;
        for (int i = 0; i < N; i++) {
                int n;
                cin >> n;
                for (int i = 2; i * i <= n; i++) {
                        if (n % i == 0) { 
                                primes--;
                                break;
                        }
                }
        }
        cout << primes << endl;
        return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#define MOD 1000000007
using namespace std;

long rec(int m, long i){
  if(i == 1)
    return m;
  else{
    long x = rec(m, i/2);
    long y = (x*x) % MOD;
    if(i%2 == 0)
      return y;
    else
      return (y * m) % MOD;
  }
}

int main(){
  int m;
  long n;
  cin >> m >> n;
  cout << rec(m, n) << endl;
}



Measured memory_bytes: 3116