akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int X;
    cin >> X;
    int g = gcd(X, 360);
    int ans = 360/g;
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define vvi vector<vi>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define tc(i) int test_casesq; cin >> test_casesq; f(i, test_casesq)
#define ync(x, a, b) cout << (x?a:b) << '\n';
#define yn(x) ync(x, "YES", "NO");
#ifndef ONLINE_JUDGE
#define DBG(v) cerr << #v << " = " << (v) << endl;
#else
#define DBG(v) ;
#endif
template <typename T> std::ostream& operator<<(std::ostream &os, std::vector<T> v){os << "["; f(i, sz(v)) os << v[i] << " "; return os << "]";}

using namespace std;

ll INF = (1ll<<61);

ll func(ll i, ll j, ll k){
	return i*i+j*j+k*k + j *k + i *k + j * i;
}

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    vi v(1e6);
    fo(i, 1,105){
    	fo(j, 1,105){
    		fo(k,1, 105){
    			ll y = func(i, j, k);
    			if(y < 1e5)
    			v[y]++;
    		}
    	}
    }
    int n; cin >> n;
    fo(i, 1, n+1){
    	cout << v[i] << "\n";
    }
    return 0;
}







// END


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n,i;
    cin>>n;
    ll a[n+1],ans=1,c=0; a[n]=INT_MAX;
    for(i=1;i<=n;i++) cin>>a[i];
    a[0]=-INT_MAX;
    for(i=1;i<=n;i++){
        if(a[i]<=a[i-1]) c++;
        else {ans=max(ans,c); c=1;}
    }
    ans=max(ans,c);
    cout<<ans-1 el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 4404
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BOddString solver = new BOddString();
        solver.solve(1, in, out);
        out.close();
    }

    static class BOddString {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            char[] s = in.string().toCharArray();
            for (int i = 0; i < s.length; i += 2) {
                out.print(s[i]);
            }
            out.println();
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 22996
#import bisect

N,H = map(int, input().split())
AB = []
A  = []
B  = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
    AB.append((a,b))

A_max = max(A)
B = sorted(B)
B = B[::-1]

#B_ind = bisect.bisect_left(B,A_max,0,N)
#print(B_ind,B[B_ind:])

ans = 0
for b in B:
    if b <= A_max or H <= 0:
        break
    ans += 1

    H -= b

if H > 0:
    ans += H//A_max + min(1,H%A_max)

print(ans)

# if sumB >= H:
#     cnt = 0
#     while H > 0:
#         cnt += 1
#         b = B[N - cnt]
#         H -= b

#     ans = cnt
# else:
#     H -= sumB
#     ans = N - B_ind

#     ans += H//A_max + min(1,H%A_max)

# print(ans)


Measured memory_bytes: 19180
import java.util.Scanner;

public class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] values = new int[w];
    for(int i = 0; i < values.length; i++)
    {
      values[i] = i + 1;
    }
    for(int i = 0; i < n; i++)
    {
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0]) - 1; 
      int b = Integer.parseInt(ab[1]) - 1;
      int t = values[a];
      values[a] = values[b];
      values[b] = t;
    }
    for(int i = 0; i < w; i++)
    {
      System.out.println(values[i]);
    }
  }
}

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

int main() {
  
  double a,b; 
  cin >> a >> b;
  
  double m;
  m = (a+b)/2;
    
  double n;
  n = m + 0.9;
  
  int x;
  x = n;
    
  cout << x << endl;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char C;
    cin >> C ;
    if (C=='a'||C=='i'||C=='u'||C=='e'||C=='o'){
        cout<< "vowel"<< endl;}
        else {cout<< "consonant" <<endl;}
    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    fun gcd(a: Long, b: Long): Long {
        return if (b > 0) gcd(b, a % b) else a
    }
    val (a, b) = readLine()!!.split(' ').map(String::toLong)
    println(a * b / gcd(a, b))
}

Measured memory_bytes: 38080
#include <stdio.h>
int main(){
 char s[10];
 scanf("%s",s);
 if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
  printf("Yes");
 }
 else{
  printf("No");
 }
 return 0;
} 

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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;


double arr[3005];
double dp[3005][3005];
int n;

