akhauriyash/Code-Regression huggingface dataset:
<?php

fscanf(STDIN, "%d %d", $n, $m);
$A = [];
for ($i = 0; $i < $m; ++$i) {
    fscanf(STDIN, "%d", $a);
    $A[] = $a;
}

const MOD = 1000000007;
// フィボナッチ数列
$F = [];
function fibo($n) {
    if ($n <= 1) {
        return 1;
    }
    global $F;

    // メモ化
    if (isset($F[$n])) {
        return $F[$n];
    }
    return (fibo($n - 1) + fibo($n - 2)) % MOD;
}
for ($i = 0; $i < 100005; ++$i) {
    $F[$i] = fibo($i);
}

switch ($m) {
case 0:
    echo $F[$n] % MOD;
    break;
case 1:
    echo $F[$n - ($A[0] + 1)] * $F[($A[0] - 1) - 0] % MOD;
    break;
default:
    $flg = true;

    $sum = $F[($A[0] - 1) - 0] % MOD;
    for ($i = 0; $i < $m - 1; ++$i) {
        if ($A[$i + 1] - $A[$i] <= 1) {
            $flg = false;
            break;
        }

        $sum = $sum * $F[$A[$i + 1] - 1 - ($A[$i] + 1)] % MOD;
    }
    $sum = $sum * $F[$n - ($A[$m - 1] + 1)] % MOD;

    if ($flg) {
        echo $sum;
    } else {
        echo 0;
    }
}


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

long long int p,q;

long long int gcd(long long int a, long long int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    if (a == b) 
        return a; 
    
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
}

 long long int lcm(long long int a, long long int b)  
 {  
    return (a*b)/gcd(a, b);  
 }

int main()
{
  cin >> p >> q;
  cout << lcm(p,q) << endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer)
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
#[allow(dead_code)]
fn main() {
    input!{
        n: usize,
        abc: [[u64; 3]; n],
    }
    let mut dp = vec![vec![0; 3]; n];
    for i in 0..3 {
        dp[0][i] = abc[0][i];
    }
    for i in 1..n {
        //debug!(dp);
        for j in 0..3 {
            let mut add = 0;
            for k in 0..3 {
                if k == j {
                    continue;
                }
                add = max(add, dp[i-1][k]);
            }
            //debug!(add);
            dp[i][j] = abc[i][j] + add;
        }
    }
    let ans = dp[n-1].iter().max().unwrap();
    println!("{}", ans);
}

Measured memory_bytes: 18684
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >>n;
ll a[n],b[n];
ll maxa=0;
ll maxb=0;
for(ll i=0;i<n;i++){
cin >>a[i];
maxa+=a[i];
}
for(ll i=0;i<n;i++){
cin >>b[i];
maxb+=b[i];
}
if(maxa>maxb){
cout<<"No";
}
else{
ll c[n];
for(ll i=0;i<n;i++){
c[i]=a[i]-b[i];
}
sort(c,c+n);
ll maxc=0;
ll count=0;
for(ll i=0;i<n;i++){
if(c[i]>0){
maxc+=c[i];
}
else if(c[i]<0){
ll memo=c[i]/2;
memo =abs(memo);
count+=memo;
}
}
if(count<maxc)
cout<<"No";
else
cout<<"Yes";

}
return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	static int co=0;
	static int K;
	static boolean ok = false;
	static long ans = 0;
	
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			 K= scan.nextInt();
			
			int count=0;
			int keta = 0;
		
			
			while(true) {
				keta++;
				
				for(int i = 1;i<=9;i++) {
					po(i,keta,""+i+"");
				}
			}
			
			
			
			
		}
		
		
	}
	
	
	private static void po(int n,int count,String s) {
		
		if(count==1) {
			co++;
			//System.out.print(s);
			//System.out.print(" ");
			//System.out.println(co);
			if(K==co) {
				ans = Long.valueOf(s);
				ok=true;
				System.out.println(ans);
				System.exit(0);
			}
			
		}else {
			if(n==0) {
				po(n,count-1,s+""+n+"");
				po(n+1,count-1,s+""+(n+1)+"");
			}else if(n==9) {
				po(n-1,count-1,s+""+(n-1)+"");
				po(n,count-1,s+""+n+"");
				
			}else{
				po(n-1,count-1,s+""+(n-1)+"");
				po(n,count-1,s+""+n+"");
				po(n+1,count-1,s+""+(n+1)+"");
			}
		}
		
		
	}
		

}


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

using namespace std;

int n;

