akhauriyash/Code-Regression huggingface dataset:
///
// File:  alds1_5_b.cpp
// Author: ymiyamoto
//
// Created on Mon Oct  9 14:25:31 2017
//

#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

static vector<uint32_t> array;

static uint32_t merge(uint32_t left, uint32_t mid, uint32_t right)
{
  vector<uint32_t> lefts;
  vector<uint32_t> rights;
  for (uint32_t i = left; i < right; i++) {
    if (i < mid) {
      lefts.push_back(array[i]);
    } else {
      rights.push_back(array[i]);
    }
  }

  lefts.push_back(INT32_MAX);
  rights.push_back(INT32_MAX);

  uint32_t count = 0;
  uint32_t left_index = 0, right_index = 0;
  for (uint32_t i = left; i < right; i++) {
    count++;
    if (lefts[left_index] < rights[right_index]) {
      array[i] = lefts[left_index];
      left_index++;
    } else {
      array[i] = rights[right_index];
      right_index++;
    }
  }

  return count;
}

static uint32_t merge_sort(uint32_t left, uint32_t right)
{
  uint32_t count = 0;
  if (left + 1 < right) {
    uint32_t mid = (left + right) / 2;
    count += merge_sort(left, mid);
    count += merge_sort(mid, right);
    count += merge(left, mid, right);
  }

  return count;
}

int32_t main()
{
  uint32_t n;
  cin >> n;

  for (uint32_t i = 0; i < n; i++) {
    uint32_t val;
    cin >> val;
    array.push_back(val);
  }

  uint32_t count = merge_sort(0, array.size());

  for (uint32_t i = 0; i < array.size(); i++) {
    if (i != 0) cout << " ";
    cout << array[i];
  }
  cout << endl << count << endl;

  return 0;
}

Measured memory_bytes: 7768
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b;
  	cin >> a >> b;
  
  	if(a >= 1 && a<=9 && b>=1 && b<= 9){
      cout << a * b;
    }
  	else{
      cout << -1;
    }
  return 0;
}

Measured memory_bytes: 256
//
// Created by munaiyi on 2020/3/18.
//
#include <bits/stdc++.h>

using namespace std;

