akhauriyash/Code-Regression huggingface dataset:
import sys

input = sys.stdin.readline
M, K = map(int, input().split())

ma = 2 ** M

if M == 0:
    if K > 0:
        print(-1)
    else:
        print('0 0')

elif M == 1:
    if K != 0:
        print(-1)
    else:
        print('0 0 1 1')

elif K >= ma:
    print(-1)

else:
    arr = [x for x in range(ma) if x != K]

    for i in arr:
        print(i, end=' ')
    print(K, end=' ')

    for i in arr[::-1]:
        print(i, end=' ')
    print(K)


Measured memory_bytes: 11124
a, b, c, x = [int(input()) for _ in range(4)]

ans = 0
for i in range(0, a+1):
    for j in range(0, b+1):
        for k in range(0, c+1):
            if 500*i + 100*j + 50*k == x:
                ans += 1
print(ans)


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

using namespace std;

int main() {
	int N;

	cin >> N;
	vector<int> C(N+ 1);
	vector<int> latest(200002, -1);
	vector<unsigned int> DP(N+ 1, 0);
	for (int i = 1; i <= N; i++)
	{
		cin >> C[i];
	}

	DP[0] = 1;
	for (int i = 1; i <= N; i++) {
		if (latest[C[i]] >= 0 && latest[C[i]] + 1 != i) {
			DP[i] = DP[i - 1] + DP[latest[C[i]]];
		}
		else {
			DP[i] = DP[i - 1];
		}
		DP[i] %= (int)(1e9 + 7);
		latest[C[i]] = i;
	}

	cout << DP[N] << endl;

	return 0;
}

Measured memory_bytes: 2560
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N, M, C = sc.nextInt()
    val Bs = Array.fill(M)(sc.nextInt())
    val As = Array.fill(N, M)(sc.nextInt())
    println((for {
      i <- 0 until N
    } yield {
      val as = As(i)
      if (
        as.zip(Bs).map(x => x._1 * x._2).sum + C > 0
      ) 1 else 0
    }).sum)
  }
}


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

using namespace std;

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

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 2;
            return 0;
        }

        if (s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 3;
            return 0;
        }
    }
    cout << "-1 -1";
}


Measured memory_bytes: 3692
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int c[7][7] ={
	{0, 300, 500, 600, 700, 1350, 1650},
	{0,   0, 350, 450, 600, 1150, 1500},
	{0,   0,   0, 250, 400, 1000, 1350},
	{0,   0,   0,   0, 250,  850, 1300},
	{0,   0,   0,   0,   0,  600, 1150},
	{0,   0,   0,   0,   0,    0,  500}};