void solve()
{
    vector<string> map(n);
    vector<vector<int> > dp(n + 1, vector<int>(n + 1, 0));
    int ans = 0;

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

    for (int i = 0; i < n; i++)
        if (map[i][0] == '.')
            dp[i][0] = 1;
    for (int i = 0; i < n; i++)
        if (map[0][i] == '.')
            dp[0][i] = 1;

    for (int i = 1; i < n; i++)
        for (int j = 1; j < n; j++) {
            if (map[i][j] == '*')
                dp[i][j] = 0;
            else {
                dp[i][j] = min(min(dp[i - 1][j], dp[i][j - 1])
                               , dp[i - 1][j - 1]) + 1;
                ans = max(ans, dp[i][j]);
            }
        }
    cout << ans << endl;
}

int main()
{
    while (cin >> n, n) {
        solve();
    }

    return 0;
}

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

using namespace std ;

#define N  100010

int n , L , m ;
int a[ N ] , to[ N ] ;
int num , block , belong[ N ] ; 
int nxt[ N ] , val[ N ] ;

int find( int x ) {
	int l = x + 1 , r = n , ans = 0 ;
	while( l <= r ) {
		int mid = ( l + r ) >> 1 ;
		if( a[ mid ] - a[ x ] <= L ) l = mid + 1 , ans = mid ;
		else r = mid - 1 ;
	}
	return ans ;
}

int main() {
	scanf( "%d" , &n ) ;
	for( int i = 1 ; i <= n ; i ++ ) {
		scanf( "%d" , &a[ i ] ) ;
	}
	sort( a + 1 , a + n + 1 ) ;
	scanf( "%d%d" , &L , &m ) ;
	for( int i = 1 ; i < n ; i ++ ) {
		to[ i ] = find( i ) ;
	}
	to[ n ] = n + 1 ;
	block = sqrt( n ) ;
	num = n / block ;
	if( n % block ) num ++ ;
	for( int i = 1 ; i <= n ; i ++ ) {
		belong[ i ] = ( i - 1 ) / block + 1 ;
	}
	for( int i = 1 ; i < n ; i ++ ) {
		int t = i , sp = 0 ;
		while( belong[ t ] == belong[ i ] ) {
			t=to[ t ] ;
			sp ++ ;
		}
		val[ i ] = sp ;
		nxt[ i ] = t ;
		if( i >= block * ( num - 1 ) + 1 ) val[ i ] -- , nxt[ i ] -- ;
	}
	/*
	for( int i = 1 ; i <= n ; i ++ ) {
		printf("%d " ,nxt [ i ] , val[ i ] ) ;
	}
	puts("");
	for( int i = 1 ; i <= n ; i ++ ) {
		printf("%d " , val[ i ] ) ;
	}
	puts("");
	*/
	for( int i = 1 ; i <= m ; i ++ ) {
//		printf("Case #%d\n", i );
		int x , y  , ans = 0 ;
		scanf( "%d%d" , &x ,&y ) ;
		if( x > y )swap( x , y ) ;
		while( belong[ x ] < belong[ y ] ) {
			ans += val[ x ] ;
			x = nxt[ x ] ;
//			printf("now:%d ans:%d spend:%d\n" , x , ans ,val[ x ] ) ;
		}
		while( x < y ) {
			x = to[ x ] ;
			ans ++ ;	
//			printf("now:%d ans:%d\n" , x , ans ) ;
		} 
		printf( "%d\n" , ans  ) ;
	}
	return 0 ;
} 

Measured memory_bytes: 2816
#include<stdio.h>

int A[20],N;
int solve(int,int);

int main(){

  int mi[200],M,i,count=0;

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

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

  for(i=0 ; i<M ;i++){
    if(solve(0,mi[i]) == 1)printf("yes\n");
    else printf("no\n");
  }
  return 0 ;
}


int solve(int i,int m){   
  int judge,res;
  if (m == 0) {judge=1;   return judge;}
  if (i >= N) {judge=0;   return judge;}
  if(solve(i + 1, m)==1 || solve(i + 1, m - A[i])==1){
    return solve(0,0);
  }
}



Measured memory_bytes: 2108
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int ar[100000];

