akhauriyash/Code-Regression huggingface dataset:
def factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**0.5)+1):
        if(temp%i==0):
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(temp!=1):
        arr.append([temp,1])
    return arr

N,P=map(int,input().split())
li=factorization(P)
res=1
for i in range(len(li)):
        res*=li[i][0]**(li[i][1]//N)
print(res)

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

public class Main {

	void solve() {
		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();
		
		long mi = A * (N-1) + B;
		long ma = A + B *(N-1);
		long ans = ma - mi + 1;
		if (ans < 0) ans = 0;
		out.println(ans);
	}

	static void tr(Object... os) { System.err.println(deepToString(os)); }

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

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).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 (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n); rep (i, n) cin >> a[i];
    ll ans = 0;
    map<int, ll> mpm, mmm, mpp, mmp;
    rep (i, n) {
        int j = i + 1;
        mpp[a[i] + j]++;
        mpm[a[i] - j]++;
        mmp[-a[i] + j]++;
        mmm[-a[i] - j]++;
    }
    for (auto p : mpm) {
        ans += p.second * mmm[p.first];
    }
    for (auto p : mpp) {
        ans += p.second * mmm[p.first];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 73300
#include<iostream>
#include<string>
#include<stdio.h>
#include <sstream> // std::stringstream
using namespace std;

int ch(char c){
  switch (c) {
    case 'A':return 0;
    case 'B':return 1;
    case 'C':return 2;
    case 'D':return 3;
    case 'E':return 4;
    case 'F':return 5;
    case 'G':return 6;
    case 'H':return 7;
    case 'I':return 8;
    case 'J':return 9;
    case 'K':return 10;
    case 'L':return 11;
    case 'M':return 12;
    case 'N':return 13;
    case 'O':return 14;
    case 'P':return 15;
    case 'Q':return 16;
    case 'R':return 17;
    case 'S':return 18;
    case 'T':return 19;
    case 'U':return 20;
    case 'V':return 21;
    case 'W':return 22;
    case 'X':return 23;
    case 'Y':return 24;
    case 'Z':return 25;
  }
  return -1;
}


int main(){

  string s;
  int n;
  std::cin >> n>>s;

  int al[26]={};
  for (int i = 0; i < 26; i++) {
    al[i]=(65+i+n)%91;
    if((65+i+n)%91<65)al[i]+=65;
  }

  for (long long i = 0; i < s.length(); i++)s[i]=al[ch(s[i])];

  std::cout << s << '\n';

  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n;cin>>n;
  string s;cin >>s;
  ll countR=0;
  ll countW=0;
  rep(i,n){
    if(s[i]=='W'){
      countW++;
    }else{
      countR++;
    }
  }
  ll key=0;
  rep(i,countR){
    if(s[i]=='W')key++;
  }
  cout <<key<<endl;
}

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

const int N = 300+5;

int n;
bool vis[N][N][N];
long double memo[N][N][N];

long double DP(int unos, int dos, int tres){
	int total = unos + dos + tres;
	if(total == 0) return 0.0L;
	if(vis[unos][dos][tres]) return memo[unos][dos][tres];
	long double ans = 1.0 * n / total;
	if(unos > 0){
		ans += unos * DP(unos - 1, dos, tres) / total;
	}
	if(dos > 0){
		ans += dos * DP(unos + 1, dos - 1, tres) / total;
	}
	if(tres > 0){
		ans += tres * DP(unos, dos + 1, tres - 1) / total;
	}
	vis[unos][dos][tres] = true;
	return memo[unos][dos][tres] = ans;
}

int main(){
	scanf("%d", &n);
	int unos = 0, dos = 0, tres = 0;
	for(int i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		if(x == 1) unos++;
		else if(x == 2) dos++;
		else tres++;
	}
	printf("%.10Lf\n", DP(unos, dos, tres));
	return 0;
}


Measured memory_bytes: 231240
N = 1000001
a = [0]* N
_, s = open(0)
for x in s.split():
  a[int(x)] += 1
for i in range(1, N):
  if a[i]:
    for j in range(i + i, N, i):
      a[j] = 0
print(a.count(1))


Measured memory_bytes: 100752
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{

    int N;
    int x[100];
    int y[100];
    int h[100];

    scanf("%d", &N);

    // if(N < 1 || N > 100) {
    //     exit(0);
    // }

    for(int i = 0;i < N;i++) {
        scanf("%d %d %d", &x[i], &y[i], &h[i]);
        // if(x[i] < 0 || x[i] > 100 || y[i] < 0 || y[i] > 100 || h[i] < 0 || h[i] > 1000000000) {
        //     exit(0);
        // }
    }

    int init;
    for(init = 0;init < N;init++) {
        if(h[init] != 0) {
            break;
        }
    }


    for(int i = 0;i <= 100;i++) {
        for(int j = 0;j <= 100;j++) {
            // i番目の高さからheightを算出
            int H = h[init] + abs(x[init] - i) + abs(y[init] - j);

            int flag = 0;
            for(int k = 0;k < N;k++) {
                int tmpH = H - abs(i - x[k]) - abs(j - y[k]);
                // printf("%d", tmpH);
                if(tmpH < 0) {
                    tmpH = 0;
                }

                if(tmpH != h[k]) {
                    flag = 1;
                    break;
                }
            }

            if(flag == 0) {
                printf("%d %d %d\n", i, j, H);
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=3005,mod=1e9+7;
int n,q;
int a[N];
int dp[N][N];
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
int Div2(int x){
	return (x&1)?((x+mod)>>1):(x>>1);
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
int add(int x,int y){
	return x+y>=mod?x+y-mod:x+y;
}
int main(){
	n=read(),q=read();
	for (int i=1;i<=n;i++)
		a[i]=read();
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			dp[i][j]=a[i]<a[j]?1:0;
	for (int t=1;t<=q;t++){
		int a=read(),b=read();
		for (register int i=1;i<=n;i++){
			if (i==a||i==b)
				continue;
			dp[i][a]=dp[i][b]=Div2(add(dp[i][a],dp[i][b]));
			dp[a][i]=dp[b][i]=Div2(add(dp[a][i],dp[b][i]));
		}
		dp[a][b]=dp[b][a]=Div2(add(dp[a][b],dp[b][a]));
	}
	int ans=0;
	for (register int i=1;i<=n;i++)
		for (register int j=1;j<i;j++)
			Add(ans,dp[i][j]);
	ans=(LL)ans*Pow(2,q)%mod;
	cout << ans;
	return 0;
}

Measured memory_bytes: 35456
#include<cstdio>

int main(void)
{
	int n;
	scanf("%d",&n);
	
	int lb = 0;
	while(n>>lb) ++lb;
	
	for(int i=1; i<n; ++i)
	{
		for(int j=i+1; j<=n; ++j)
		{
			for(int k=0; k<lb; ++k)
			{
				if(((i>>k)&1) != ((j>>k)&1))
				{
					printf("%d ",k+1);
					break;
				}
			}
		}
		putchar('\n');
	}	
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

static const int N = 501;

int main(){
  int i,j,k,n,u,v,A[N][N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j] = 0;
    }
  }

  for(i=0;i<n;i++){
    
    scanf("%d%d",&u,&k);
    
    u--;

    for(j=0;j<k;j++){
      
      scanf("%d",&v);
      
      v--;

      A[u][v] = 1;

    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      
      if(j){
        printf(" ");
      }

      printf("%d",A[i][j]);
    }
    
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || a + c == b || b + c == a) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char b;cin>>b;
	if(b=='A'){
		cout<<"T"<<endl;
	}else if(b=='T'){
		cout<<"A"<<endl;
	}else if(b=='G'){
		cout<<"C"<<endl;
	}else{
		cout<<"G"<<endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int a[10005];
int c[105][105];

int main(){

	int H,W;
	int N;

	scanf("%d %d",&H,&W);
	scanf("%d",&N);

	int i,j;

	for(i=0;i<N;i++){
		scanf(" %d",&a[i]);
	}

	int dir=0;
	int pos_x=0;
	int pos_y=0;
	int color=1;

	while(1){
		if(pos_y==H){break;}
		c[pos_y][pos_x]=color;
		a[color-1]--;
		if(a[color-1]==0){color++;}
		if(dir==0){
			pos_x++;
			if(pos_x==W){
				pos_x=W-1;
				pos_y++;
				dir=1;
			}
		}
		else{
			pos_x--;
			if(pos_x==-1){
				pos_x=0;
				pos_y++;
				dir=0;
			}
		}
	}


	for(i=0;i<H;i++){
		for(j=0;j<W-1;j++){
			printf("%d ",c[i][j]);
		}
		printf("%d\n",c[i][W-1]);
	}

	return 0;
}

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

typedef long long int ll;

ll gcd(ll n,ll m){
  if(m==0){
    return n;
  }
  return gcd(m,n%m);
}

ll lcm(ll n,ll m){
  return n/gcd(n,m)*m;
}

int main(){
  int n;
  cin >> n;
  ll a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  ll ans=1;
  for(int i=0;i<n;i++){
    ans=lcm(ans,a[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
s = gets.chomp.split("")
former = (s[0] + s[1]).to_i
latter = (s[2] + s[3]).to_i
if former.between?(1, 12) && latter.between?(1, 12)
  puts "AMBIGUOUS"
elsif former.between?(1, 12)
  puts "MMYY"
elsif latter.between?(1, 12)
  puts "YYMM"
else
  puts "NA"
end


Measured memory_bytes: 1788
import java.util.Scanner;

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


    int n = sc.nextInt();  //本
    int m = sc.nextInt();  //アルゴリズムの数
    int x = sc.nextInt();  //理解度の最低ライン
    int[] c = new int[n];
    int[][] a = new int[n][m];

    for (int i = 0; i < n; i++) {
      c[i] = sc.nextInt();
      for (int j = 0; j < m; j++) {
        a[i][j] = sc.nextInt();
      }
    }

    final int INIT_NUM = 10000000;
    int cost = INIT_NUM;
    for (int i = 0; i < (int) Math.pow(2, n); i++) {
      int bin_i = i;
      int[] rikaido = new int[m];
      int total = 0;
      int pos = 0;

      for (int j = 0; j < n; j++) {
        if ((bin_i & 1) == 0) {
          bin_i >>= 1;
          pos++;
          continue;
        }

        total += c[pos];
        for (int k = 0; k < m; k++) {
          rikaido[k] += a[pos][k];
        }
        bin_i >>= 1;
        pos++;
      }

      if (checkRikaido(rikaido, x)) {
        cost = Math.min(cost, total);
      }
    }

    System.out.println(cost != INIT_NUM ? cost : "-1");
  }

  private static boolean checkRikaido(int[] rikaido, int ikichi) {
    for (int i : rikaido) {
      if (i < ikichi) return false;
    }

    return true;
  }
}


Measured memory_bytes: 28400
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuffer;

/*Question
/?????\????????????Insertion Sort?????????????????????????????????????????????????????¨??????????????????????????¶??§???????????????????????¢?????´????????????????????§??????
/??????????????£????????????????????????????°????????????????????????´???????????????????????????????????????????????????????????????????????§?????§???????????????????????????????????????????????????????????\?????????????????¨????????£??????????????????????????????????????¨?????§????????????
/?????\?????????????¬???????????????¢?????´???????????????????????????
/1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
/2 for i ??? 1 ?????? N-1 ?????§
/3 v = A[i]
/4 j = i - 1
/5 while j >= 0 ?????? A[j] > v
/6 A[j+1] = A[j]
/7 j--
/8 A[j+1] = v
/N ??????????´????????????°??? A ????????????????????????????????\????????????????????°????????????????????????????????????
/????????????????????????????????¢?????´????????????????£????????????????????????¢?????´??????????????????????¢???????????????????????¨??????????????????§??????????????\?????´??????????????¨?????? i ??????????????????????????´????????????????????????????????????????????? 
*/

/*Input
/??\??????????????????????????°?????????????????¨?????´??° N ????????????????????????2 ????????????N ????????´??°????????????????????§????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		/*??\???
		/??????????´???°?????\???????¬??????°????????\???
		*/
		int n = Integer.parseInt(sc.readLine());
		String[] st = sc.readLine().split(" ");
		int[] a = new int[st.length];
		for(int i = 0;i < st.length;i++){
			a[i] = Integer.parseInt(st[i]);
		}
		show(a);
		insertionSort(a,n);
	}

	/*insertionSort????????????
	/?¨??????????????????????
	/
	*/

	public static void insertionSort(int[] a,int n) {
		int v;
		int j;
		for(int i = 1;i < n;i++){
			v = a[i];
			j = i-1;
			while(j >= 0 && a[j] > v){
				a[j+1] = a[j];
				j--;
				a[j+1] = v;
			}
			show(a);
		}
	}

	public static void show(int[] a){
		//????????¨
		StringBuffer br = new StringBuffer();
		for(int s:a)
			br.append(s+" ");
		br.deleteCharAt(br.lastIndexOf(" "));
		br.append("\n");
		System.out.print(br);
	}
}

Measured memory_bytes: 27316
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
	map<char, char> iwi;
	iwi['i'] =  'i';
	iwi['('] =  ')';
	iwi[')'] =  '(';
	iwi['{'] =  '}';
	iwi['}'] =  '{';
	iwi['['] =  ']';
	iwi[']'] =  '[';
	string in;
	cin >> in;
	int w = 0;
	for(int i = 0; i < in.size(); i++){
		if(in[i]=='w') w = i;
	}
	int count = 1;
	int index = w+1;
	for(int i = w-1; i >= 0; i--){
		for(int j = index; j < in.size(); j++){
			if(iwi[in[i]] == in[j]){
				count += 2;
				index = j+1;
				break;
			}
		}
	}
	cout << count << endl;
	return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  ll sum=0;
  rep(i,n){
    sum^=a[i];
  }
  
  rep(i,n){
    ll tmp=sum^a[i];
    cout<<tmp<<endl;
  }
  
}

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

const int N = 200000;
int tr[N], n, m;
void add(int t, int d) { for (; t; t -= t & (-t)) tr[t] += d;}
int sum(int t) { int d = 0; for (; t <= m; t += t & (-t)) d += tr[t]; return d;}
vector <int> AD[N], ASa[N], ASb[N], ASc[N];
int ans[N];
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i)
    {
        int l, r;
        cin >> l >> r;
        AD[l].push_back(r);
    }
    for (int i = 1; i <= m; ++ i)
        for (int j = i; j <= m; j += i)
            ASa[j - i].push_back(j), ASb[j - i].push_back(-1), ASc[j - i].push_back(i),
            ASa[j].push_back(j), ASb[j].push_back(1), ASc[j].push_back(i);

    for (int i = 1; i <= m; ++ i)
    {
        for (int j = 0; j < AD[i].size(); ++ j) add(AD[i][j], 1);
        for (int j = 0; j < ASa[i].size(); ++ j)
            ans[ASc[i][j]] += ASb[i][j] * sum(ASa[i][j]);
    }
    for (int i = 1; i <= m; ++ i)
        cout << ans[i] << "\n"; 
}


Measured memory_bytes: 64364
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
}

Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ll N,x;
  cin >> N;
  vector<ll> vec(N);
  for (ll i = 0; i < N; i++) cin >> vec[i];

  bool is_continue = true;
  for (ll i = 0; i < N-1; i++) {
    ll itr = N-1-i;
    if (vec[itr]+1 == vec[itr-1]) vec[itr-1] -= 1;
    else if (vec[itr]+1 < vec[itr-1]) is_continue = false;
    if (!is_continue) break;
  }
  if (is_continue) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<=(b))
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	p(ck(c,a,b)?"Yes":"No");
	return 0;
}

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

int main(){
  int X,N;  cin >> X >> N;
  if(N == 0){
    cout << X << endl;
    return 0;
  }
  vector<int>p(N);
  vector<int>MIN(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
    MIN.at(i) = abs(p.at(i) - X);
  }
  sort(MIN.begin(),MIN.end());

  int now = -1;
  if( N > 0 && MIN.at(0) != 0){
    cout << X << endl;
    return 0;
  }
  for(int i=1;;i++){
    int count = 0;
    for(int j=0;j<N;j++){
      if(MIN.at(j) == i){
        count++;
      }
      if(count == 2)  break;
    }
    if(count == 2)  continue;
    now = i;
    if(now != -1) break;
  }

  if(now == -1){
    cout << X << endl;
    return 0;
  }

  int a = X - now;
  int b = X + now;
  for(int i=0;i<N;i++){
    if(p.at(i) == a)  break;
    if(i == N-1){
      cout << a << endl;
      return 0;
    }
  }
  for(int i=0;i<N;i++){
    if(i == N-1){
      cout << b << endl;
      return 0;
    }
  }
}

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

int main(){
    int n;
    scanf("%d",&n);
    double prob[n];
    for(int i=0;i<n;i++)scanf("%lf",&prob[i]);
    double dp[n+1][n+1];
    dp[0][0]=1;
    for(int i=1;i<n+1;i++)dp[i][0]=0;
    for(int i=1;i<n+1;i++)dp[0][i]=dp[0][i-1]*(1-prob[i-1]);
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            dp[i][j]=prob[j-1]*dp[i-1][j-1]+(1.0-prob[j-1])*dp[i][j-1];
        }
    }
    double ans=0;
    for(int i=(n+1)/2;i<n+1;i++)ans+=dp[i][n];
    printf("%.10f",ans);
    return 0;
}