int main(){
    long long x;
    scanf("%lld", &x);
    long long ans = 1;
    while(x){
        x = x >> 1;
        ans = ans << 1;
    }
    printf("%lld\n", ans - 1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main () {
    int a, b, c, d;
    std::cin >> a >> b >> c;
  	d = c - a + b;
    if(d >= 0) {
        std::cout << d << std::endl;
    }
    else {
        std::cout << 0 << std::endl;
    }
}


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

int main(){
	int N,M,X; cin>>N>>M>>X;
	int f=0,b=0;
	vector<int>a(M);
	for(int i=0;i<M;i++){
		cin>>a[i];
	}
	for(int i=0;i<X;i++){
		for(int j=0;j<M;j++){
			if(i==a[j]){
				f++;
			}
		}
	}
	for(int i=X+1;i<N;i++){
		for(int j=0;j<M;j++){
			if(i==a[j]){
				b++;
			}
		}
	}
    cout<<min(f,b)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int data[10];
int ans[15][500];

void sub(int n,int x);
int check(int a,int x);

int main(void){
	int n,i,s
;
	for(n=0;n<15;n++){
		for(i=0;i<500;i++){
			ans[n][i]=0;
		}
	}

	for(n=1;n<=10;n++){sub(n,0);}
	while(scanf("%d %d",&n,&s)!=EOF){
		if(s>=400){printf("0\n");}
		else{
			printf("%d\n",ans[n][s]);
		}

	}
	return 0;
}
void sub(int n,int x){
	int i,sum;
	if(x==n){
		sum=0;
		for(i=0;i<n;i++){sum=sum+data[i]*(i+1);}
		ans[n][sum]++;
		return ;
	}
	for(i=0;i<10;i++){
		data[x]=i;
		if(check(i,x)==0){
			sub(n,x+1);
		}
	}
}
int check(int a,int x){
	int i;
	for(i=0;i<x;i++){if(data[i]==a){return 1;}	}
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;

string ans, curRes = "", s, tmp;
int len;

void ask( string query ){
    cout << "? " << query << endl;
    cin >> ans;
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    tmp = "1";
    for ( int i = 1; i <= 10; i++ ){

        ask(tmp);
        if ( ans == "N" ){
            len = i - 1;
            break;
        }
         tmp = tmp + "0";
    }
    tmp = "1";
    for ( int i = 1; i <= 10; i++ ){
        tmp = tmp + "0";
    }
    ask(tmp);
    if ( ans == "Y" ){
        int i;
        for ( i = 9; i >= 0; i-- ){
            tmp.erase( tmp.begin() + size(tmp) - 1 );
            tmp.erase( tmp.begin() + size(tmp) - 1 );
            tmp = tmp + "1";
            ask(tmp);
            if ( ans == "N" ){
                len = i + 2;
                break;
            }
        }
        if ( i == -1 ){
            ask("2");
            if ( ans == "Y" ){
                cout << "! 1" << endl;
            }
            else{
                cout << "! 10" << endl;
            }
            return 0;
        }
    }
    for ( int i = 1; i <= len - 1; i++ ){
        int low = 0, high = 10, mid;
        while( high - low > 1 ){
            mid = ( high + low ) >> 1;
            s = mid + '0';
            ask( curRes + s );
            if ( ans == "Y" ){
                low = mid;
            }
            else{
                high = mid;
            }
        }
        s = low + '0';
        curRes = curRes + s;
    }
    for ( int i = 0; i <= 9; i++ ){
        if ( size(curRes) == 0 && i == 0 ){
            continue;
        }
        s = i + '0';
        s = s + "0";
        ask( curRes + s );
        if ( ans == "Y" ){
            s = i + '0';
            curRes = curRes + s;
            break;
        }
    }
    cout << "! " << curRes << endl;
    return 0;
}



Measured memory_bytes: 656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

struct Quad {
	int a, b, c, d;
};

ll ans;
int N, M, Q;
vector<Quad> v;
int seq[11];
void dfs(int start, int n) {
	if (n == N + 1) {
		ll res = 0;
		for (int i = 0; i < Q; i++) 
			if (seq[v[i].b] - seq[v[i].a] == v[i].c) res += v[i].d;
		ans = max(ans, res);
		return;
	}
	for (int i = start; i <= M; i++) {
		seq[n] = i;
		dfs(i, n + 1);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> M >> Q;
	for (int i = 0; i < Q; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		v.push_back({ a, b, c, d });
	}
	dfs(1, 1);
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3668
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int d[50][50],ma[510][510];
int sum[3][50];
int main()
{
	int n,m,out=1001001001;cin>>n>>m;
	rep(i,m) rep(j,m) cin>>d[i][j];
	rep(i,n) rep(j,n){
		cin>>ma[i][j];ma[i][j]--;
	}
	memset(sum,0,sizeof(sum));
	rep(i,m){
		rep(I,n) rep(J,n){
			sum[(I+J)%3][i]+=d[ma[I][J]][i];
		}
	}
	rep(i,m) rep(j,m) rep(k,m){
		if(i==j || j==k || i==k) continue;
		out=min(out,sum[0][i]+sum[1][j]+sum[2][k]);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 1280
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	n, _ := strconv.Atoi(getNextLine(scanner))

	hList := getIntList(scanner)
	max := 0
	enable := 0
	for i := 0; i < n; i++ {
		if max <= hList[i] {
			max = hList[i]
			enable++
		}
	}
	fmt.Println(enable)
}


Measured memory_bytes: 640
#include <iostream>
#include <math.h>
typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

  string str;
  int sum = 0;
  int n = 0;
  cin >> str;

  REP(i,(int)str.size()){
    sum += str[i] - '0';
    n += (str[i] - '0') * pow(10,(int)str.size()-i-1);
  }

  if(n % sum == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}


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

if N < 105:
    print(0)
else:
    res = 1
    for i in range(107, N+1, 2):
            sum = 0
            for j in range(1, i+1):
                if (i % j) == 0:
                    sum += 1
            if (sum == 8):
                res += 1
    print(res)

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

int main() {
  int N;  cin >> N;
  vector<int> a(N);

  for (int i = 0; i < N; ++i) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());

  int ret = 0;
  for (int i = 0; i < N; ++i) ret += a[i] * (i & 1 ? -1 : 1);

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
using namespace std;
int main()
{
  int N,letter;
  string S;
  cin>>N>>S;
  rep(i,S.size())
  {
    letter=S.at(i)+N;
    if(S.at(i)+N>(int)'Z')
    {
      while(isalpha(putchar((int)(letter-26)))==true)
      {
        cout<<putchar((int)(letter-26))<<endl;
      }
    }
    else
    {
      while(isalpha(putchar((int)(letter)))==true)
      {
        cout<<putchar((int)letter)<<endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){

  if(A.size() == n+1){
    int now = 0;
    rep(i,q){
      if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while(A.back() <= m){
    dfs(A);
    A.back()++;
  }
}

int main(){

  cin >> n >> m >> q;

  a = b = c = d = vector<int>(q);
  rep(i,q)  cin >> a[i] >> b[i] >> c[i] >> d[i];

  dfs(vector<int> (1,1));
  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
string s;
stack<char>t,ans;
int main(){
	cin>>s;
	int l=s.size();
	for(int i=0;i<l;i++){
		if(s[i]!='B')t.push(s[i]);
		else
			if(!t.empty())t.pop();
	}
	while(!t.empty()){
		ans.push(t.top());
		t.pop();
	}
	while(!ans.empty()){
		printf("%c",ans.top());
		ans.pop();
	}
	printf("\n");	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
main()
{
    int n,w;
    cin >> n >> w;
    long long dp[200005] = {0};
    for( int i = 0; i < n ; i++ )
    {
        int a,b;
        cin >> a >> b;
        for( int j = w - a; j >= 0; j-- )
        {
            dp[j + a] = max( dp[j + a], dp[j] + b );
        }
    }
    cout << dp[w] << endl;
    return 0;
}

Measured memory_bytes: 1920
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

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

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    LL n;cin>>n;

    LL m=0;
    vector<LL> a(n);
    REP(i, n){
        cin >> a[i];
        m = max(m,a[i]);
    }

    vector<LL> b(m+100);
    REP(i,n){
        b[a[i]]++;
    }

    vector<LL> c(m+100);
    REP(i,m+1){
        c[i] = b[i]*(b[i]-1)/2;
        //dump(i)
        //dump(b[i])
        //dump(c[i])
    }

    LL sum=0;
    REP(i,m+1){
        sum += c[i];
    }

    //dump(sum)
    //dump(m)

    REP(i,n){
        LL t = a[i];
        LL result = sum;
        LL sa = (b[t]*(b[t]-1) - (b[t]-1)*(b[t]-2))/2;
        result -= sa;
        cout<<result<<endl;

    }



	return;
}

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

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	string S;
	cin >> S;
	string ans = "No";
	if(S[0] == S[1]){
		if(S[1] == S[2])ans = "Yes";
	} else {
		if(S[1] == S[2] && S[2] == S[3])ans = "Yes";
	}
	cout << ans << endl;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K;
    Scd2(N,K);

    if( (K-1) > (N-1)/2 ) {
        printf ("%d\n", -1 );
        return 0;
    }

    vi a(N),b(N),c(N);

    int n1 = N/2;      // less
    int n2 = (N+1)/2;  // more

    Rep(i,N) c[i] = N*2+i+K;
    Rep(i,n1) a[i] = n1-i-1+K;
    if( N%2 ) Rep(i,n1){
        b[i] = N+(i+1)*2-1+K;
    }else Rep(i,n1){
        b[i] = N+i*2+K;
    }
    if( N%2 ) Rep(i,n2){
        a[N-i-1] = N-n2+i+K;
    }else Rep(i,n2){
        a[N-i-1] = N-n2+i+K;
    }
    Rep(i,n2) b[N-i-1] = N*2-i*2-1+K;

    Rep(i,N){
        printf ("%d %d %d\n", a[i], b[i], c[i] );
    }

    return 0;
}





Measured memory_bytes: 3708
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	const int MAX_n = 5000;
	int n, a[MAX_n + 1], z, beg, res;
	
	while(true){
		scanf("%d", &n);
		
		if(n == 0) return 0;
		
		a[0] = 0;
		for(int i = 1; i <= n; i++){
			scanf("%d", &z);
			a[i] = z + a[i - 1];
		}
		
		beg = 0;
		res = -100000;
		for(int i = 1; i <= n; i++){
			beg = min(beg, a[i - 1]);
			res = max(res, a[i] - beg);
		}
		
		printf("%d\n", res);
	}
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;
using LL = long long;
const int INF = 1e9;

int main(void)
{
    int N, Y;
    cin >> N >> Y;
    for (int x = 0; x <= N; x++) {
        for (int y = 0; x+y <= N; y++) {
            int z = N-x-y;
            if (Y == 10000*x + 5000*y + 1000*z) {
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}



Measured memory_bytes: 256
S = input()
year = int(S[0:4])
month = int(S[5:7])
day = int(S[8:10])

isBefore = False
if year < 2019:
    isBefore = True
elif year == 2019:
    if month < 4:
        isBefore = True
    elif month == 4:
        if day <= 30:
            isBefore = True

if isBefore:
    print("Heisei")
else:
    print("TBD")


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

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

    int res = 999;
    int tar = 753;
    for(int i = 0; i < s.size() - 2; i++){
        int k = std::stoi(s.substr(i, 3));
        if(std::abs(tar - k) < res){
            res = std::abs(tar - k);
        }
    }
    std::cout<<res<<std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	int a = A+B;
	int b = A-B;
	int c = A*B;
    vector<int>vec={a,b,c};
  sort(vec.begin(),vec.end());
  cout<<vec.at(2)<<endl;
}


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

using namespace std;

int main()
{
	int money = 0;

	int change = 0;



	while (1)
	{


		int count500 = 0;

		int count100 = 0;

		int count50 = 0;

		int count10 = 0;

		int count5 = 0;

		int count1 = 0;


		cin >> money;

		if (money == 0)break;


		change = 1000 - money;

		count500 = change / 500;

		count100 = (change - (count500 * 500)) / 100;

		count50 = (change - (count500 * 500) - (count100 * 100)) / 50;

		count10 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50)) / 10;

		count5 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50) - (count10 * 10)) / 5;

		count1 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50) - (count10 * 10) - (count5 * 5)) / 1;

		cout << count500 + count100 + count50 + count10 + count5 + count1 << endl;
	}

	return 0;
}

Measured memory_bytes: 3080
N, K = gets.split.map(&:to_i)
MOD = 10**9 + 7

ans = 0
max_value = N.downto(N-K+2).sum
min_value = 0.upto(K-2).sum
K.upto(N+1) do |k|
  max_value += N-k + 1
  min_value += k-1
  ans += max_value - min_value + 1
  ans %= MOD
end

puts ans


Measured memory_bytes: 14324
#include <stdio.h>
int n, m, a, b, x, y;
int c[4096];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i < 4096; i++) {
		c[i] = 1 << 30;
	}
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a, &b);
		x = 0;
		for (int j = 0; j < b; j++) {
			scanf("%d", &y);
			x += 1 << (y - 1);
		}
		for (int j = 0; j < 4096; j++) {
			if (c[j | x] > c[j] + a)c[j | x] = c[j] + a;
		}
	}
	x = 0;
	for (int i = 0; i < n; i++)x += 1 << i;
	if (c[x] == (1 << 30))printf("-1\n");
	else printf("%d\n", c[x]);
}

Measured memory_bytes: 128
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var hs = new HashSet<String>();
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		for(var i = 0; i < n; i++) {
			hs.add(sc.next());
		}
		sc.close();

		System.out.println(hs.size());
	}
}

Measured memory_bytes: 77056
from collections import deque

def main():
    n, m = map(int, input().split())
    route = [[] for _ in range(n+1)]
    ans = [None]*(n+1)
    for _ in range(m):
        a, b = map(int, input().split())
        route[a].append(b)
        route[b].append(a)
    q = deque([1])
    while q:
        parent = q.pop()
        children = route[parent]
        for child in children:
            if ans[child] is None:
                ans[child] = parent
                q.appendleft(child)
    print("Yes")
    print("\n".join(list(map(str, ans[2:]))))

if __name__ == "__main__":
    main()

Measured memory_bytes: 41680
N, K, Q = [int(i) for i in input().split()]
A = [0 for i in range(N+1)]
for i in range(Q):
    a = int(input())
    A[a] += 1

for i in range(1, N+1):
    if K - (Q - A[i]) > 0:
        print('Yes')
    else:
        print('No')


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

int main(void){
  int N, Q, temp;
  long long K;
  cin >> N >> K >> Q;
  vector<int> P(N,K - Q);
  for(int i = 0; i < Q; i++){
    cin >> temp;
    P[temp - 1]++;    
  }
  for(int i = 0;  i < N; i++){
    if(P[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0; 
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    int b[n-1];
    for(int i = 0; i < n-1; i++) {
        cin >> b[i];
    }

    int ans = b[n-2];
    for(int i = n-2; i > 0; i--) {
        ans += min(b[i], b[i-1]);
    }
    ans += b[0];

    cout << ans << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
def solve():
  s=input()
  n=len(s)
  ans=[0 for _ in range(n)]
  r=ans[:]
  p='' 
  c=0
  for i in range(n):
    x=s[i]
    if x=='R':
      if p=='R':
        c+=1
      else:
        c=1
    else:
      if p=='R':
        r[i-1]=c
        c=0
    p=x
  r=r[::-1] 
  s=s[::-1]
  for i in range(n):
    x=s[i]
    if x=='L':
      if p=='L':
        c+=1
      else:
        c=1
    else:
      if p=='L':
        r[i-1]=c
        c=0
    p=x
  r=r[::-1]
  s=s[::-1]
  o=ans[:]
  e=ans[:]
  for i in range(n):
    y=r[i]
    if y!=0:
      x=s[i]
      if x=='R':
        ans[i]+=(y+1)//2
        ans[i+1]+=y//2
      else:
        ans[i-1]+=y//2
        ans[i]+=(y+1)//2
  print(*ans)
  
if __name__ == '__main__':
    solve()


Measured memory_bytes: 8804
n=int(input())
p=[int(j) for j in input().split()]
s=range(n+1)
x=0
  
c=0

for a in range(n):
  if p[a]!=s[a+1]:
    c=c+1
  

if c>2:
  print('NO')
  
if c<=2:
  print('YES')

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(ll i = 0; i < n; ++i)
#define REP3(i, s, e) for(ll i = s; i <= e; ++i)

constexpr double PI=3.14159265358979323846;

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

struct Shougen {
    ll x = 0;
    bool y = false;
};

int main(){
    auto N = read<ll>();
    v<v<Shougen>> shougen(N);
    REP(i, N){
        auto A = read<ll>();
        REP(j, A){
            ll x = read<ll>();
            bool y = read<bool>();
            shougen[i].push_back(Shougen{x - 1, y});
        }
    }

    auto bits = [N](ll x){
        int ret = 0;
        REP(i, N){
            if(x & (1 << i)) ++ret;
        }
        return ret;
    };


    int ans = 0;
    REP(i, (1 << N)){
        bool check = true;
        REP(j, N){
            if(!check) break;
            if(i & (1 << j)){
                for(auto & s: shougen[j]){
                    if(!!(i & (1 << s.x)) != s.y){
                        check = false;
                        break;
                    } 
                }
            }
        }
        if(check){
            ans = max(ans, bits(i));
        }
    }
    
    write(ans);
}



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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 2e5 + 5;

int A[N], CNT[N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n; cin >> n;
	for (int i = 1; i <= n; i++) cin >> A[i], CNT[A[i]]++;
	sort(A + 1, A + 1 + n);
	int d = A[n];
	for (int i = 0; i <= d; i++) if (CNT[max(i, d - i)]-- == 0) die("Impossible");
	for (int i = 1; i <= n; i++) if (CNT[i] && i < (d + 1) / 2 + 1) die("Impossible");
	cout << "Possible" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=n-1;i > m;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main() {
  lli A,B,C,D,E,F=1,N,M,K,sum=0,num=0,ans=0;
  cin >> N;
  vector<int>P(N,0),Q(0,0);
  rep(i,0,N)cin >> P[i];
  Sort(P);
  rep(i,1,N){
    if(P[i]!=P[i-1])Q.pb(i);
  }
  Q.pb(N);
  N=Q.size();
  for(int i=N-1;i>0;i--)Q[i]-=Q[i-1];
  rep(i,0,N)sum+=Q[i]%2;
  Out(sum);
}

Measured memory_bytes: 1276
#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<cmath>
#include<algorithm>
using namespace std;


int main() {
	char c;
	cin >> c;
	if (c == 'A')cout << 'T';
	if (c == 'T')cout << 'A';
	if (c == 'C')cout << 'G';
	if (c == 'G')cout << 'C';
	cout << endl;
	return 0;
}

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

int main(){
    long long s,c;
    cin>>s>>c;
    long long ans; 
    if(s*2 > c){
        ans = c / 2;
    }
    else{
        ans = (s + c / 2) / 2;
    }

    cout<<ans<<endl;

    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int mini_1(int i, int j, int k){
	if(i <= j && i <= k){
		return i;
	}else if(j <= i && j <= k){
		return j;
	}else{
		return k;
	}
}

int mini_2(int i, int j, int k){
	if(i <= j && j <= k){
		return j;
	}else if(k <= j && j <= i){
		return j;
	}else if(i <= j && k <= i){
		return i;
	}else if(j <= i && i <= k){
		return i;
	}else{
		return k;
	}
}

int main(){
	
	int a, b, c, n, min1, min2, r;
	
	cin >> a >> b >> c;
	
	while(a != 0 || b != 0 || c != 0){
		
		min1 = mini_1(a, b, c);
		min2 = mini_2(a, b, c);
		
		cin >> n;
		
		for(int i = 0; i < n; i++){
			cin >> r;
			if(4 * r * r > min1 * min1 + min2 * min2){
				printf("OK\n");
			}else{
				printf("NA\n");
			}
		}
		
		cin >> a >> b >> c;
	}
	
	return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll n, k; cin >> n >> k;
    COMinit();

    ll mx = min(k, n);
    ll ans = 0;
    for(ll m = 0; m <= mx; m++) ans += COM(n, m) * COM(n-1, m), ans %= MOD;

    cout << ans << endl;
}


Measured memory_bytes: 12160
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [k]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const [a, b]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const min = Math.ceil(a / k);
    return min * k <= b ? "OK" : "NG";
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29628
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
const int MAX = 10000001;
bool nonpri[MAX];
vector<int> qpri;
int n;
int main(void){
  FOR(i,2,MAX){
    if(!nonpri[i]){
      for(int k=2; i*k<MAX; k++) nonpri[i*k] = true;
    }
  }
  FOR(i,13,MAX){
    if(!(nonpri[i]||nonpri[i-2]||nonpri[i-6]||nonpri[i-8])){
      qpri.push_back(i);
    }
  }
  while(cin>>n){
    if(!n) break;
    vector<int>::iterator it = upper_bound(qpri.begin(),qpri.end(),n);
    it--;
    cout<<*it<<endl;
  }
  return 0;
}

Measured memory_bytes: 10000
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m, q;
    int a, b, c, d;
    cin >> n >> m >> q;
    vector<vector<int>> arr;
    while(q--) {
        cin >> a >> b >> c >> d;
        arr.push_back({a-1, b-1, c, d});
    }
    int ans = 0;
    auto dfs = [&] (auto& self, int d, int lower, vector<int>& st) -> void {
        if (d == n) {
            int score = 0;
            for(auto vec: arr) {
                if (st[vec[1]]-st[vec[0]] == vec[2])
                    score += vec[3];
            }
            ans = max(ans, score);
            return;
        }
        for(int i = lower; i <= m; i++) {
            st.push_back(i);
            self(self, d+1, i, st);
            st.pop_back();
        }
    };
    vector<int> tmp;
    dfs(dfs, 0, 1, tmp);
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a==0&&b==0)
            break;
        for(int i=0;i<a;i++)
            {
            for(int j=0;j<b;j++)
                {cout<<"#";}
                cout<<endl;
            }
            cout<<endl;

    }
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <sys/time.h>

using namespace std;

const long long mod = 1000000007;

void solve(long long N, long long M, vector<long long> a){
  vector<long long> l;
  if (M==0) {
    l.push_back(N+1);
  } else {
    l.push_back(a[0]);
    for (int i = 1; i < M; i++) {
      if (a[i] == a[i-1]) {
        continue;
      }
      l.push_back(a[i] - a[i-1] - 1);
    }
    l.push_back(N-a[M-1]);
  }
  vector<long long> fib(3);
  fib[0] = 0;
  fib[1] = 1;
  fib[2] = 1;
  for (int i = 0; i < N+3; i++) {
    fib.push_back((fib[i+1]+fib[i+2])%mod);
  }
  long long ans = 1;
  for (int i = 0; i < l.size(); i++) {
    ans *= fib[l[i]];
    ans %= mod;
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  long long M;
  scanf("%lld",&N);
  scanf("%lld",&M);
  vector<long long> a(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&a[i]);
  }
  solve(N, M, a);
  return 0;
}


Measured memory_bytes: 4980
n, k = map(int, input().split())
mod = 10 ** 9 + 7

acc_min = []
acc_max = []
s_min = 0
s_max = 0
for i in range(n + 1):
    s_min += i
    acc_min.append(s_min % mod)
    s_max += n - i
    acc_max.append(s_max % mod)
ans = 0
for i in range(k, n + 2):
    ans = (ans + acc_max[i - 1] - acc_min[i - 1] + 1) % mod
print(ans)

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

using namespace std;

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

   	int count = 0;

   	for (int i = 0; i < 3; i++)
   	{
   		if (s[i] == t[i])
   		{
   			count++;
   		}
   	}

 	cout << count;
 	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
const int INF=(1<<30)-1;
const int MOD=1000000007;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int primes[1000];
int n;
ll ans = 1LL;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    fill(primes, primes+1000, 1);
    erep(i, 2, n) {
        int p = i;
        for (int j = 2; j*j <= n; j++) {
            while (p%j == 0) {
                primes[j]++;
                p /= j;
            }
        }
        primes[p] += 1;
    }
    rep(i, 2, 1000) {
        ans = ans * primes[i] % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
int main() {
  int N;
  cin >> N;
  int count = 0;
  for(int i=1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      for(int k = 1; k <=N; k++){
        count += gcd(gcd(i,j),k);
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3636
N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)

def main
  if A.all? { |i| i == 0 }
    print "Yes\n"
    return
  end
  
  h = {}
  A.each do |a|
    h[a] ||= 0
    h[a] += 1
  end
  
  if h.size == 2
    a = h.sort_by { |c, cnt| c }
    c1, cnt1 = a[0]
    c2, cnt2 = a[1]
    if (c1 == 0) && (cnt1 * 3 == N)
      print "Yes\n"
      return
    else
      print "No\n"
      return
    end
  end
  
  if h.size == 3
    a = h.sort_by { |c, cnt| c }
    c1, cnt1 = a[0]
    c2, cnt2 = a[1]
    c3, cnt3 = a[2]
    if ((c1 ^ c2 ^ c3) == 0) && (cnt1 * 3 == N) && (cnt2 * 3 == N) && (cnt3 * 3 == N)
      print "Yes\n"
      return
    else
      print "No\n"
      return
    end
  end
  
  print "No\n"
end

main

Measured memory_bytes: 12700
from sys import stdin
from collections import deque
n,k = map(int,stdin.readline().split())
a = list(map(int,stdin.readline().split()))
dp = [0]*(k+1)
for i in range(a[0],k+1):
    for j in a:
        if i-j >= 0 and dp[i-j] == 0:
            dp[i] = 1
            break
if dp[-1]%2:
    print('First')
else:
    print('Second')


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

using pii = pair <int, int>;

#define N 300000

int n, m;
int dp[N], val[N], w[N];

int D, Q;

vector <pii> can[N];

void query(int &ans, int v, int L, int cur) {
	if (v <= m) {
		ans = max(ans, cur + (--lower_bound(can[v].begin(), can[v].end(), pii(L + 1, 0))) -> second);
		return;
	}
	query(ans, v >> 1, L, cur);
	if (L >= w[v]) query(ans, v >> 1, L - w[v], cur + val[v]);
	return;
}

int main() {
	D = 10;
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++) scanf("%d %d", &val[i], &w[i]);
	dp[1] = 0;
	for (int i = 2; i <= n; i ++) dp[i] = dp[i>>1] + 1;
	m = min(n, (1<<D) - 1);
	can[0] = {{0, 0}};
	for (int i = 1; i <= m; i ++) {
		auto &res = can[i];
		auto &from = can[i>>1];
		vector <pii> tmp;
		tmp = from;
		for (auto x : from) {
			tmp.emplace_back(x.first + w[i], x.second + val[i]);
		}
		sort(tmp.begin(), tmp.end());
		for (auto x : tmp) {
			if (!res.empty() && res.back().second >= x.second) continue;
			res.push_back(x);
		}
	}
	scanf("%d", &Q);
	while (Q --) {
		int v, L, ans = 0;
		scanf("%d %d", &v, &L);
		query(ans, v, L, 0);
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 19300
#include<bits/stdc++.h>
#define pb          push_back
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,i,j,k,l,sum=0,flag=0,ans=0,a[101],v[101],m;
int dp[100005];
void solve(){
	int K;
	cin>>n>>K;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<=K;i++) dp[i]=1;
	dp[0] = 0;
	for(int k=1;k<=K;k++){
		bool flag= false;
		for(int j=0;j<n;j++){
			if(k-a[j]>=0 && dp[k-a[j]]==0)
				flag =true;
		}
		if(flag)
			dp[k] = true;
		else 
			dp[k] = false;
	}
	cout<<(dp[K]?"First":"Second");	
}
signed main()
{
    ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll num[ten52];
//ll num[10][10];
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<string,ll>::iterator iter;

int main(void)
{
    long long int sum=0,range=0,ceiling;
    double ans=0.0,d;
    long long int m,n,o,i,j,k=0,money;
    long long int a,a1=0,a2=0,a3=0,ar,as,at1;
    string s;
    char c;
    a=a1=a2=a3=0;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    cin>>n>>m;
    if(n>=10) cout<<m;
    else cout<<100*(10-n)+m;

    return 0;
}





Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = -1;
		int N = sc.nextInt();
		int M = sc.nextInt();
		boolean ok = true;
		
		int xxx[] = new int[3];
		
		for (int i=0; i<3; i++) {
			xxx[i] = -1;
		}
		
		for (int i=0; i<M; i++) {
			int s = sc.nextInt() - 1;
			int c = sc.nextInt();
			
			if (xxx[s] == -1) {
				xxx[s] = c;
			} else if (xxx[s] != c) {
				ok = false;
			}
		}
		
		if (xxx[0] == 0 && N > 1) {
			ok = false;
		} else if (xxx[0] == -1 && N > 1) {
			xxx[0] = 1;
		}
		
		if (ok) {
			for (int i=0; i<N; i++) {
				if (xxx[i] == -1) {
					xxx[i] = 0;
				} 
				System.out.print(xxx[i]);
			}
		} else {
			System.out.print(-1);
		}
	}
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}



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

    map<string,int> mp;

    for(int i=0;i<n;i++){
        mp[s[i]]++;
    }

    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll N;
    cin >> N;
    ll all=0;
    vector<ll> vec;
    for (ll i = 0;i<N;i++) {
        ll a;
        cin >> a;
        vec.push_back(a);
        all  = a ^ all;
    }
    for (ll i = 0;i<N;i++) {
        ll ans = all ^ vec.at(i);
        cout << ans << " ";
    }

}

Measured memory_bytes: 5364
N = int(input())

lst = []

d = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


def dfs(s, i):
    if len(s) == N:
        print(s)
        return

    for k in range(i):
        dfs(s + d[k], i)

    dfs(s+d[i], i + 1)


dfs('', 0)

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
using ll = long long;
const ll INF = 100100100;
template <typename T> inline bool chmin(T& a, T b) { 
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> inline bool chmax(T& a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int n;
  cin >> n;
  vector<ll> dp(n+10);

  dp[0] = 0;
  for(int i = 1; i <= n; ++i) {
    dp[i] = INF;
    dp[i] = min(dp[i], dp[i-1]+1);
    int power = 6;
    while(power <= i) {
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 6;
    }
    power = 9;
    while(power <= i) {
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 9;
    }

  }

  printf("%d\n", dp[n]);
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#define SF scanf
#define PF printf
#define MAXN 2010
using namespace std;
typedef long long ll;
int n,cnt[MAXN];
ll a[MAXN];
vector<int> b[MAXN],c[MAXN];
priority_queue<pair<ll,int> > qx;
ll gcd(ll x,ll y){
	if(y==0)
		return x;
	return gcd(y,x%y);	
}
int d[MAXN];
bool vis[MAXN];
void dfs(int x){
	vis[x]=1;
	for(int i=0;i<int(b[x].size());i++)
		if(vis[b[x][i]]==0){
			c[x].push_back(b[x][i]);
			d[b[x][i]]++;
			dfs(b[x][i]);
		}
}	
priority_queue<pair<ll,int> > q;
int main(){
	//freopen("newgame.in","r",stdin);
	//freopen("newgame.out","w",stdout);
	SF("%d",&n);
	for(int i=1;i<=n;i++)
		SF("%lld",&a[i]);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(i!=j&&gcd(a[i],a[j])!=1ll)
				b[i].push_back(j);
	for(int i=1;i<=n;i++)
		if(vis[i]==0)
			dfs(i);
	for(int i=1;i<=n;i++)
		if(d[i]==0)
			q.push(make_pair(a[i],i));
	while(!q.empty()){
		PF("%lld ",q.top().first);	
		int x=q.top().second;
		q.pop();
		for(int i=0;i<int(c[x].size());i++){
			d[c[x][i]]--;
			if(d[c[x][i]]==0)
				q.push(make_pair(a[c[x][i]],c[x][i]));
		}
	}
}

Measured memory_bytes: 16000
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(n);
  cout<<(n-2)*180;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

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

    vector<int> box(n,1);
    vector<bool> is_possible(n,false);
    is_possible[0] = true;

    for(int i = 0; i < m; i++){
        int from, to;
        cin >> from >> to;
        from--; to--;
        box[from]--;
        box[to]++;
        if(is_possible[from]){
            is_possible[to] = true;
        }
        if(box[from] == 0){
            is_possible[from] = false;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(is_possible[i]){ans++;}
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 640