int main(int argc, char *argv[]) {
  // INFILE();
  int n;
  cin >> n;

  vector<int> v(n);
  scan(v);

  for (const auto &val : v) {
    ar[val]++;
  }

  int count = 0;
  for (const auto &val : ar) {
    if (val == 0) {
      continue;
    }
		count++;
  }

  cout << ((count % 2 == 0) ? count - 1 : count) << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		String s = fs.next();
		int z = 0;
		int o = 0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='0')o++;
			else z++;
		}
		int min = Math.min(o, z);
		System.out.println(min * 2);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(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;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 25040
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

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

typedef vector<int> vi;

int main()
{
	map<int, int> m;
	int a;
	int best = 0;
	while(scanf("%d", &a) != EOF){
		if(m.count(a))
			m[a]++;
		else
			m[a] = 1;
		best = max(best, m[a]);
	}

	for(map<int,int>::iterator itr = m.begin(); itr != m.end(); ++itr)
		if(itr->second == best)
			printf("%d\n", itr->first);

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
bool rev[100010];
main(){
    int N,A[100010],cnt = 0;
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A[i];
        if(A[i] == i+1)rev[i] = 1;
    }
    if(rev[0]){
        rev[0] = rev[1] = 0;
        cnt++;
    }
    for(int i = 1;i < N-1;i++){
        if(!rev[i])continue;
        if(rev[i+1])rev[i] = rev[i+1] = 0;
        else rev[i] = 0;
        cnt++;
    }
    if(rev[N-1])cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
vector<int>g[100005];
int dfs(int v,int p){
    int d=0;
    vector<int>o;
    for(int i=0;i<g[v].size();i++){
        int u=g[v][i];
        if(u!=p){
            o.push_back(dfs(u,v));
        }
    }
    sort(o.begin(),o.end());
    for(int i=0;i<o.size();i++)d=max(d+1,o[i]+1);
    return d;
}
int main(void){
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        int a;
        scanf("%d",&a);
        g[--a].push_back(i);
        g[i].push_back(a);
    }
    printf("%d\n",dfs(0,-1));
}

Measured memory_bytes: 15104
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()

a = 10*S[0]+S[1]
b = 10*S[2]+S[3]

if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif not 1 <= a <= 12:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')
else:
    print('MMYY')



Measured memory_bytes: 61868
import sys 
# try:
# 	sys.stdin = open('input.txt', 'r') 
# 	sys.stdout = open('output.txt', 'w')
# except:
# 	pass
input = sys.stdin.readline
for tt in range(1):
	n = int(input())
	# a,b = map(int,input().split())
	l = list(map(int,input().split()))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in range(1,n+1):
		try:
			print(d[i])
		except:
			print(0)
	

Measured memory_bytes: 111636
#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define mp make_pair
using namespace std;

int main(){
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
    ll n;
    cin >> n;
    cout << (n-2)*180;

    return 0;
}

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

vector<int> graph[100001];
int dp[100001];

int solve(int src){
    if(dp[src]!=-1)
        return dp[src];


    bool leaf = true;
    int best = 0;
    for(int child:graph[src]){
        leaf = false;
        best = max(best, solve(child));
    }

    return dp[src] = leaf ? 0 : 1+ best;
}

int main() {
    memset(dp, -1, sizeof dp);
    int n, m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >>b;
        graph[a].push_back(b);
    }

    int ans = 0;
    for(int i=1;i<=n;i++){
        int res = solve(i);
        ans = max(ans, res);
    }

    cout << ans << endl;
}