Measured memory_bytes: 74168
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
#define E 1e-10

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,xp,yp,r;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >>x1>>y1>>x2>>y2>>x3>>y3;
    double a,b,c,d,e,f;
    a=x1-x2;
    b=y1-y2;
    c=x2-x3;
    d=y2-y3;
    e=(x1+x2)/2*a+(y1+y2)/2*b;
    f=(x2+x3)/2*c+(y2+y3)/2*d;
    xp=(d*e-b*f)/(a*d-b*c);
    yp=(-c*e+a*f)/(a*d-b*c);
    r=sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));

    if(xp>0) xp=(int)(xp*1000+0.5)/1000.0;
    else if(xp<0) xp=(int)(abs(xp)*1000+0.5)/1000.0*(-1);
    if(yp>0) yp=(int)(yp*1000+0.5)/1000.0;
    else if(yp<0) yp=(int)(abs(yp)*1000+0.5)/1000.0*(-1);
    if(r>0) r=(int)(r*1000+0.5)/1000.0;
    else if(r<0) r=(int)(abs(r)*1000+0.5)/1000.0*(-1);

    if(abs(xp)<0.001)xp+=E;
    if(abs(yp)<0.001)yp+=E;
    if(abs(r)<0.001)r+=E;

    cout << fixed <<setprecision(3);
    cout <<xp<<' '<<yp<<' '<<r<<'\n';
  }
  return 0;
}

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

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;