int d[6] = {6,7,5,5,20,15};
int main(){
	int s, t, h1, m1, h2, m2;
	while(cin >> s, s) {
		cin >> h1 >> m1 >> t >> h2 >> m2;
		s--, t--;
		if(s>t) swap(s,t);
		int dist = 0;
		rep(i,7) {
			if(s<=i&&i<t) dist += d[i];
		}
		if(h1*60+m1>=17*60+30 && 19*60+30>=h1*60+m1 ||
		   h2*60+m2>=17*60+30 && 19*60+30>=h2*60+m2) {
			if(dist <= 40) cout << ceil(c[s][t] / 100.0) * 50 << endl;
			else cout << c[s][t] << endl;
		} else cout << c[s][t] << endl;
	}
    return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  in(N);
  vi v(N);
  each(x, v) in(x);
  sort(all(v));
  double ans = v[0];
  rep(i, 1, N) {
    ans = (ans + v[i]) / 2;
  }
  print(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(a,j,n) for(ll i=a;i<j;i=i+n )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 1000000009;
ll i;


int main(){
    
    string S;
    cin>>S;
    ll haji=0;
    ll size=S.length();
    bool ans=true;
    while(haji!=size){
        if(S.at(haji)=='d'&&haji+4<size){
            if(S.at(haji+1)=='r'&&S.at(haji+2)=='e'&&S.at(haji+3)=='a'&&S.at(haji+4)=='m'){
                haji+=5;
                if(haji+1<size){
                    if(S.at(haji)=='e'&&S.at(haji+1)=='r')haji+=2;
                    if(haji<size){
                        if(S.at(haji)=='a')haji-=2;
                    }
                }
                
            }
            else{
                ans=false;
                break;
            }
        }
        else if(S.at(haji)=='e'&&haji+4<size){
            if(S.at(haji+1)=='r'&&S.at(haji+2)=='a'&&S.at(haji+3)=='s'&&S.at(haji+4)=='e'){
                haji+=5;
                if(haji<size){
                    if(S.at(haji)=='r')haji++;
                }
            }
            else{
                ans=false;
                break;
            }
        }
        else{
            ans=false;
            break;
        }
    }
    if(ans)cout<<"YES";
    else cout<<"NO";
    cout<<endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define x             first
#define y             second
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define PI            3.14159265358979
#define N             200005

int solve(){
    long double a,b; cin>>a>>b;
    a=a*b+0.001;
    cout<<(int)(a);
    return 0;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (s[0] == '0') {
    cout << -1 << endl;
    return 0;
  }
  if (s.back() == '1') {
    cout << -1 << endl;
    return 0;
  }
  rep (i, n - 1) {
    int j = n - 2 - i;
    if (s[i] != s[j]) {
      cout << -1 << endl;
      return 0;
    }
  }
  vector<int> one;
  rep (i, n) {
    if (s[i] == '1') {
      one.push_back(i + 1);
    }
  }
  vector<pii> ans;
  int u = 1;
  rep1 (i, one.size() - 1) {
    int v = one[i];
    ans.push_back(pii(u, v));
    REP (j, u + 1, v) {
      ans.push_back(pii(j, v));
    }
    u = v;
  }
  REP (i, u + 1, n + 1) {
    ans.push_back(pii(u, i));
  }
  rep (i, ans.size()) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
      

    

/*
int main() {
  int n;
  cin >> n;
  vi x(n), y(n);
  bool gu = false, ki = false;
  rep (i, n) {
    cin >> x[i] >> y[i];
    if ((x[i] + y[i]) % 2 == 0) {
      gu = true;
    }
    else {
      ki = true;
    }
  }
}
*/


Measured memory_bytes: 2868
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int min = 30;
  for (int i = 0; i < N ; i++){
    int a;
    cin >> a;
    int count = 0;
    while(a%2 == 0){
      a /= 2;
      count++;
    }
    if (min > count){min = count;}
  }
  
  cout << min <<endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        List<Integer> list = getDivisor(getGcd(a, b));
        System.out.println(list.get(list.size() - k));
    }

    // 公約数
    private static List<Integer> getDivisor(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            if (n % i == 0) {
                list.add(i);
            }
        }
        return list;
    }

    // 最大公約数
    private static int getGcd(int x, int y) {
        return y == 0 ? x : getGcd(y, x % y);
    }
}

Measured memory_bytes: 21716
#include <stdio.h> 
 
int main(void)
{
    int m,f,r;
	
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1){
			break;
		}
		if(m==-1 || f==-1){
			printf("F\n");
		}else if((m+f)>=80){
			printf("A\n");
		}else if((m+f)>=65){
			printf("B\n");
		}else if((m+f)>=50){
			printf("C\n");
		}else if((m+f)>=30){
			if(r<50){
				printf("D\n");
			}else{
				printf("C\n");
			}
		}else{
			printf("F\n");
		}
	}
	
	
    return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    string s;

    cin>>s;
    if(d>c){
        bool can=true;
        //bからd
        int tb=b-1;
        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==d-1){break;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }
        if(can==false){
            cout<<"No"<<endl;return 0;
        }
        tb=a-1;

        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==c-1){break;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }
        if(can==false){
            cout<<"No"<<endl;return 0;
        }else{
            cout<<"Yes"<<endl;
        }

    }else{
        bool can=true;
        bool j=false;
        int tb=b-1;
        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==d-1){
                if(tb+1<s.size()&&s[tb+1]=='.'&&s[tb-1]=='.'){j=true;}
                break;
            }
            if(tb+1<s.size()&&s[tb+1]=='.'&&s[tb-1]=='.'){j=true;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }
        if(can==false||j==false){
            cout<<"No"<<endl;
            return 0;
        }
        tb=a-1;

        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==c-1){break;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }
        if(can==false){
            cout<<"No"<<endl;return 0;
        }else{
            cout<<"Yes"<<endl;
        }


    }




    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
    using namespace std;
	const int N=2e3+2;