double kil(int idx, int heads)
{
  if(idx == n)
  {
    if(heads > n - heads)
      return 1;
    return 0;
  }

  if(dp[idx][heads] != -1)
    return dp[idx][heads];

  dp[idx][heads] = 0;
  dp[idx][heads] += arr[idx] * kil(idx+1, heads+1);
  dp[idx][heads] += (1-arr[idx]) * kil(idx+1, heads);

  return dp[idx][heads];
}

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

  cin>>n;
  for(int i=0;i<n;i++)
    cin>>arr[i];

  for(int i=0;i<=n;i++)
      for(int j=0;j<=n;j++)
        dp[i][j] = -1;

  cout<<setprecision(10);
  cout<<kil(0, 0)<<endl;

  return 0;
}


Measured memory_bytes: 70912
from collections import deque

h,w = map(int,input().split())
matrix = [["a" for _ in range(w+2)]] + [list("a" + input() + "a") for _ in range(h)] + [["a" for _ in range(w+2)]]

matrix_list1 = deque()
cnt = 0

for i in range(1,h+1):
    for j in range(1,w+1):
        if matrix[i][j] == "#":
            matrix_list1.append([i,j])

while len(matrix_list1) != 0:     
    for _ in range(len(matrix_list1)):
        x,y = matrix_list1.popleft()
        if matrix[x+1][y] == ".":
            matrix[x+1][y] = "#"
            matrix_list1.append([x+1,y])
        if matrix[x-1][y] == ".":
            matrix[x-1][y] = "#"
            matrix_list1.append([x-1,y])
        if matrix[x][y+1] == ".":
            matrix[x][y+1] = "#"
            matrix_list1.append([x,y+1])
        if matrix[x][y-1] == ".":
            matrix[x][y-1] = "#"
            matrix_list1.append([x,y-1])
    else:
        if len(matrix_list1) > 0:
            cnt += 1
    
print(cnt)

Measured memory_bytes: 168796
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> p;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;
struct edge {
  int to, id;
};
vector<vector<edge>> graph;
vector<int> ans;

void dfs(int vertex, int pre=-1, int c=-1) {
  int nc = 1;
  for (auto v : graph[vertex]) {
    if(v.to == pre) continue;
    if(c == nc) ++nc;
    ans[v.id] = nc;
    dfs(v.to, vertex, nc);
    nc++;
  }
}

int main(){
  int n;
  cin >> n;
  graph.resize(n);
  ans.resize(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    graph[a].push_back((edge){b, i});
    graph[b].push_back((edge){a, i});
  }
  dfs(0);
  int maxv = 0;
  rep(i, n - 1) maxv = max(maxv, ans[i]);
  cout << maxv << endl;
  rep(i, n - 1) {
    cout << ans[i] << endl;
  }

}

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N - 1; i++) {
        B.at(i) = A.at(i + 1) - A.at(i);
    }
    B.at(N - 1) = (K - A.at(N - 1) + A.at(0));

    int sum = 0, biggest = 0, biggest_keep;
    for (int i = 0; i < N; i++) {
        biggest_keep = B.at(i);
        sum += B.at(i);
        biggest = max(biggest, biggest_keep);
    }

    cout << sum - biggest << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
   