const int N = 1e6 + 5;

/***************************************************************************/

int A[N];
set<int> diff;
multiset<int> wh, par;

int main() {

	boost;
	int n, k, q; cin>>n>>k>>q;
	for(int i=1; i<=n; i++) {
		cin>>A[i];
		diff.insert(A[i]);
	}

	int ans = 2e9;

	for(auto it : diff) {
		for(int i=1; i<=n+1; i++) {
			if(A[i] >= it) par.insert(A[i]);
			else {
				while((int) par.size() >= k) {
					wh.insert(*par.begin());
					par.erase(par.begin());
				}
				par.clear();
			}
		}
		if((int) wh.size() >= q) {
			int cnt = *wh.begin();
			for(int i=1; i<q; i++) wh.erase(wh.begin());
			cnt = *wh.begin() - cnt;
			ans = min(ans, cnt);
		}
		wh.clear();
	}

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

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
 
using namespace std;
 
int n, i;
 
int ju(int in){
    if (in == 0)return 0;
    if (in % 10 == 3) {
        cout << " " << i;
        return 0;
    }
    ju(in / 10);
}
 
int main() {
    cin >> n;
    for (i = 1; i <= n; i++){
        if (i % 3 == 0) cout << " " << i;
        else ju(i);
    }
    cout << endl;
}

Measured memory_bytes: 1160
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(b/a>=c){
      System.out.println(c);
    }else{
      System.out.println(b/a);
    }
  } 
}