Measured memory_bytes: 11448
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  if abs(n-max(a,b))<=abs(1-min(a,b)):
    print(abs(n-max(a,b))+1+abs(max(a,b)-min(a,b)-1)//2)
  else:
    print(abs(1-min(a,b))+1+abs(max(a,b)-min(a,b)-1)//2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n;
	int k;
	cin >> n >> k;
	vector<double> p(n);
	double ans = 0.0, cnt = 0.0;

	rep(i, n) {
		cin >> p[i];
		p[i] = (p[i]*(p[i]+1.0)/2.0) / p[i];
		clog << p[i] << endl;
		cnt += p[i];
		if (i >= k) {
			cnt -= p[i - k];
		}
		chmax(ans, cnt);
		// clog << cnt << endl;
	}

	printf("%.9lf\n", ans);
}

Measured memory_bytes: 4832
#include<stdio.h>
#include<string.h>
int main(void){
  char num[10];
  scanf("%s",num);
  int l=strlen(num);
  int san[l-2],i,j,tmp;
  for(i=0;i<l-2;i++){
    san[i]=0;
    for(j=i;j<i+3;j++){
      san[i]+=num[j]-'0';
      san[i]*=10;
    }
    san[i]/=10;
    if(san[i]>=753){
      san[i]=san[i]-753;
    }else{
      san[i]=753-san[i];
    }
  }
  for(i=0;i<(strlen(num)-2);i++){
    for(j=i+1;j<(strlen(num)-2);j++){
      if(san[i]>san[j]){
        tmp=san[i];
        san[i]=san[j];
        san[j]=tmp;
      }
    }
  }
  printf("%d",san[0]);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main{
	public static void main(String[] args) {
		int a,b,c;
		int count=0;
		Scanner scan=new Scanner(System.in);
		a=scan.nextInt();
		b=scan.nextInt();
		c=scan.nextInt();
		for(int i=a;i<=b;i++){
			if(c%i==0){
				count++;
			}
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 26268
#include <iostream>
#include <algorithm>
#include <vector>

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> xs(n);
    for (auto& x : xs) std::cin >> x;
    std::sort(xs.begin(), xs.end());

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            if (xs[i] == xs[j]) continue;
            for (int k = 0; k < j; ++k) {
                if (xs[j] == xs[k]) continue;
                if (xs[k] + xs[j] > xs[i]) ++ans;
            }
        }
    }

    std::cout << ans << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int N;
    cin >> N;
    vector<int> a(3 * N);
    vector<ll> lmax(3 * N);

    {
        ll sum = 0;
        priority_queue<int, vector<int>, greater<int>> que;
        for (int i = 0; i < 3 * N; ++i) {
            cin >> a[i];
            sum += a[i];
            que.push(a[i]);
            if (que.size() > N) {
                sum -= que.top();
                que.pop();
            }
            lmax[i] = sum;
        }
    }

    ll ans = -1e18;
    {
        ll sum = 0;
        priority_queue<int> que;
        for (int i = 3 * N - 1; i >= N; --i) {
            sum += a[i];
            que.push(a[i]);
            if (que.size() >= N) {
                if (que.size() > N) {
                    sum -= que.top();
                    que.pop();
                }
                ans = max(ans, lmax[i - 1] - sum);
            }
        }
    }

    cout << ans << endl;
    return 0;
}


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

const int MOD = 998244353;
struct mint
{
    int64_t x;
    mint(int64_t x = 0) : x((x % MOD + MOD) % MOD) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += MOD - a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(int64_t n) const
    {
        if (n == 0)
            return 1;
        mint t = pow(n >> 1);
        t *= t;
        if (n & 1)
            t *= *this;
        return t;
    }
    mint inv() const { return pow(MOD - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

void solve(int N, int S, vector<int> A)
{
    vector<vector<mint>> dp(N + 1, vector<mint>(S + 1));
    dp.at(0).at(0) = 1;
    for (int i = 0; i < N; i++)
    {
        for (int s = 0; s <= S; s++)
        {
            dp.at(i + 1).at(s) += dp.at(i).at(s) * 2;
            if (s + A.at(i) <= S)
                dp.at(i + 1).at(s + A.at(i)) += dp.at(i).at(s);
        }
    }
    cout << dp.at(N).at(S).x << endl;
}

int main()
{
    int N;
    cin >> N;
    int S;
    cin >> S;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    solve(N, S, move(A));
    return 0;
}


Measured memory_bytes: 73664
def LI():return list(map(int,input().split()))
def yes():print("Yes")
def no():print("No")
import math

a,b,h,m=LI()

def yogen(x,y,z):
    t=x*x+y*y-2*x*y*math.cos(z)
    return t**.5
    
kakudo=math.radians((30*(h+m/60)-6*m))

# print(kakudo)
print(yogen(a,b,kakudo))


Measured memory_bytes: 9504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication82
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if (a == 1)
                Console.WriteLine(1);
            else if (a < 4)
                Console.WriteLine("2");
            else if (a < 8)
                Console.WriteLine("4");
            else if (a < 16)
                Console.WriteLine("8");
            else if (a < 32)
                Console.WriteLine("16");
            else if (a < 64)
                Console.WriteLine("32");
            else 
                Console.WriteLine("64");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }    
    sort(h.begin(),h.end());
    int mn = mod;
    for(int i = 0; i < n-k+1; i++){
        int tmp = h[i+k-1]-h[i];
        if(mn > tmp){
            mn = tmp;
        }
    }
    cout << mn << endl;
}

Measured memory_bytes: 640
//Link : https://codeforces.com/contest/1253

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define mod 1000000007
#define inv2 500000004
/*
#include <limits.h>
INT_MAX
LLONG_MAX
*/
int add(int x,int y) {
  return ((x+y)%mod+mod)%mod;
}
int mul(int x,int y) {
  return (ll)x*y%mod;
}

int mypow(int x,int c) {
  int ret = 1;
  while(c>0) {
    if(c&1) {
      ret = mul(ret,x);
    }
    x = mul(x,x);
    c/=2;
  }
  return ret;
}

vector<int> adj[N];

int aw[N];

void dfs2(int &ret,int node,int par,int taw) {
  int r = taw;
  for(int ch : adj[node]) {
    if(ch==par) {
      continue;
    }
    r = mul(r,aw[ch]);
  }
  if(adj[node].size()>1) {
    int tmp = r;
    tmp = add(tmp, mul(add(1,-taw),mul(r,mypow(taw,mod-2))) );
    for(int ch : adj[node]) {
      if(ch==par) {
        continue;
      }
      tmp = add(tmp, mul(add(1,-aw[ch]),mul(r,mypow(aw[ch],mod-2))) );
    }
    tmp = mul(tmp,inv2);
    tmp = add(inv2,-tmp);
    ret = add(ret,tmp);
  }
  for(int ch : adj[node]) {
    if(ch==par) {
      continue;
    }
    int tmp = mul(r, mypow(aw[ch],mod-2));
    tmp = mul(tmp,inv2);
    dfs2(ret,ch,node,tmp);
  }
}
void dfs(int node,int par) {
  aw[node] = inv2;
  for(int ch : adj[node]) {
    if(ch == par) {
      continue;
    }
    dfs(ch,node);
    aw[node] = mul(aw[node],aw[ch]);
  }
}


void solve() {
  int n;
  scanf("%d ", &n);
  for(int i=0;i<n-1;++i) {
    int a,b;
    scanf("%d %d", &a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1,0);
  int ret = 0;
  dfs2(ret,1,0,1);
  printf("%d\n", ret);
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 25344
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010,M=1000010;
ll n,res;

int main()
{
    in1(n);
    for(int i=1;i<=n;i++)
    {
        if(!(i%3==0 || i%5==0))
            res+=i;
    }
    cout<<res<<endl;
    return 0;
}

/*

*/


Measured memory_bytes: 3764
#include<cstdio>
#include<cmath>
#include<algorithm>
int a[200001],b[200001],Sx,Sy,Tx,Ty,n,p[200001],f[200001],ans;
bool ok=1;
double res;
bool cmp(int x,int y){return a[x]<a[y];}
int Max(int x,int y){return x>y?x:y;}
int Min(int x,int y){return x<y?x:y;}
int main(){
	scanf("%d%d%d%d",&Sx,&Sy,&Tx,&Ty);
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d%d",a+i,b+i),p[i]=i;
	if(Sx>Tx)std::swap(Sx,Tx),std::swap(Sy,Ty);
	if(Sy>Ty){
		for(int i=1;i<=n;++i)b[i]=100000000-b[i];
		Sy=100000000-Sy;Ty=100000000-Ty;}
	std::sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;++i)if(a[p[i]]>=Sx&&b[p[i]]>=Sy&&a[p[i]]<=Tx&&b[p[i]]<=Ty){
		int k=std::lower_bound(f,f+ans,b[p[i]])-f;
		f[k]=b[p[i]];
		ans=Max(ans,k+1);
	}
	res=100.0*(Tx+Ty-Sx-Sy);
	res+=acos(-1)*5.0*ans-20.0*ans;
	if(Min(Tx-Sx,Ty-Sy)+1==ans)res+=acos(-1)*5;
	printf("%.15lf",res);
	return 0;
}

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


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


	int N;
	cin >> N;
	ll a[100000];
	ll goukei = 0;
	rep(i, N) {
		cin >> a[i];
		goukei ^= a[i];
	}

	int M = 60;
	bool A[100000][60] = {};
	rep(i, N) {
		rep(j, M) {
			A[i][j] = a[i] >> j & 1;
		}
	}

	int r = 0;
	for (int i = M - 1; i >= 0; i--) {
		if (!(goukei >> i & 1)) {
			for (int j = r; j < N; j++) {
				if (A[j][i]) {
					rep(k, M) swap(A[r][k], A[j][k]);

					for (int j = r + 1; j < N; j++) {
						if (A[j][i]) {
							rep(k, M) A[j][k] ^= A[r][k];
						}
					}
					if (!A[0][i]) {
						rep(k, M) A[0][k] ^= A[r][k];
					}
					r++;
					break;
				}
			}
		}
	}

	ll kotae = 0;
	rep(i, M) {
		if (!(goukei >> i & 1)) {
			if (A[0][i]) {
				kotae += 1ll << (i + 1);
			}
		}
		else {
			kotae += 1ll << i;
		}
	}
	co(kotae);



	Would you please return 0;
}

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

int main() {
	int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
	int ans = 0;
	if (a + b >= 2 * c) {
		ans += min(x, y) * 2 * c;
		if (x > y)x -= y, y = 0;
		else y -= x, x = 0;

		if (x)ans += min(a, 2 * c) * x;
		if (y)ans += min(b, 2 * c) * y;
	}
	else {
		ans += a * x + b * y;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}

int main(){
    ll a,b,m; cin>>a>>b>>m;
    ll ar[a];
    ll br[b];
    for(ll i=0;i<a;i++)
        cin>>ar[i];
    for(ll i=0;i<b;i++)
        cin>>br[i];
    ll x=*min_element(ar,ar+a);
    ll y=*min_element(br,br+b);
    ll costmin=x+y;
    for(ll i=0;i<m;i++){
        ll x,y,c;
        cin>>x>>y>>c;
        ll cost=ar[x-1]+br[y-1]-c;
        if(cost<costmin)
            costmin=cost;
    }
    cout<<costmin;
    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define PRINT(a)   cout << (a) << endl
#define RALL(v) rbegin(v), rend(v)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n),b(m);
  REP(i,n)cin >> a[i];
  REP(i,m)cin >> b[i];

  vector<ll> as(n+1,0);
  vector<ll> bs(m+1,0);

  REP(i,n){
    as[i+1] = a[i] + as[i];
  }
  REP(i,m){
    bs[i+1] = b[i] + bs[i];
  }

  // aをi冊選ぶとする
  int j=m;
  int ans=0;
  REP(i,n+1){
    if(as[i] > k)break;
    while(as[i] + bs[j] > k && j >= 0)j--;
    if(j>=0){
      chmax(ans,i+j);
    }
  }
  cout << ans << endl;

}



Measured memory_bytes: 9596
n = int(input())
w = []
for i in range(n):
    w.append(input())

ans = 'Yes'
s = []
s.append(w[0])
for i in range(1,n):
    if w[i-1][-1] != w[i][0]:
        ans = 'No'
    if w[i] in s:
        ans = 'No'
    s.append(w[i])

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<c;a++)
using namespace std;
int con[3003];
int an[1001];
int ans[1001];
int main(){
    while(1){
    rep(i,0,1001)ans[i]=2;
    int a,b,c;
    cin >>a >>b >> c;
    if(a==0&&b==0&&c==0)break;
    int n;
    cin >> n;
    rep(i,0,n){
        //int x,y,z,an;
        cin >> con[i] >> con[n+i] >> con[n*2+i] >> an[i];
        //x--;y--;z--;
        //cout << i << a+i << a+b+i << endl;
        if(an[i]==1){
            ans[con[i]]=1;
            ans[con[n+i]]=1;
            ans[con[n*2+i]]=1;
        }
    }
    rep(i,0,n){
        //cout << con[i] << con[i+n] << con[i+n+2] << endl;
        if(an[i]==0)if(ans[con[i]]==1&&ans[con[n+i]]==1&&ans[con[n*2+i]]==2){ans[con[i+n*2]]=0;}
        if(an[i]==0)if(ans[con[i]]==1&&ans[con[n+i]]==2&&ans[con[n*2+i]]==1){ans[con[i+n]]=0;}
        if(an[i]==0)if(ans[con[i]]==2&&ans[con[n+i]]==1&&ans[con[n*2+i]]==1){ans[con[i]]=0;}
    }
    rep(i,1,a+b+c+1){
        cout << ans[i] << endl;
    }
    }
return 0;
}

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

int main() {
    float c1[3];
    float c2[3];
    float d;

    cin >> c1[0] >> c1[1] >> c1[2];
    cin >> c2[0] >> c2[1] >> c2[2];

    d = sqrt(pow(abs(c1[0]-c2[0]), 2) + pow(abs(c1[1]-c2[1]), 2));

    if(d > c1[2] + c2[2]){
        cout << 4 << endl;
    }else if(d == c1[2] + c2[2]){
        cout << 3 << endl;
    }else if(d < c1[2] + c2[2] && d > abs(c1[2] - c2[2])){
        cout << 2 << endl;
    }else if(d == abs(c1[2] - c2[2])){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, U;
    cin >> n >> U;
    vector<ll> w(n), v(n);
    for(int i=0; i<n; i++) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(n, vector<ll>(U+1));

    for(int u=w[0]; u<=U; u++)
        dp[0][u] = v[0];
    for(int i=1; i<n; i++) {
        for(int u=0; u<=U; u++) {
            if(u>=w[i])
                dp[i][u] = max(dp[i-1][u-w[i]]+v[i], dp[i-1][u]);
            else
                dp[i][u] = dp[i-1][u];
        }
    }

    cout << dp[n-1][U] << endl;

    return 0;
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
   ll x;cin>>x;
   ll res=(x%11<=6)? ((x%11==0)? (x/11)*2:(x/11)*2+1):(x/11)*2+2;
   cout<<res<<endl;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

  
def count(n):
  ans = ((1 + 8 * n) ** (1 / 2) - 1) // 2
  return int(ans)
  
N = int(input())
ans = 0
X = factorization(N)
if N == 1:
  print("0")
  quit()
for i in range(len(X)):
  ans += count(X[i][1])
  
print(ans)  
  
  

Measured memory_bytes: 9492
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        long n = sc.nextLong();
        long m = sc.nextLong();

        System.out.println(calc(n, m));
    }

    private long calc(long n, long m) {
        if (n == 2 || m == 2) {
            return 0;
        }

        if (n > m) {
            long tmp = n;
            n = m;
            m = tmp;
        }

        if (n == 1) {
            return (m == 1) ? 1 : m - 2;
        }

        return (n - 2) * (m - 2);
    }

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


Measured memory_bytes: 21204
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 z = values[b];
			values[b] = values[a];
			values[a] = z;
		}
		for(int i = 0;i < values.length; i++){
			System.out.println(values[i]);
		}
	}
}

Measured memory_bytes: 26192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int64_t> A(N);
    rep(n,0,N) cin>>A.at(n);

    int64_t ans=0;
    rep(n,0,N){
        if(n==0){
            rep(n,0,N){
                if(n%2) ans-=A.at(n);
                else ans+=A.at(n);
            }
        }else{
            ans=2*A.at(n-1)-ans;
        }

        cout<<ans<<" ";
    }

    cout<<endl;
}