int main() {
    long long x;
    cin>>x;
    long long m=100;
    for(long long i=1;i<10000000;i++){
        m*=1.01;
        if(x<=m){
            cout<<i;
            break;
        }
    }
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
using namespace std;
int main() {
	string S;
	cin >> S;
	if (S.find("a") != std::string::npos&&S.find("b") != std::string::npos) {
		if (S.find("c") != std::string::npos) {
			std::cout << "Yes";
		}
		else {
			cout << "No";
		}

	}

	else {
		cout << "No";
	}
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d",$n);

$arr=array();

for($i=1;$i<=$n;++$i){
	fscanf(STDIN,"%d",$s);
	$arr[$i-1]=$s;
	$s_arr[$i-1]=$s;
}

sort($s_arr);
$max=$s_arr[$n-1];
$sec=$s_arr[$n-2];

for($i=0;$i<$n;++$i){
	if($arr[$i]==$max && $arr[$i]>$sec){
		echo $sec."\r\n";
	}elseif($arr[$i]==$max && $arr[$i]==$sec){
		echo $max."\r\n";
	}else{
		echo $max."\r\n";
	}
}

/*
for($i=0;$i<$n;++$i){
	$split=array();
	$split=$arr;
	unset($split[$i]);
	print max($split)."\r\n";
}
*/
?>

Measured memory_bytes: 24556
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

const int MAX_HW = 310;
const int INF = 1000000000;
char cake[MAX_HW][MAX_HW];
int H, W, K;
int col = 1;

int mp[MAX_HW][MAX_HW];


void print_mp(int x1, int y1, int x2, int y2) {
    for(int i = x1; i <= x2; ++i) for(int j = y1; j <= y2; ++j) mp[i][j] = col;
    ++col;
}

void section_cut(int x1, int y1, int x2, int y2, int num){
    if(num == 1) { print_mp(x1,y1,x2,y2); return ;}
    if(num <= 0 || x1 > x2 || y1 > y2) { return ;}

    int x_num[x2-x1+1];
    for(int i = 0; i <= x2 - x1; ++i) x_num[i] = 0;
    for(int i = x1; i <= x2; ++i) 
        for(int j = y1; j <= y2; ++j) if(cake[i][j] == '#') ++x_num[i-x1];
    
    for(int i = 1; i <= x2 - x1; ++i) x_num[i] += x_num[i-1];
    for(int i = 0; i < x2 - x1; ++i) if(x_num[i] > 0 && x_num[i] < num) {
        //printf("slice (%d, %d)--(%d, %d) (%d) and (%d, %d)--(%d, %d) (%d)\n", x1, y1, x1+i, y2, x_num[i],
        //                                                            x1+i+1,y1,x2,y2, num - x_num[i]);
        section_cut(x1, y1, x1 + i, y2, x_num[i]);
        section_cut(x1 + i + 1, y1, x2, y2, num - x_num[i]);
        return ;
    }

    int y_num[y2-y1+1];
    for(int i = 0; i <= y2 - y1; ++i) y_num[i] = 0;
    for(int j = y1; j <= y2; ++j) 
        for(int i = x1; i <= x2; ++i) if(cake[i][j] == '#') ++y_num[j - y1];
    
    for(int i = 1; i <= y2 - y1; ++i) y_num[i] += y_num[i-1];
    for(int i = 0; i < y2 - y1; ++i) if(y_num[i] > 0 && y_num[i] < num) {
        //printf("slice (%d, %d)--(%d, %d) (%d)and (%d, %d)--(%d, %d) (%d)\n", x1, y1, x2, y1+i, y_num[i],
        //                                                            x1, y1+i+1,x2,y2, num - y_num[i]);
        section_cut(x1, y1, x2, y1 + i, y_num[i]);
        section_cut(x1, y1 + i + 1, x2, y2, num - y_num[i]);
        return ;
    }
}

int main()
{
    scanf("%d %d %d", &H, &W, &K);
    for(int i = 0; i< H; ++i) scanf("%s", cake[i]);

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

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

int maze_master(int h, int w, vector<vector<char>> s) {
  int inf = 100000;
  int all_nums = h * w;
  int dp[all_nums][all_nums];
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      for(int k=0;k<all_nums;k++) {
	dp[i*w + j][k] = inf;
      }
      if(s[i][j] == '#') {
	continue;
      }
      dp[i*w + j][i*w + j] = 0;
      if(i != 0 && s[i-1][j] == '.') {
	dp[i*w + j][(i-1)*w + j] = 1;
      }
      if(i != h-1 && s[i+1][j] == '.') {
	dp[i*w + j][(i+1)*w + j] = 1;
      }
      if(j != 0 && s[i][j-1] == '.') {
	dp[i*w + j][i*w + (j-1)] = 1;
      }
      if(j != w-1 && s[i][j+1] == '.') {
	dp[i*w + j][i*w + (j+1)] = 1;
      }
    }
  }

  for(int k=0;k<all_nums;k++) {
    for(int i=0;i<all_nums;i++) {
      for(int j=0;j<all_nums;j++) {
	dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
      }
    }
  }
  int ans = 0;
  for(int i=0;i<all_nums;i++) {
    for(int j=0;j<all_nums;j++) {
      if(dp[i][j] >= inf) {
	continue;
      }
      ans = max(dp[i][j], ans);
    }
  }
  return ans;
}

int main() {
  int h;
  int w;
  vector<vector<char>> s;
  cin >> h;
  cin >> w;
  for(int i=0;i<h;i++) {
    vector<char> ss;
    string row;
    cin >> row;
    for(int j=0;j<w;j++) {
      ss.push_back(row[j]);
    }
    s.push_back(ss);
  }
  cout << maze_master(h, w, s);

}

Measured memory_bytes: 896
#include<stdio.h>


int main(){
  int a[1000];
  int i,j,v,n,k;
  
  scanf("%d",&n);
  
  if(n>=1&&n<=100){
    
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
    }
    for(k=0;k<n;k++){
      printf("%d",a[k]);
      if(k<n-1)printf(" ");
    }
    printf("\n");
    
    for(i=1;i<=n-1;i++){
      v=a[i];
      j=i-1;
      
      while(j>=0&&a[j]>v){
	a[j+1]=a[j];
	j--;
	a[j+1]=v;
      }
      
      for(k=0;k<n;k++){
	printf("%d",a[k]);
	if(k<n-1)printf(" ");
      }
      printf("\n");
      
    }
  }
}