Measured memory_bytes: 23636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
//1 2 1
//1 1 1 0 1 1
int n,m;
int A[111111];
int main() {
	scanf("%d", &n);
	ll ans = 0;
	ll cans = 0;
	REP(i, n) {
		scanf("%d", A+i);
		if(A[i] == 0) {
			ans += cans/2;
			cans = 0;
		}
		cans += A[i];
	}
	ans += cans/2;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  int A[N];
  int b[N];
  for(int i = 0; i < N-1; i++){
    scanf("%d", &A[i]);
    b[i] = 0;
  }
  b[N-1] = 0;
  for(int i = 0; i < N-1; i++){
    b[A[i]-1] += 1;
  }

  for(int i = 0; i < N; i++){
    printf("%d\n", b[i]);
  }

  return 0;
  }


Measured memory_bytes: 3236
n=gets.to_i
s=[]
ans=0
s=gets.chomp.split("")
for i in 1...n do
  cnt=0
  x = []
  for j in 0...i do
    if x.find{ |str| str==s[j] }==nil then
      x.push(s[j])
    end
  end
  y = []
  for j in i...n do
    if y.find{ |str| str==s[j] }==nil then
      y.push(s[j])
    end
  end
  for j in 0...x.length do
    if y.find{ |str| str==x[j]}!=nil then
      cnt+=1
    end
  end
  if ans<cnt then
    ans=cnt
  end