Measured memory_bytes: 2048
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

# FFT
# use python3
# a = [a1,a2,a3], b= [b1,b2,b3]
# return np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])
import numpy as np
def Convolution(a,b):
    bit = (len(a)+len(b)-2).bit_length()
    L = 2**bit
    fa,fb = np.fft.rfft(a,L), np.fft.rfft(b,L)
    c = np.rint(np.fft.irfft(fa*fb,L)).astype(np.int64)
    return c[:len(a)+len(b)-1]

N,M = II()
A = III()

h = [0]*(max(A))
for a in A:
    h[a-1] += 1

conv = np.append([0,0],Convolution(h,h))
ans = 0
for k in range(2,2*max(A)+1)[::-1]:
    if conv[k]<M:
        ans += k*conv[k]
        M -= conv[k]
    else:
        ans += k*M
        break
        
print(ans)

Measured memory_bytes: 35928
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            final String s  = sc.next();
            if (s.equals("AAA") || s.equals("BBB")) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } finally {
            sc.close();
        }
    }
}


Measured memory_bytes: 22612
N = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
    i = 0
    res = 0
    while True:
        if a % pow(2, i) == 0:
            res = i
        if a < pow(2, i):
            ans += res
            break
        i += 1
print(ans)


Measured memory_bytes: 40816
#include <iostream>
#include <algorithm>
#include <complex>
#include <string>