Measured memory_bytes: 2628
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line
            .split_whitespace()
            .map(String::from)
            .collect();
        self.index = 0;
    }
}

fn product(nums: &Vec<i64>, the_mod: i64) -> i64 {
    let mut prod = 1;
    for &num in nums.iter() {
        prod *= num;
        while prod < 0 {
            prod += the_mod;
        }
        while prod > the_mod {
            prod -= the_mod;
        }
    }
    prod
}

fn solve(vec: &mut Vec<i64>, k: usize) -> i64 {
    const MOD: i64 = 1e9 as i64 + 7;
    if k == vec.len() {
        return product(&vec, MOD);
    }

    let mut pos = vec![];
    let mut neg = vec![];

    for &num in vec.iter() {
        if num >= 0 {
            pos.push(num);
        } else {
            neg.push(num);
        }
    }

    pos.sort();
    pos.reverse();
    neg.sort();

    if neg.len() == vec.len() {
        if k % 2 == 1 {
            neg.reverse();
        }
        return product(&neg[0..k].to_vec(), MOD);
    }

    let mut i = std::cmp::min(k, pos.len());
    let mut j = k - i;

    if j % 2 == 1 && j < neg.len() && i > 0 {
        i -= 1;
        j += 1;
    }

    while i > 1 && j + 1 < neg.len() {
        let p = pos[i - 1] * pos[i - 2];
        let n = neg[j] * neg[j + 1];
        if p >= n {
            break;
        }

        i -= 2;
        j += 2;
    }

    let mut res = pos[0..i].to_vec();
    res.append(&mut neg[0..j].to_vec());
    product(&res, MOD)
}

fn main() {
    let mut reader = TokenReader::new();
    let _ = reader.next::<usize>();
    let k = reader.next::<usize>();
    let mut vec = reader.vector::<i64>();

    let res = solve(&mut vec, k);
    println!("{}", res);
}


Measured memory_bytes: 20128
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();
    String S = sc.next();
    if (S.length() != A + B + 1 || S.charAt(A) != '-') {
      System.out.println("No");
      return;
    }
    for (int i = 0; i < A; i++) {
      char c = S.charAt(i);
      if (c < '0' || '9' < c) {
        System.out.println("No");
        return;
      }
    }
    for (int i = A+1; i < A+1+B; i++) {
      char c = S.charAt(i);
      if (c < '0' || '9' < c) {
        System.out.println("No");
        return;
      }
    }
    
    System.out.println("Yes");
  }
}

Measured memory_bytes: 22740
a,i,v[];main(b,c,n){for(scanf("%d",&n);~scanf("%d%d%d%d",&a,&b,&c,v);)c-*v?v[c>*v?a:b]+=3:++v[a]-++v[b];for(;a=b=i++<n;printf("%d\n",b))for(;a<=n;)b+=v[i]<v[a++];}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <cmath>
#include <tuple>
#include <queue>
#include <set>
#include <iomanip>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

double dp[3010][3010] = {0};

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

    int N;
    cin >> N;

    vector<double> p(N);

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

    dp[0][0] = 1.0;

    for(int i = 0; i < N; i++){
        for(int j = 0; j <= i+1; j++){
            if(j > 0){
                dp[i+1][j] = (1-p[i]) * dp[i][j] + p[i] * dp[i][j-1];
            }else{
                dp[i+1][j] = (1-p[i]) * dp[i][j];
            }
        }
    }

    double ans;
    for(int i = (N+1)/2; i <= N; i++){
        ans += dp[N][i];
    }

    cout << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 69120