end
p ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define N 50009
using namespace std;

const int INF = 0x3f3f3f3f;

int a[N];

int solve(int sum, int n)
{
    if(sum % 10 != 0) return sum;
    for(int i = 0; i < n; i++)
    {
        if(a[i] % 10 != 0) return sum - a[i];
    }
    return 0;
}

int main()
{
    int n, sum = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    sort(a, a+n);
    sum = solve(sum, n);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int n;
  cin>>n;
  vector<int> a(n);
  map<int,int> mp;
  REP(i,n){
    cin>>a[i];
    mp[a[i]] = i%2;
  }
  
  int ans=0;
  sort(a.begin(),a.end());
  for(int i=0;i<n;i+=2){
    if(mp[a[i]]==0)continue;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

int main(){
  int a[3]={};
  int b[2]={};
  int min = 0;

  for(int i= 0;i < 3;i++)
    {
      cin >> a[i];
    }
  for(int j= 0;j < 2;j++)
    {
      cin >> b[j];
    }
  sort(a,a+3);
  sort(b,b+2);

  min = a[0]+b[0];
  
  cout << min-50 << endl;
}



Measured memory_bytes: 3112
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

typedef long long i64;

int main()
{
	int n;
	vector<int> count;
	int maximum = -1;

	scanf("%d", &n);
	count.resize(n, 0);
	for(int i = 0; i < n; ++i) {
		int t;
		scanf("%d", &t);
		count[t] += 1;
		maximum = max(maximum, t);
	}

	bool ok = true;
	int width = count[maximum];

	int minimum = (maximum + 1) / 2;

	for(int x = maximum; x > minimum; --x) {
		if(count[x] < 2)
			ok = false;
		width = min(width, count[x]);
	}

	if(maximum % 2 == 0 && count[minimum] != 1)
		ok = false;
	if(maximum % 2 != 0 && count[minimum] != 2)
		ok = false;

	for(int x = 0; x < minimum; ++x) {
		if(count[x] > 0)
			ok = false;
	}

	if(maximum == 1) {
		ok = (n <= 2);
	}

	printf("%s\n", ok ? "Possible" : "Impossible");

	return 0;
}


Measured memory_bytes: 384
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1]*n 
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)      
        if x==y:
            return        
        if self.par[x] > self.par[y]:
            x, y = y, x       
        self.par[x] += self.par[y]
        self.par[y] = x
    def size(self, x):
      if self.par[x]<0:
        return -self.par[x]
      else:
        return 0

N, M = map(int, input().split())
UF = UnionFind(N)
for _ in range(M):
  a, b = map(int, input().split())
  UF.union(a-1, b-1)
result = 0
for i in range(N):
  s = UF.size(i)
  if s>0:
    result = max(result, s)
print(result)