using namespace std;

int main() {
	int n;
  string s;
  int ans=0;
  int flag=0;
  int max = 0;
	
	cin >> n >> s; 

  for (int a = 1; a < n; a++) {
    ans = 0;
    string t;
    for (int i = 0; i < a; i++) {
      flag=0;
      for (int x = 0; x < t.size(); x++) {
        if (s[i] == t[x]) {
          flag=1;
          break;
        }
      }
      if (flag==1) {
        continue;
      }
      for (int j = a; j < n; j++) {
        if (s[i] == s[j]) {
          t.push_back(s[i]);
          ans++;
          break;
        }
      }
    }
    if (max < ans) {
      max = ans;
    }
  }

  cout << max << endl;

	return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split(" "))
if y == 0:
    print(x)
    exit()
ar = list(map(int,input().split(" ")))
if x not in ar:
    print(x)
else:
    a = x
    b = x
    while True:
        a -= 1
        if a not in ar:
            print(a)
            exit()
        b += 1
        if b not in ar:
            print(b)
            exit()

Measured memory_bytes: 8904
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

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

struct edge{int to,cost;};

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

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

	//i+j==2m -> 正
	ll sum=0;
	ll ans[2]={};
	ll tmp;
	for(int i=0;i<=1;i++){
		sum=0;
		for(int j=0;j<n;j++){
//			cout << "\t" << a[j]+sum << " " << ans[i] << "\n";
			tmp = abs(a[j]+sum);
			if((i+j)%2==0 && a[j]+sum<=0){
				ans[i]+=tmp+1;
				sum+=tmp+1;
//				cout << "hit " << i << " " << j << "\n";
			}
			if((i+j)%2==1 && a[j]+sum>=0){
				ans[i]+=tmp+1;
				sum-=tmp+1;
//				cout << "hit " << i << " " << j << "\n";
			}
		}
//		cout << "ans[" << i << "] = " << ans[i] << "\n";
	}
	cout << min(ans[0],ans[1]) << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)998244353
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll N=100005, inf=1e18;
ll dp[55][55*55];
void solve(){
	memset(dp,-1,sizeof dp);
	ll n, m, x, y, a, b, s, silver;
	cin>>n>>m>>s;
	s=min(s,2500LL);
	using T=pair<ll,pp>;
	vector<T> adj[n+1];
	vector<ll> c(n+1), d(n+1), ans(n+1,inf);
	rep(i,0,m){
		cin>>x>>y>>a>>b;
		adj[x].pb({y,{a,b}});
		adj[y].pb({x,{a,b}});
	}
	rep(i,1,n+1){
		cin>>c[i]>>d[i];
	}
	priority_queue<T,vector<T>,greater<T> > pq;
	pq.push({0,{1,s}});
	while(!pq.empty()){
		T px=pq.top();
		pq.pop();
		x=px.se.fi;
		y=px.fi;
		silver=px.se.se;
		if(dp[x][silver]!=-1)continue;
		ans[x]=min(ans[x],px.fi);
		dp[x][silver]=y;
		if(silver<2500)
			pq.push({y+d[px.se.fi],{px.se.fi,silver+c[px.se.fi]}});
		for(auto i : adj[x]){
			if(silver>=i.se.fi)
				pq.push({y+i.se.se,{i.fi,silver-i.se.fi}});
		}
	}
	rep(i,2,n+1){
		if(i>2)cout<<"\n";
		cout<<ans[i];
	}
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 16836
import bisect,sys
from itertools import *
n=range(50001);a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
for x in map(int,sys.stdin):
 if x:print(sum(1 for d in compress(n[:x//2+1],a[:x//2+1])if a[x-d]))


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int h;
int n;
int a[100005];

int main(void){
	scanf("%d%d",&h,&n);
	int sum=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	printf("%s\n",sum>=h?"Yes":"No");
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>

#include<algorithm>

int main() {

	int i=0;
	std::string w, t;

	std::cin >> w;		// search word(alphabet lower case, max 10 letters)
	
	for (;;) {
		std::cin >> t;	// input text seperated by space and newlines

		if (t == "END_OF_TEXT")break;

		// すべて小文字変換する。
		std::transform(t.begin(), t.end(), t.begin(), tolower);

		if (t == w)i++;
		
	}

	std::cout << i << std::endl;
	

	return 0;
}


Measured memory_bytes: 3200
#include <cstdio>
#include <functional>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;

using ll = long long;

tuple<int, ll, ll> dishesa[100000];
tuple<int, ll, ll> dishesb[100000];
bool eaten[100000];

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    ll a;
    ll b;
    scanf("%lld %lld", &a, &b);
    dishesa[i] = make_tuple(i, a, b);
    dishesb[i] = make_tuple(i, a, b);
    eaten[i] = false;
  }
  sort(dishesa, dishesa+n, [](auto lab, auto rab) -> bool { int li, ri; ll la, lb, ra, rb; tie(li, la, lb) = lab; tie(ri, ra, rb) = rab; return make_tuple(la+lb, la-lb) > make_tuple(ra+rb, ra-rb); });
  sort(dishesb, dishesb+n, [](auto lab, auto rab) -> bool { int li, ri; ll la, lb, ra, rb; tie(li, la, lb) = lab; tie(ri, ra, rb) = rab; return make_tuple(la+lb, lb-la) > make_tuple(ra+rb, rb-ra); });
  /*
  printf("a's preferences:\n");
  for (int i = 0; i < n; i++) printf("%d: %d %d\n", i, get<1>(dishesa[i]), get<2>(dishesa[i]));
  printf("b's preferences:\n");
  for (int i = 0; i < n; i++) printf("%d: %d %d\n", i, get<1>(dishesb[i]), get<2>(dishesb[i]));
  */
  ll cura, curb;
  cura = 0;
  curb = 0;
  int i = 0;
  int ai, bi;
  ai = 0;
  bi = 0;
  for (; i < n; i++) {
    if (i%2 == 0) {
      while (eaten[get<0>(dishesa[ai])]) ai++;
      // printf("a eats %d (%d)\n", get<1>(dishesa[ai]), get<2>(dishesa[ai]));
      cura += get<1>(dishesa[ai]);
      eaten[get<0>(dishesa[ai])] = true;
      ai++;
    }
    else {
      while (eaten[get<0>(dishesb[bi])]) bi++;
      // printf("b eats %d (%d)\n", get<2>(dishesb[bi]), get<1>(dishesb[bi]));
      curb += get<2>(dishesb[bi]);
      eaten[get<0>(dishesb[bi])] = true;
      bi++;
    }
  }
  printf("%lld\n", cura-curb);
  return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n)
    {
        bool flag=false;
        for(int i=0;i*4<=n;i++)
        {
            if((n-4*i)%7==0)
            {
                flag=true;
                break;
            }
        }
        if(flag)
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}

Measured memory_bytes: 256