N = gets.to_i
A,B = gets.split.map(&:to_i)
P = gets.split.map(&:to_i)

array1 = Array.new
array2 = Array.new
array3 = Array.new

for i in 0..(N-1)
 if P[i] <= A
  array1.push(P[i])
 elsif A < P[i] && P[i] <= B
  array2.push(P[i])
 elsif B < P[i]
  array3.push(P[i])
 end
end

x = array1.length
y = array2.length
z = array3.length

array4 = Array.new
array4[0] = x
array4[1] = y
array4[2] = z

min = 1000000000000000
for i in 0..2
 if min > array4[i]
  min = array4[i]
 end
end

puts(min)

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<unordered_map>
#include<string.h>
#include<math.h>
using namespace std;
using ll = long long;
int main(){
    string S;
    int N;
    cin >> N >> S;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < S.length();j++){
            if(S[j] == 'Z')S[j] = 'A';
            else S[j]++;
        }
    }
    cout << S;
}


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

const int MAX_N = 20;
int N;
vector<int> V(MAX_N), C(MAX_N);
void solve()
{
	int res = 0;
	for(int i = 0; i < N; i++){
		int diff = V.at(i) - C.at(i);
		if(0 < diff)
			res += diff;
	}
  	cout << res << endl;
}
int main()
{
	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> V.at(i);
	for(int i = 0; i < N; i++)
		cin >> C.at(i);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;

int main()
{
    int X,Y,a,b;
    cin >> X >> Y;
    if(Y%2!=0){
        cout << "No" <<endl;
        return 0;
    }
    a=2*X-Y/2;
    b=Y/2-X;
    if(a>=0&&b>=0){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int memo[100100] = {};
int dfs (int i, Graph &g) {
    if (memo[i] != -1) return memo[i];
    if (g[i].empty()) return 0;
    int sum = 0;
    for (auto j : g[i]) sum = max (sum, dfs (j, g) + 1);
    return memo[i] = sum;
}

int main() {
    int n, m;
    cin >> n >> m;
    int x, y;
    Graph g (n);
    rep (i, 0, m) {
        cin >> x >> y;
        g[--x].push_back (--y);
    }
    //メモ化再帰
    int ans = 0;
    rep (i, 0, n + 1) memo[i] = -1;
    rep (i, 0, n) {
        ans = max (ans, dfs (i, g));
        // cout << i << " " << memo[i] << "\n";
    }
    cout << ans << "\n";
}

Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.Linq;   
class Program
    {
        static void Main(string[] args)
        {
            var Array = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int N = Array[0];
            int X = Array[1];
            Array = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int Count = 1;
            int Sum = 0;
            for (int i = 0; i < Array.Count(); i++)
            {
                Sum += Array[i];
                if (Sum <= X)
                    Count++;
            }
            Console.WriteLine(Count);
        }
    }

Measured memory_bytes: 13396
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

use std::collections::HashMap;

fn main() {
    let n = input!(usize);
    // let mut a: Vec<i64> = Vec::with_capacity(n);
    let mut map: HashMap<i64, i64> = HashMap::new();
    for _ in 0..n {
        let a = input!(i64);
        if let Some(x) = map.get_mut(&a) {
            *x += 1;
            continue;
        }
        map.insert(a, 1);
    }

    let mut cnt = 0;
    for value in map.values() {
        if value % 2 != 0 {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}

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

int main() {
    string str;
    while (getline(cin, str)) {
        if (str == "END OF INPUT") break;
        int count = 0;
        for (int i = 0; i < str.size(); i++) {
            if (str[i] == ' ') {
                cout << count;
                count = 0;
            } else {
                count++;
            }
        }
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 3144
#include<cstdio>
#include<algorithm>
int main(){
	char s[2000]={};
	int w;
	scanf("%s%d",s,&w);
	for(int i=0;true;i+=w){
		if(s[i]!=0)printf("%c",s[i]);
		else break;
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 998244353
using namespace std;


int main(){
    int N;
    cin >> N;
    ll K;
    cin >> K;
    
    ll A[200000];
    ll F[200000];
    
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    for(int i=0; i<N; i++){
        cin >> F[i];
    }
    
    sort(A,A+N);
    sort(F,F+N);
    
    
    ll sum=0;
    for(int i=0; i<N; i++){
        sum+=A[i];
    }
    if(sum<=K){
        cout<<0<<endl;
        return 0;
    }
    
    
    
    ll left=0, right=10000000000000;
    while(left < right-1){
        ll x=(left+right)/2;
        
        ll num=0;
        for(int i=0; i<N; i++){
            if(A[i]*F[N-1-i] > x){
                num += (A[i]*F[N-1-i]-x +F[N-1-i]-1)/F[N-1-i];
            }
        }
        
        if(num <=K){
            right = x;
        }else{
            left = x;
        }
    }
    
    cout << right << endl;
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
main(){
    ll n,ans=0,i,j;
    cin>>n;
    for(i=2;i<=sqrt(n);i++){
        j=i;
        while(n%j==0) ans++,n/=j,j*=i;
        while(n%i==0) n/=i;
    }
    cout<<ans+(n>1);
}

Measured memory_bytes: 3660
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

a,b,c,k = map(int, input().split())

if k <= a:
    print(k)
elif k <= a+b:
    print(a)
else:
    cc = k - (a+b)
    print(a-cc)


Measured memory_bytes: 9168
n = int(input())
h_list = list(map(int,input().split()))
flag = True
for i in range(0,n-1):
    if h_list[i] > h_list[i+1]+1:
        flag = False
        break
    if h_list[i] == h_list[i+1]+1:
        h_list[i+1] += 1
        
if flag == True:
    print('Yes')
    
else:
    print('No')

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

int main(int argc, char const *argv[]) {
  int64_t N, L;
  int last_knot = -1;
  std::cin >> N >> L;
  std::vector<int64_t> rope(N);
  for (size_t i = 0; i < N; i++) {
    std::cin >> rope[i];
  }
  for (size_t i = 0; i < N-1; i++) {
    if (rope[i] + rope[i+1] >= L) {
      last_knot = i;
    }
  }
  if (last_knot == -1) {
    std::cout << "Impossible" << std::endl;
  } else {
    std::cout << "Possible" << std::endl;
    for (size_t i = 0; i < last_knot; i++) {
      std::cout << i+1 << std::endl;
    }
    for (size_t i = N-2; i > last_knot; i--) {
      std::cout << i+1 << std::endl;
    }
    std::cout << last_knot+1 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 1536
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = long.Parse(Console.ReadLine());
            var answer = 0L;
            foreach (var prime in PrimeFactors(n))
            {
                var e = 1;
                while (true)
                {
                    var tmp = (long)Math.Pow(prime, e++);
                    if (n % tmp == 0)
                    {
                        n /= tmp;
                        answer++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(answer);
        }

        public static IEnumerable<long> PrimeFactors(long n)
        {
            var primes = new List<long>();
            var tmp = n;
            var max = (long)Math.Sqrt(n);
            var p = 2;
            while (p <= max)
            {
                if (tmp % p == 0)
                {
                    primes.Add(p);
                    while (tmp % p == 0) tmp /= p;
                }
                p += (p == 2 ? 1 : 2);
            }
            if (tmp > 1) primes.Add(tmp);
            return primes;
        }
    }
}


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

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

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout << "Bad" << endl;
	else cout << "Good" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  int a;

  int val[11] = {};

  REP(i, 3) {
    cin >> a;
    ++val[a];
  }  
    
  if(val[5] == 2 && val[7] == 1) cout << "YES" << endl;
  else cout << "NO" << endl;

     
  return 0;
}


Measured memory_bytes: 256
def e_common_subsequence(N, M, S, T, MOD=10**9 + 7):
    # dp[i][j]: S[i], T[j] まで考慮したとき、この2つをペアにしたときの場合の数
    dp = [[0] * (M + 1) for _ in range(N + 1)]

    total = [[0] * (M + 1) for _ in range(N + 1)]
    for i in range(N + 1):
        total[i][0] = 1
    for j in range(M + 1):
        total[0][j] = 1

    ans = 1  # 空の列は常に等しい列である
    for i in range(N):
        for j in range(M):
            if S[i] == T[j]:
                dp[i + 1][j + 1] = (total[i][j] % MOD)
                ans += dp[i + 1][j + 1]
            total[i + 1][j + 1] = (total[i][j + 1] + total[i + 1][j]
                                   - total[i][j] + dp[i + 1][j + 1] + MOD) % MOD
    return ans % MOD

N, M = [int(i) for i in input().split()]
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
print(e_common_subsequence(N, M, S, T))

Measured memory_bytes: 104668
#
# abc147 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1
2 1
1
1 1
1
2 0"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
2
2 1
3 0
2
3 1
1 0
2
1 1
2 0"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """2
1
2 0
1
1 0"""
        output = """1"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    C = []
    for i in range(N):
        a = int(input())
        C.append([list(map(int, input().split())) for j in range(a)])

    ans = 0
    for bit in range(1 << N):
        f = True
        for i in range(N):
            if bit & (1 << i):
                for c in C[i]:
                    if bit & (1 << c[0]-1) != (1 << c[0]-1)*c[1]:
                        f = False
                        break
        if f == True:
            ans = max(ans, bin(bit).count("1"))
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16352
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

const int INF = 2000000001;


int main() {
  int N;
  cin >> N;
  int x[200000], y[200000];
  P a[200000];
  rep(i, N) {
    cin >> x[i] >> y[i];
    a[i].first = x[i];
    a[i].second = y[i];
  }

  sort(x, x + N);
  sort(y, y + N);

  int cnd1[200000];
  int mx = 0;
  int xt;
  int nt;
  int mn = INF;
  rep(i, N) {
    if(mx < abs(a[i].first - x[0]) + abs(a[i].second - y[0])) {
      mx = max(mx, abs(a[i].first - x[0]) + abs(a[i].second - y[0]));
      xt = i;
    }
    if(mn > abs(a[i].first - x[0]) + abs(a[i].second - y[0])) {
      mn = abs(a[i].first - x[0]) + abs(a[i].second - y[0]);
    }
  }

  int ans = mx - mn;

  mx = 0;
  mn = INF;
  rep(i, N) {
    if(mx < abs(a[i].first - x[N-1]) + abs(a[i].second - y[0])) {
      mx = max(mx, abs(a[i].first - x[N-1]) + abs(a[i].second - y[0]));
      xt = i;
    }
    if(mn > abs(a[i].first - x[N-1]) + abs(a[i].second - y[0])) {
      mn = abs(a[i].first - x[N-1]) + abs(a[i].second - y[0]);
    }
  }

  ans = max(ans, mx - mn);

  cout << ans << endl;

  return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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


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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  map<int, int> mp;

  rep(i, n){
    mp[a[i]]++;
  }

  int ans = 0;
  rep(i, n){

    int num = a[i];

    if(num == 1){
      if(mp[num] >= 2){
        ans++;
      }
    }else{
      bool ok = false;

      if(mp[1] >= 1){
        ans++;
        continue;
      }

      for(int j = 2; j*j <= num; j++){

        if(num % j == 0){
          if(mp[j] >= 1){
            ans++;
            ok = true;
            break;
          }
          if(mp[num/j] >= 1){
            ans++;
            ok = true;
            break;
          }
        }
      }
      if(!ok){
        if(mp[num] >= 2){
          ans++;
        }
      }
    }
  }

  cout << n - ans << endl;



  return 0;
}


Measured memory_bytes: 32932
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

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

Measured memory_bytes: 256
def dist(a,b,c,d):
    return abs(a-c)+abs(b-d)

N,M=map(int,raw_input().split())
ns=[]
for i in xrange(N):
    a,b=map(int,raw_input().split())
    ns.append((a,b))
ms=[]
for i in xrange(M):
    c,d=map(int,raw_input().split())
    ms.append((c,d))

for a,b in ns:
    mini=None
    idx=None
    cnt=1
    for c,d in ms:
        
        di = dist(a,b,c,d)
        if di < mini or mini==None:
            idx=cnt
            mini=di
        cnt+=1
    print idx


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

int main(void){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b){
		if(b==c){
			printf("No");
		}else{
			printf("Yes");
		}
	}else if(a==c){
		printf("Yes");
	}else if(b==c){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n, m, q; cin >> n >> m >> q;
    vector<vector<int>> S(n, vector<int>(n));
    rep(i, m){
        int l, r; cin >> l >> r; l--, r--;
        S[l][r]++;
    }
    rep(i, n){
        rep(j, n-1){
            S[i][j+1] += S[i][j];
        }
    }
    rep(j, n){
        for(int i=n-1; i>0; i--){
            S[i-1][j] += S[i][j];
        }
    }

    vector<int> res(q);
    rep(i, q){
        int p, q; cin >> p >> q; p--, q--;
        res[i] = S[p][q]; 
    }
    for(auto r: res) cout << r << ln;
}


Measured memory_bytes: 4572
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,t,a,b,n,c,d,y,x,temp,m,r,sum,count,l,k,s,ans,rr,prev;
    t=1;
    // cin>>t;
    while(t--)
    {
        string s1,s2;
        cin>>a>>b>>c>>k;
        if(k>=(a+b))
        {
            cout<<a+(k-(a+b))*(-1);
        }
        else cout<<min(a,k);
    }
}

Measured memory_bytes: 3624
#include<iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {

	int N, a[100], min = 200,max = -100,sum=0;
	long long int ans = 1000000000000000000;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (min > a[i])
			min = a[i];
		if (max < a[i])
			max = a[i];
	}

	for (int i = min; i <= max; i++) {
		for (int j = 0; j < N; j++) {
			sum += (a[j] - i)*(a[j] - i);
		}
		if (ans > sum)
			ans = sum;
		sum = 0;
	}

	cout << ans << endl;

	return 0;

}

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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

ll n, m, ans = 0;
priority_queue<ll>q;

int main(int argc, char const *argv[])
{
    // file();

    cin>>n>>m;
    for (int i = 0; i < n; ++i)
    {
        int x; cin>>x;
        q.push(x);
    }
    while(m-- and !q.empty())
    {
        ll cur = q.top();
        q.pop();
        q.push(cur>>1);
    }
    while(!q.empty())ans+=q.top(), q.pop();
    cout<<ans;

}

Measured memory_bytes: 1400
n = int(input())

def prime():
    p = [2]
    m = 3
    while m < 1400:
        for i in p:
            if m % i == 0:
                break
        else:
            p.append(m)
        m += 2
    return p

ans = []
p = prime()
q = p[1:]

while len(ans) < n:
    for i, q_ in enumerate(q):
        if q_ % 5 == 1:
            ans.append(q_)
            del q[i]
            break

print(' '.join([str(s) for s in ans]))

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

bool dp[200000];

int main() {
	int x; cin >> x;
	dp[0] = true;
	for (int i = 0; i < 6; ++i) {
		for (int j = 0; j <= x; ++j) {
			dp[j + 100 + i] |= dp[j];
		}
	}
	cout << (dp[x] ? 1 : 0) << endl;

	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(void){
  char s[256];
  
  scanf("%s",s);
  
  for(int i=0;i<strlen(s);i++){
    if(i%2==0 && s[i]=='L'){
      printf("No\n");
      return 0;
    }else if(i%2==1 && s[i]=='R'){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  
  return 0;
}

Measured memory_bytes: 128
def resolve():
    N, T = map(int, input().split())
    cost = float('inf')
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            cost = min(c, cost)
    if cost == float('inf'):
        print('TLE')
    else:
        print(cost)

resolve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void yn(bool j){cout << (j ? "Yes" : "No") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> long long bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> void sortTwoVecter(vector<T1> &f, vector<T2> &s, bool isReverse = false){
    vector<pair<T1, T2>> p;
    rep(i, f.size()) p.emplace_back(make_pair(f[i], s[i]));
    if (!isReverse) sort(p.begin(), p.end());
    else sort(p.rbegin(), p.rend());
    rep(i, f.size()) tie(f[i], s[i]) = p[i];
    return;
}

int main(){
    ll N; cin >> N;
    vector<ll> a(N - 1), b(N, 0);
    rep(i, N - 1) cin >> a[i];
    rep(i, N - 1) b[a[i] - 1]++;
    rep(i, N){
        pt(b[i]);
    }

}

Measured memory_bytes: 6376
def f_c():
    n, k = map(int, input().split())
    a = 0
    for i in range(1, n+1):
        c, v = 0, i
        while True:
            if v>=k:
                break
            c, v = c+1, v*2
        a += (1/n)*(1/2)**c
    print(a)

if __name__ == "__main__":
    f_c()


Measured memory_bytes: 2940