Measured memory_bytes: 14360
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout() cout << std::fixed << std::setprecision(20);
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
typedef complex<double> cd;
static const double pi = 3.141592653589793;

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

  ll n,a,b; cin >> n >> a >> b;
  if(a > b || (n == 1 && a != b)) {
    cout << 0 << endl;
    return 0;
  }
  if(n == 1 && a == b) {
    cout << 1 << endl;
    return 0;
  }

  ll minSum = a * (n - 1) + b;
  ll maxSum = b * (n - 1) + a;
  ll ans = maxSum - minSum + 1;

  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      string[] input = ReadLine().Split();
      int a = int.Parse(input[0]);
      int b = int.Parse(input[1]);
      int x = int.Parse(input[2]);
      
      if (a+b>=x && a<=x){
        WriteLine("YES");
      }
      else
      {
        WriteLine("NO");
      }
    }
}

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

int main(){
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        --a[i];
    }
    
    int ans = 0;
    int now = 0;
    for (int i = 0; i < N; i++)
    {
        now = a[now];
        ans++;
        if (now == 1)
        {
            cout << ans << endl;
            return 0;
        }
        if ((i == N - 1) && now != 1)
        {
            cout << -1 << endl;
        }
        
        
    }

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#define REP(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=0;i<=n;++i)
#define INF 100000000
#define MOD 1000000009
#define ll long long

using namespace std;

typedef pair<int, int> P;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int N;
ll int H;
ll int a[100000], b[100000];
vector<ll int> v;

int main(){
    cin >> N >> H;

    REP(i, N){
        cin >> a[i] >> b[i];
    }

    ll int MAX = 0;
    REP(i, N){
        MAX = max(MAX, a[i]);
    }

    REP(i, N){
        if(b[i] > MAX) v.push_back(b[i]);
    }

    ll tmp = 0;

    if(!v.empty()){
        sort(v.begin(), v.end(), greater<int>());

        REP(i, v.size()){
            tmp += v[i];
            if(tmp >= H){
                cout << i+1 << endl;
                return 0;
            }
        }
    }

    ll int nokori = H - tmp;
    ll ans = v.size();

    ans += (nokori / MAX);

    if(nokori % MAX == 0){
        cout << ans << endl;
    } else {
        ++ans;
        cout << ans << endl;
    }

	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, W; cin >> N >> W;

    ll w1, v1; cin >> w1 >> v1;
    map<ll, vector<ll>> x;
    map<ll, vector<ll>> acc_y;
    x[0].push_back(v1);

    rep(i, N - 1){
        ll tmp_w, tmp_v;
        cin >> tmp_w >> tmp_v;
        x[tmp_w - w1].push_back(tmp_v);
    }
    rep(i, 4){
        acc_y[i].push_back(0);
        if (x[i].size() > 0){
            sort(x[i].begin(), x[i].end(), greater<ll>());
            ll tmp = 0;
            rep(j, x[i].size()){
                tmp += x[i].at(j);
                acc_y[i].push_back(tmp);
            }
        }
    }

    ll max_value = -INF;
    rep(i, x[0].size() + 1){
        rep(j, x[1].size() + 1){
            rep(k, x[2].size() + 1){
                rep(l, x[3].size() + 1){
                    ll weight = w1 * (i + j + k + l) + j + 2 * k + 3 * l;
                    ll value = (acc_y[0].at(i) - acc_y[0].at(0));
                    value += (acc_y[1].at(j) - acc_y[1].at(0));
                    value += (acc_y[2].at(k) - acc_y[2].at(0));
                    value += (acc_y[3].at(l) - acc_y[3].at(0));
                    // cout << i << " " << j << " " << k << " " << l << " " << weight << " " << value << endl;
                    if (weight <= W && value > max_value){max_value = value;}
                }
            }
        }
    }
    cout << max_value << endl;
}

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


Measured memory_bytes: 256
n, k = map(int, input().split())
s = str(input())
for i in range(n):
    if i + 1 == k:
        if s[i] == 'A':
            print('a', end='')
        elif s[i] == 'B':
            print('b', end='')
        else:
            print('c', end='')
    else:
        print(s[i], end='')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define X first
#define Y second
#define pb push_back

void solve();

int main() {
    // freopen("schools.in", "r", stdin);
    // freopen("schools.out", "w", stdout);
	ios_base::sync_with_stdio(0), cin.tie(0);
	int t;
	// cin >> t;
	t = 1;	
	while(t--) solve();
	return 0;
}

vector<ll> g[5];
bool is[5];
ll cnt;

void dfs(ll s) {
	++cnt;
	is[s] = 1;
	if (cnt == 4) {
		cout << "YES\n";
		exit(0);
	}
	for (auto d : g[s]) {
		if (!is[d]) {
			dfs(d);
		}
	}
	is[s] = 0;
	--cnt;
}

void solve() {
	for (ll i = 1; i <= 3; ++i) {
		ll t1, t2;
		cin >> t1 >> t2;
		g[t1].pb(t2);
		g[t2].pb(t1);
	}
	for (ll i = 1; i <= 4; ++i) {
		dfs(i);
	}
	cout << "NO\n";
}