vector<int> adj[N];
bool visited[N];
int dis[N]={};
queue<int> q;
void bfs(int x){
    visited[x] = true;
    dis[x] = 0;
    q.push(x);
    while (!q.empty()) {
    int s = q.front();
     q.pop();
// process node s
    for (auto u : adj[s]) {
    if (visited[u]) continue;
    visited[u] = true;
    dis[u] = dis[s]+1;
    q.push(u);
    }
    }
}   int main(){
    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		int n,x,y;
		cin>>n>>x>>y;
		for(int i=1;i<=n-1;i++){
			adj[i].push_back(i+1);
			adj[i+1].push_back(i);
		}
		adj[x].push_back(y);
		adj[y].push_back(x);
		int arr[n]={};
		for(int i=0;i<=n;i++){
			visited[i]=false;
		}
		for(int i=1;i<=n;i++){
			bfs(i);
			for(int j=1;j<=n;j++){
				arr[dis[j]]++;
				dis[j]=0;
				visited[j]=false;
			}
		}
		for(int i=1;i<n;i++){
			cout<<arr[i]/2<<"\n";
		}
		//cout<<"\n";
		return 0;
    }

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int ans;
signed main () {
    scanf ("%lld", &n);
    for (int i = 1; i <= n; i++) {
        ans += i * (n - i + 1);
    }
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf ("%lld%lld", &x, &y); if (x > y) swap (x, y);
        ans -= x * (n - y + 1);
    }
    printf ("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3760
/* 
 * ALDS1_11B.cpp
 */
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int N;
int ad_k[101];
int ad_list[101][101];
int result[101];

struct Data {
    int d, v;
};

queue<Data> q;

int main(void) {

    scanf("%d", &N);
    for (int i = 1, id; i <= N; ++i) {
        scanf("%d", &id);
        scanf("%d", ad_k + id);
        for (int j = 0; j < ad_k[id]; ++j) {
            scanf("%d", ad_list[id] + j);
        }
    }

    q.push({0, 1});
    while (!q.empty()) {
        Data data = q.front();
        q.pop();

        for (int i = 0; i < ad_k[data.v]; ++i) {
            if (result[ad_list[data.v][i]] != 0 || ad_list[data.v][i] == 1)
                continue;
            result[ad_list[data.v][i]] = data.d + 1;
            q.push({data.d + 1, ad_list[data.v][i]});
        }
    }

    for (int i = 1; i <= N; ++i) {
        printf("%d ", i);
        if (result[i] == 0 && i != 1)
            printf("-1\n");
        else
            printf("%d\n", result[i]);
    }

    return 0;
}

Measured memory_bytes: 3180
while True :
    try :
        A = list(input())
    except EOFError :
        break
    
    for j in range(9) :
        for i in range(len(A)-1) :
            A[i] = (int(A[i]) + int(A[i+1])) % 10
        del A[-1]
    print(A[0])


Measured memory_bytes: 5604
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string s;
    int sum=700;

    cin >> s;

    if(s[0]=='o')sum+=100;
    if(s[1]=='o')sum+=100;
    if(s[2]=='o')sum+=100;

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<ll> A(N),B(N);
    rep(i,N)cin >> A[i];
    rep(i,N)cin >> B[i];
    ll sumA = accumulate(all(A),0LL);
    ll sumB = accumulate(all(B),0LL);
    if(sumB > sumA){
        cout << -1 << endl;
        return 0;
    }
    vector<ll> d(N);
    rep(i,N){
        d[i] = A[i] - B[i];
    }
    sort(all(d));
    ll ans = 0;
    ll hsk_sum = 0;
    rep(i,N){
        if(d[i] < 0){
            ans++;
            hsk_sum += abs(d[i]);
        }

    }
    for(int i = N-1; i >= 0; i--){
        if(d[i] > 0){
            if(hsk_sum <= 0)break;
            hsk_sum -= abs(d[i]);
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5432
#include<iostream>
using namespace std;
int main(){
	int x,y;
	while(1){
		cin>>x>>y;
		if(x==0&&y==0){
			break;
		}
		else if(x<=y){
			cout<<x<<" "<<y<<endl;
		}
		else if(y<x){
			cout<<y<<" "<<x<<endl;
		}
	}
return 0;
}

Measured memory_bytes: 3008
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		for (;;) {
			int e = sc.nextInt();
			if (e == 0) break;
			int min = INF;
			for (int z=0;z*z*z<=e;z++) for (int y=0;y*y<=e-z*z*z;y++) {
				int x = e - z*z*z - y*y;
				min = min(min, x+y+z);
//				debug(z, y, x);
			}
			System.out.println(min);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26480
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[][] red = new int[N][2];
        int[][] blue = new int[N][2];
        for (int i = 0; i < N; i++) {
            red[i][0] = sc.nextInt();
            red[i][1] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            blue[i][0] = sc.nextInt();
            blue[i][1] = sc.nextInt();
        }

        // 昇順
        Arrays.sort(blue, (x, y) -> x[0] - y[0]);
        Arrays.sort(red, (x, y) -> x[1] - y[1]);

        int cnt = 0;
        boolean[] used = new boolean[N];
        for (int i = 0; i < blue.length; i++) {
            for (int j = red.length - 1; j >= 0; j--) {
                if (blue[i][0] > red[j][0] && blue[i][1] > red[j][1] && !used[j]) {
                    used[j] = true;
                    cnt++;
                    break;
                }
            }
        }

        out.println(cnt);
    }
}

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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max(0,min(b,d)-max(a,c))<<endl;
}

Measured memory_bytes: 256
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
S = input()[:-1]
ans = 0
prev = ""
for s in S:
    if s == prev:
        continue
    else:
        prev = s
        ans += 1
print(ans)


Measured memory_bytes: 39536
#include <ctime>
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <queue>
#include <numeric>
using namespace std;

#define int long long
#define INF 1e18
#define EPS 1e-9
#define NIL -1

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

signed main(){
    int n; cin >> n;
    vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];
    vector<int> left(n, 0), right(n, 0);

    left[0] = a[0];
    right[n - 1] = a[n - 1];
    for(int i = 1; i < n; i++) left[i] = gcd(left[i - 1], a[i]);
    for(int i = n - 2; i >= 0; i--) right[i] = gcd(right[i + 1], a[i]);

    int ans = 0;
    for(int i = 0; i < n; i++) {
        int tmp;
        if(i == 0) tmp = right[i + 1];
        else if(i == n - 1) tmp = left[i - 1];
        else tmp = gcd(left[i - 1], right[i + 1]);
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 2560
// AOJ Volume 0 Problem 0056

#include <stdio.h>

#define GET_FLG(n)  (flg_prime[((n) / 2) - 1])
#define SET_FLG(n)  (flg_prime[((n) / 2) - 1] = 1)

char flg_prime[50000];

int main(void)
{
    int i;
    int j;
    int n;
    int cnt;
    
	flg_prime[0] = flg_prime[1] = 1;
    for (i = 2; i <= 50000; i++){
        if (flg_prime[i] == 0){
            j = i * 2;
            while (j <= 50000){
                flg_prime[j] = 1;
                j += i;
            }
        }
    }

    while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		cnt = 0;
		
		for (i = 2; i <= n / 2; i++){
			if (flg_prime[i] == 0 && flg_prime[n - i] == 0){
				cnt++;
//				printf("<%d %d>\n", i, n - i);
			}
		}
		printf("%d\n", cnt);
    }
    
    return (0);
}

Measured memory_bytes: 452
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<vector<vector<int>>>>;
 int main(){
 int h,a;
   cin>>h>>a;
   if(h%a==0) cout<<h/a;
   else cout<<h/a+1;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int ans = 0;
int n;
string s;

void f(string t){
	int i=0,j=0;
	while(i<s.length()&&j<t.length()){
		if(s[i]==t[j]){
			i++;
			j++;
		}
		else {
			i++;
		}
		if(j==t.length()){
			ans++;
			return;
		}
	}
	
}

int32_t main(){
	cin>>n>>s;
	for(char i='0';i<='9';i++){
		for(char j='0';j<='9';j++){
			for(char k='0';k<='9';k++){
				string t;
				t+=i;t+=j;t+=k;
				f(t);
			}
		}
	}
	cout<<ans;
}


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 k;
  cin >> k;
  int ans =0;
  for(int i=1;i <=k;i++){
   for(int j=1;j <=k;j++){
    for(int l=1;l <=k;l++){
     ans += gcd(i,gcd(j,l)); 
    }
   }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp

using namespace std;

inline int ceiling(int n, int d) {
	return n % d == 0 ? n / d : n / d + 1;
}

int main() {
	int W, H, N; cin >> W >> H >> N;
	int x_min = 0, x_max = W, y_min = 0, y_max = H;
	int x, y, a;
	for (size_t i = 0; i < N; i++) {
		cin >> x >> y >> a;
		switch (a) {
			case 1:
				x_min = max(x_min, x);
				break;
			case 2:
				x_max = min(x_max, x);
				break;
			case 3:
				y_min = max(y_min, y);
				break;
			case 4:
				y_max = min(y_max, y);
				break;
		}
	}
	auto X = x_max - x_min;
	if (X <= 0) {
		cout << 0 << endl;
		return 0;
	}
	auto Y = y_max - y_min;
	if (Y <= 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << min(W*H, X*Y) << endl;
}


Measured memory_bytes: 256
# ABC 067
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)

debug = False
A,B = getIntList()
if A%3==0 or B%3==0 or (A+B)%3==0: print('Possible')
else: print('Impossible')

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

int n;
vector<int> pos[100010];
stack<int> sta;
int cnt[100010],first;

inline void dfs(int v,int pr)
{
	cnt[v]=1;
	sta.push(v);
	
	if(v==n-1)
	{
		stack<int> t=sta;
		for(int i=0;i<sta.size()/2-1;i++) t.pop();
		first=t.top();
	}
	
	for(auto to:pos[v])
	{
		if(to==pr) continue;
		dfs(to,v);
		cnt[v]+=cnt[to];
	}
	sta.pop();
}

int main()
{
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		pos[a].push_back(b);
		pos[b].push_back(a);
	}
	
	first=-1;
	dfs(0,0);
	cout<<(cnt[first]*2<n?"Fennec":"Snuke");
	
	return 0;
}

Measured memory_bytes: 21120
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
using vint = vector<int>;
using vLL = vector<LL>;

vector<vector<LL>>  comb(4000, vector<LL>(4000, 1));
int main(){
    int N, K;
    cin >> N >> K;
    LL mod = 1e9+7;
    for(int i = 1;i < 2010;i++){
        for(int j = 1;j < 2010;j++){
            if(i < j)  comb[i][j] = 0;
            else if(i == j) comb[i][j] = 1;
            else    comb[i][j] = (comb[i-1][j]+comb[i-1][j-1])%mod;
        }
    }
    for(int i = 1;i <= K;i++){
        LL ans = comb[K-1][K-i]*comb[N-K+1][i];
        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 125440
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;

bool A[110][110],flag[110];
int d[110];
int n;

void bfs(){
	queue<int> Q;
	Q.push(1);
	d[1]=0;
	while(Q.empty()==0){
		int u=Q.front();
		Q.pop();
		for(int i=2;i<=n;i++){
			if(A[u][i]==true && flag[i]==false ){
				flag[i]=true;
				Q.push(i);
				d[i]=d[u]+1;
			}
		}
	}
	for(int i=2;i<=n;i++) if(flag[i]==false) d[i]=-1;
	return ;
}

int main(){
	int a,b,c;
	cin>>n;
	for(int i=1;i<=n;i++){
		flag[i]=false;
			for(int j=1;j<=n;j++){
				A[i][j]=false;
		}
	}
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		for(int j=1;j<=b;j++){
			cin>>c;
			A[a][c]=true;
		}
	}
	bfs();
	for(int i=1;i<=n;i++) cout<<i<<" "<<d[i]<<endl;	
	return 0;
}



Measured memory_bytes: 3076
'use strict'

function main(s) {

  s = s.split('\n');
  const n = Number(s[0]);
  const str = s[1].split('');
  const cum = [0]

  for (let i = 0; i < n; i++) {
    if (str[i] === 'W') {
      cum[i + 1] = cum[i] + 1;
    } else {
      cum[i + 1] = cum[i];
    }
  }

  let result = 3e5;
  for (let i = 0; i < n; i++) {
    const left  = cum[i];
    const right = (n - i - 1) - (cum[n] - cum[i + 1])
    result = Math.min(result, left + right);
  }

  console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 18448
n,m=map(int,input().split())
tmp=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
k=[tmp[i][0] for i in range(m)]
s=[tmp[i][1:] for i in range(m)]
ans=0
for switch in range(2**n):
  on_all=True
  for light in range(m):
    cnt=0
    for connect in s[light]:
      if switch>>(connect-1)&1==1:
        cnt+=1
    if cnt%2!=p[light]:
      on_all=False
  if on_all:
    ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mo 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;

ll comb(ll N_, ll C_) {
	const int NUM_ = 400001;
	static ll fact[400002], factr[400002], inv[400002];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%mo, factr[i] = factr[i - 1] * inv[i] % mo;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % mo*factr[N_ - C_] % mo;
}
ll modpow(ll a, ll n = mo - 2) {
	ll r = 1;
	while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a%mo, n >>= 1;
	return r;
}


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

	int N, M, A, B, C;
	cin >> N >> M;
	
	int ans = comb(N, 2);
	ans += comb(M, 2);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//int n=sc.nextInt();
		//long x=sc.nextLong();
		//long k=sc.nextLong();
		String s=sc.next();
		//String buff="";
		//long[] array=new long[n];
		int sum=0,buff,max=0,min=0;
		//int[] array=new int[l];
		//String s="",m="",h="";
		if(s.charAt(0)!='A' ||Character.isUpperCase(s.charAt(s.length()-1))||Character.isUpperCase(s.charAt(1))) {
			System.out.println("WA");
			System.exit(0);
		}
		for(int i=2;i<=s.length()-2;i++) {
			if(s.charAt(i)=='C') {
				sum++;
			}else if(Character.isUpperCase(s.charAt(i))){
				System.out.println("WA");
				System.exit(0);
			}

		}

		//Arrays.sort(array)
		if(sum!=1) {
			System.out.println("WA");
		}else {
			System.out.println("AC");
		}
	}
}

//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));




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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
int main() {
  ll a=0,b,A,B,t,T,sa,sb,ans=0;
  string word;
  bool flag;
  cin>>word;
  t=word.size()-1;
  while(a<t){
    if(word[a]!=word[t])ans++;
    a++;t--;
  }
  cout<<ans<<endl;
  //vector<vector<int>> sss(h,vector<int>(w));
  //vector<int> a(k),b(k);
  //char x;
}

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

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
string A,B;






int main()
{

	cin >> A >> B;

	if(A.length() > B.length()){
		cout << "GREATER" << endl;
	} else if(A.length() < B.length()){
		cout << "LESS" << endl;
	} else {
		int i = 0;
		while(i < A.length()){
			if(A[i] > B[i]){
				cout << "GREATER" << endl;
				return 0;
			} else if(A[i] < B[i]) {
				cout << "LESS" << endl;
				return 0;
			}
			i++;
		}
		cout << "EQUAL" << endl;
	}





}

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


int main() {
  long long n,L[n+1];
  cin>>n;
  L[0]=2;
  L[1]=1;
  for(long long i=2;i<= n;i++)L[i]=L[i-1]+L[i-2];
  cout<<L[n]<<endl;
  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	
	int n,S[10000],q,T[500],i,j,C=0;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d", &S[i]);	
	}
	
	scanf("%d",&q);
	for(j=0;j<q;j++){
		scanf("%d",&T[j]);
	}
	
	for(i=0;i<q;i++){
		
		for(j=0;j<n;j++){
			if(T[i]==S[j]){C++; break;}
			}
		
	}
	
	printf("%d\n",C);
	
	return 0;}
	
	
	
	

Measured memory_bytes: 640
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define PER(i,a,b) for(int i=(a);i>(b);i++)
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(s, n) memset(s, n, sizeof(s))
#define IN(t, x) (t.find(x) != t.end())
#define PB push_back
#define MP make_pair
#define VI vector<int>

typedef vector<pair<int, int>> VPII;
typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
const int MOD = (int) 1e9 + 7;//

ll get(ll a, ll b, ll x) {
    ll lo = (a / x) * x;
    if (lo < a) lo += x;
    ll hi = (b/x) * x;
    if (lo <= hi) {
        ll diff = hi - lo;
        ll ret = 1 + diff/x;
//        cout << ret << "\n";
        return ret;
    }
    return 0;
}

int main() {
    ll a,b,c,d; cin >> a>>b>>c>>d;
    ll cnt = 0;
    cnt += get(a,b,c);
    if (c != d)
        cnt += get(a,b,d);

    if (c != d) {
        ll lcm = (c*d) / __gcd(c,d);
        cnt -= get(a,b,lcm);
    }
    ll tot = b + 1 - a;
    cout << tot - cnt << "\n";

    return 0;
}

Measured memory_bytes: 256
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;



int main() {
    int n,k;
    cin>>n>>k;
    map<int,int>qaq;
    for(int i=1;i<=k;i++){
        int d;
        cin>>d;
        for(int i=1;i<=d;i++){
            int x;
            cin>>x;
            qaq[x]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(!qaq.count(i)) ans++;
    }    
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

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

    ll N, H; cin >> N >> H;
    vel a(N), b(N); rep(i,N) cin >> a[i] >> b[i];

    ll ma = maxel(a); sort(rall(b));

    int cnt = 0;
    rep(i,N) {
        if(b[i] > ma) { H -= b[i]; cnt++; }
        if(H <= 0) {cout << cnt << endl; return 0;}
    }

    while(H > 0) {
        H -= ma;
        cnt++;
    } 
    cout << cnt << endl;
    return 0;

    
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
#define RENT 100000
int main(){
    int n;
    while(cin>>n){
        int ans=0;
        for(int a=0;a<10;a++){
            for(int b=0;b<10;b++){
                for(int c=0;c<10;c++){
                    for(int d=0;d<10;d++){
                        if(a+b+c+d==n)ans++;
                    }
                }
            }
        }
         
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3100
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cassert>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<string, int> si;
const int INF = 1 << 29;
#define mp make_pair
#define fi first
#define se second

int main() {
    ios::sync_with_stdio(false);
    int num, cnt[2] = {0, 0};
    while (cin >> num) {
        if (num == 5) cnt[0]++;
        else if (num == 7) cnt[1]++;
    }
    if (cnt[0] == 2 && cnt[1] == 1) cout << "YES";
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long

signed main() {
    int n;
    cin >> n;

    FOR(i,1,3501) {
        FOR(j,1,3501) {
            int k = (n*i*j);
            int k2 = (4*i*j-n*i-n*j);
            if(k2==0) continue;
            if(k%k2==0) {
                k = k/k2;
                if(0<=k && k<=3500) {
                    cout << i <<" "<<j<<" "<<k << endl;
                    return 0;
                }
            }
        }
    }

  return 0;
}



Measured memory_bytes: 3688
n=int(input())
x=input()
ans=0
for i in range(0,10):
  k=0
  ss="00"+str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
for i in range(10,100):
  k=0
  ss="0"+str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
for i in range(100,1000):
  k=0
  ss=str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
print(ans)

Measured memory_bytes: 44028
N, K = map(int,input().split())

n_list = [0 for n in range(N)]
 
for k in range(K):
    d = int(input())
    d_list = map(int, input().split())
    for d in d_list:
        n_list[d-1] = 1
print(n_list.count(0))

Measured memory_bytes: 9180
package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"sort"
	"strconv"
	"testing"
)

/*-----------Main-----------*/

func main() {
	a := readI()
	b := int(readF()*100 + 0.5)

	fmt.Println(a * b / 100)
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	testing.Init()
	if flag.Parse(); flag.Arg(0) == "debug" {
		debug()
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/random_12.in")
	if err != nil {
		fmt.Println("Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


Measured memory_bytes: 1844
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int R = sc.nextInt();
    
    if(N >= 10)
      System.out.println(R);
    else{
      int Rate =R + 100 * (10 - N);
      System.out.println(Rate);
    }
  }
}


Measured memory_bytes: 21844
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, dp[3010][3010], A[3010];

const int TARO = 0;
const int JIRO = 1;

int solve(int l, int r, int turn=TARO) {
    int &val = dp[l][r];
    if(val != INF) return val;
    if(l == r) return val = 0;
    
    val = (turn == TARO ? -INF : INF);
    if(turn == TARO) {
        chmax(val, A[l  ] + solve(l+1, r, 1 - turn));
        chmax(val, A[r-1] + solve(l, r-1, 1 - turn));
    }
    if(turn == JIRO) {
        chmin(val, solve(l+1, r, 1 - turn) - A[l  ]);
        chmin(val, solve(l, r-1, 1 - turn) - A[r-1]);
    }
    return val;
}

signed main() {
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }

    fill(dp[0], dp[N+1], INF);
    cout << solve(0, N) << endl;
    return 0;
}


Measured memory_bytes: 71040
#include<stdio.h>
int main(void)
{
int i;
	long long int n,a;
	scanf("%lld",&n);
	a=1;
	for(i=1;i<=n;i++){
		a=a*i;
		a=a%1000000007;
	}
	printf("%lld\n",a);
	return 0;
}


Measured memory_bytes: 128
function Main(input) {
    input = input.split(" ");
	console.log( parseInt(input[0]*input[1]/gcd(input[0], input[1])) );
}
function gcd(a, b){
    return a==0? b : gcd(b%a, a);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int sumA = 0,sumB = 0,apoint[4],bpoint[4];
	for(int i = 0;i<4;i++){
		cin >> apoint[i];
		sumA = sumA + apoint[i];
	}
	for(int i = 0;i<4;i++){
		cin >> bpoint[i];
		sumB = sumB + bpoint[i];
	}
	if(sumB > sumA){
		cout << sumB << endl;
	}
	else if(sumA > sumB){
		cout << sumA << endl;
	}
	else{
		cout << sumA << endl;
	}
	return 0;
}

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

typedef long long ll;
const int MOD = 1000000007;

ll cmb[1010][1010];


long long inv(int a, int p) { return a==1 ? 1 : (1-p*inv(p%a,a))/a+p; }

ll facmemo[1010];
ll fac(int n) {
  ll& res = facmemo[n];
  if(res == 0) {
    res = 1;
    for(int i = 1; i <= n; ++i) {
      res = (res * i) % MOD;
    }
  }
  return res;
}

ll calc(int rest, int mini, int here) {
  ll x = inv(fac(here), MOD);
  REP(i, here) {
    x = (x * cmb[rest][mini]) % MOD;
    rest -= mini;
  }
  return x;
}

int A, B, C, D;
ll memo[1010][1010];
int solve(int rest, int mini) {
  ll& res = memo[rest][mini];
  if(res < 0) {
    if(rest == 0) {
      res = 1;
    } else if(mini > B) {
      res = 0;
    } else {
      res = solve(rest, mini+1);
      for(int here = C; here <= D && here*mini <= rest; ++here) {
        ll x = calc(rest, mini, here); // ここの割当方法
        ll y = solve(rest-here*mini, mini+1);
        res = (res + x*y%MOD) % MOD;
      }
    }
  }
  return res;
}

int main(void) {
  int N;
  cin >> N >> A >> B >> C >> D;

  REP(i, 1010) {
    cmb[i][0] = 1;
    for(int j = 1; j <= i; ++j) {
      cmb[i][j] = (cmb[i-1][j-1] + cmb[i-1][j]) % MOD;
    }
  }

  memset(memo, -1, sizeof memo);
  ll res = solve(N, A);
  printf("%lld\n", res);
  
  return 0;
}


Measured memory_bytes: 16256