Measured memory_bytes: 256
N, Y = gets.split.map(&:to_i)

max_N = [10000, 5000, 1000].map { |m| Y / m }

ans = []
0.upto(max_N[0]) do |m0|
  0.upto(max_N[1]-m0) do |m1|
  	sen = N - m0 - m1
    if sen >= 0
		if Y == m0 * 10000 + m1 * 5000 + sen * 1000
	      ans << [m0, m1, sen]
	    end
    end
  end
end

puts ans.empty? ? '-1 -1 -1' : ans[0].join(' ')


Measured memory_bytes: 1788
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;



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

	int num = 0;

	for (int i = 0; i < 4; i++) {
		if (s[i] == '+')num++;
		else num--;
	}

	cout << num << endl;

	return 0;
}

Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

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

        if (K*500<X)
            System.out.println("No");
        else
            System.out.println("Yes");
    }
}


Measured memory_bytes: 19796
import java.util.Scanner;

class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int TOP_LEN = Integer.parseInt(scanner.next());
    int BOTTOM_LEN = Integer.parseInt(scanner.next());
    int HEIGHT = Integer.parseInt(scanner.next());
    scanner.close();

    System.out.println((TOP_LEN+BOTTOM_LEN)*HEIGHT/2);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mn = 2005;
int a[mn], c[mn], m;
inline void update(int p) {while(p <= m) ++c[p], p += p & -p;}
inline int getsum(int p)
{
    int ret = 0;
    while(p)
        ret += c[p], p -= p & -p;
    return ret;
}
int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n), m = a[n] + a[n - 1];
    ll ans = 0;
    for(int i = n; i; i--)
    {
        for(int j = 1; j < i; j++)
            ans += 1ll * getsum(a[i] + a[j] - 1);
        update(a[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val s = scanner.next()
    if (s.length % 2 != 0) {
        println("No")
    } else {
        val c = s.toCharArray()
        val h = s.length / 2
        for (i in 0..h-1) {
            if (c[i] != c[i+h]) {
                println("No")
                return
            }
        }
        println("Yes")
    }
}

Measured memory_bytes: 29596
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

string str[3];
bool isTwo;

void solve() {
  int ten = 0;
  string newS = "";
  if(str[0].length() == 1) {
    ten = 0;
    newS = str[0];
  } else if(str[0][0] == '0' && str[0][1] == '.') {
    for(int i = 2; i < str[0].length(); ++i) {
      if(str[0][i] != '0') {
	ten -= i-1;
	string tmp  = str[0].substr(i);
	newS = tmp.substr(0, 1);
	if(tmp.length() > 1) newS += "." + tmp.substr(1);
	break;
      }
    }
  } else {
    bool flag = false;
    for(int i = 1; i < str[0].length(); ++i) {
      if(str[0][i] == '.') {
	ten += i-1;
	string tmp  = str[0].substr(0, i) + str[0].substr(i+1);
	newS = tmp.substr(0, 1);
	newS += '.';
	newS += tmp.substr(1);
	flag = true;
	break;
      }
    }
    if(!flag) {
      ten += str[0].length() - 1;
      newS = str[0].substr(0, 1) + "." + str[0].substr(1);
    }
  }
  if(!isTwo) {
    if(str[1] == "yotta") ten += 24;
    else if(str[1] == "zetta") ten += 21;
    else if(str[1] == "exa") ten += 18;
    else if(str[1] == "peta") ten += 15;
    else if(str[1] == "tera") ten += 12;
    else if(str[1] == "giga") ten += 9;
    else if(str[1] == "mega") ten += 6;
    else if(str[1] == "kilo") ten += 3;
    else if(str[1] == "hecto") ten += 2;
    else if(str[1] == "deca") ten += 1;
    else if(str[1] == "deci") ten += -1;
    else if(str[1] == "centi") ten += -2;
    else if(str[1] == "milli") ten += -3;
    else if(str[1] == "micro") ten += -6;
    else if(str[1] == "nano") ten += -9;
    else if(str[1] == "pico") ten += -12;
    else if(str[1] == "femto") ten += -15;
    else if(str[1] == "ato") ten += -18;
    else if(str[1] == "zepto") ten += -21;
    else if(str[1] == "yocto") ten += -24;
    cout << newS << " * 10^" << ten << " " << str[2] << endl;
  } else {
    cout << newS << " * 10^" << ten << " " << str[1] << endl;
  }
}

main() {
  int n;
  cin >> n;
  getchar();
  for(int t = 0; t < n; ++t) {
    string s;
    stringstream ss;
    isTwo = false;
    getline(cin, s);
    ss << s;
    for(int i = 0; i < 3; ++i) {
      if(!(ss >> str[i])) {
	isTwo = true;
      }
    }
    //cout << str[0] << " " << str[1] << " " << str[2] << endl;
    solve();
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue> 
#include<cstring>
#include<ctime>

using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0)
#define ll long long
#define ull unsigned ll
#define pb push_back

#define endl '\n'
#define mod 1000000007

#define FOR(i,k,n) for(int i=k; i<n; i++)
#define ROF(i,k,n) for(int i=k; i>=n; i--)
#define MEMSET(t) memset(t,0,sizeof(t));
#define time clock_t tStart 
#define Start clock()
#define Time printf("Time taken: %.3fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC)

int dp[1000001][3];

int maxH(int ar[][3], int n,int act)
{
    if(n==0) return 0;
  
    if(dp[n][act]!=-1) 
        return dp[n][act];
  if(act==1)  
    dp[n][act]= max( ar[n-1][1]+maxH(ar,n-1,2),ar[n-1][2]+maxH(ar,n-1,3));
  
  if(act==2)  
    dp[n][act]= max( ar[n-1][0]+maxH(ar,n-1,1),ar[n-1][2]+maxH(ar,n-1,3)); 
  
  if(act==3)  
    dp[n][act]= max( ar[n-1][0]+maxH(ar,n-1,1),ar[n-1][1]+maxH(ar,n-1,2));
    
    

    return dp[n][act]; 

}

int main()
{
    fastio;
    int t=1; //cin>>t;
    while(t--)
    {
        int n; cin>>n;
        int ar[n][3];
        for(int i=0;i<n; i++)
        {
            cin>>ar[i][0]>>ar[i][1]>>ar[i][2]; 
        }
        memset(dp,-1,sizeof(dp)); 
        cout<<max( maxH(ar,n,1), max( maxH(ar,n,2), maxH(ar,n,3))) <<endl;


    }
    return 0;
}


Measured memory_bytes: 22788
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

int connected(int a, int b, vector<int> &v){ 
	if(a > b) swap(a,b);
	for(int i = a + 1; i < b; ++i) {
		if(v[i]) return 0;
	}
	return 1;
}
int count(int x, int n) {
	vector<int> a(n);
	for(int i = 0; i < n; ++i) a[i] = i;
	int res = 0;
	do{
		vector<int> v(n);
		for(int i = 0; i < n; ++i) {
			res += connected(x, a[i], v);
			v[a[i]] = 1;
			if(a[i] == x) break;
		}
	}while(next_permutation(ALL(a)));
	return res;
}
const int MOD = (int)1e9 + 7;
int fact(int n) {
	int res = 1;
	for(int i = 1; i <= n; ++i){
		res *= i;
		res %= MOD;
	}
	return res;
}
int modpow(int n, int k) {
	int res = 1;
	while(k > 0) {
		if(k & 1) {
			res = (res * n) % MOD;
		}
		k >>= 1;
		n = (n * n) % MOD;
	}
	return res;
}
int invmod(int n) {
	return modpow(n, MOD - 2);
}

signed main(){
	int N;
	cin >> N;
	vector<int> A(N), b(N + 1);
	for(int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	b[0] = 0;
	for(int i = 1; i <= N; ++i) {
		b[i] = (b[i-1] + invmod(i + 1)) % MOD;
	}
	int f = fact(N);
	int sum = 0;
	for(int i = 0; i < N; ++i) {
		int t = ((b[i] + b[N-i-1] + 1) % MOD * f) % MOD;
		sum += (t * A[i]) % MOD;
		sum %= MOD;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <queue>

using namespace std;
struct point
{
    char s[12];
    long long x;
}a[1000005];

void check(long long n,long long k)
{
    queue <point> q;
    queue <point> t;
    point f;
    long long sum = 0;
    for(int i = 0; i < n; i++)
        q.push(a[i]);
    while(!q.empty())
    {
        f = q.front();
        if(f.x > k)
        {
            f.x -= k;
            sum += k;
            q.push(f);
        }
        else
        {
            sum += f.x;
            f.x = sum;
            t.push(f);
        }
        q.pop();
    }
    for(int i = 0; i < n; i++)
    {
        f = t.front();
        printf("%s %lld\n",f.s,f.x);
        t.pop();
    }
}

int main()
{
    long long n,k;
    while(scanf("%lld%lld",&n,&k) != EOF)
    {
        for(long long i = 0; i < n; i++)
            scanf("%s%lld",a[i].s,&a[i].x);
        check(n,k);
    }
    return 0;
}



Measured memory_bytes: 4856
N,M=map(int,input().split())
AB=[]
for i in range(N):
    ab=list(map(int,input().split()))
    AB.append(ab)
AB=sorted(AB)
K=M
c=-1
while K>0:
    K-=AB[c+1][1]
    c+=1
S=[(AB[c][1]+K)*AB[c][0]]
for k in range(c):
    S.append(AB[k][0]*AB[k][1])
print(sum(S))

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

int main(){
    int n,k,d,a,s=0;
    vector<int> b(200);
    cin >> n >> k;
    for(int i=0; i<k; i++){
        cin >> d;
        for(int j=0; j<d; j++){
            cin >> a;
            b.at(a)=1;
        }
    }
    for(int i=0; i<200; i++){
        s+=b.at(i);
    }
    cout << n-s << endl;
    
}

Measured memory_bytes: 3604