akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;

int myfact(int n)
{
	int res = 1;
	for (int i = 0; i < n; i++)
		res *= i + 1;
	return res;
}

double dist(int x1, int y1, int x2, int y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n;
	cin >> n;
	vpii a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i].first >> a[i].second;
	double res = 0;
	vi path(n);
	iota(all(path), 0);
	do
	{
		for (int i = 0; i < n - 1; i++)
		{
			
			res += dist(a[path[i]].first, a[path[i]].second, a[path[i + 1]].first, a[path[i + 1]].second);
		}
	} while (next_permutation(all(path)));
	cout << res / myfact(n);
	return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){

int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b==c+d)
    cout<<"Balanced"<<endl;
  else if(a+b>c+d)
    cout<<"Left"<<endl;
  else
    cout<<"Right"<<endl;
  


  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n<10)
  {
    cout<<n<<endl;
  }
  else if(n<100)
  {
    cout<<9<<endl;
  }
  else if(n<1000)
  {
    cout<<n-90<<endl;
  }
  else if(n<10000)
  {
     cout<<999-90<<endl;
  }
  else if(n<100000)
  {
    cout<<999-90 + (n-10000)+1<<endl;
  }
  else
  {
    cout<<90909<<endl;
  }
  
return 0;
}
  

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    bool ok = false;
    rep(i,n) {
        rep(j,n) {
            if(i+m-1 >= n || j+m-1 >= n) continue;
            bool match = true;
            rep(k,m){
                rep(l,m) {
                    if(a[i+k][j+l] != b[k][l]) match = false;

                }
            }
            if(match) ok = true;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3660
def main():
    X, K, D = map(int, input().split())
    X = abs(X)
    if X // D > K:
        print(X - K * D)
    else:
        remain = K - X // D
        if remain % 2 == 0:
            print(X % D)
        else:
            print(abs(X % D - D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61724
#include <stdio.h>



int main(){

	int x,y;
	char str[33];
	int stack[100],  pt_stack=0;

	

	while( scanf( "%s", str) != EOF ){

		if( str[0] == '+' ){
			y = stack[--pt_stack];
			x = stack[--pt_stack];
			stack[pt_stack] = x + y;
			pt_stack++;
		}else if( str[0] == '-' ){
			y = stack[--pt_stack];
			x = stack[--pt_stack];
			stack[pt_stack] = x - y;
			pt_stack++;
		}else if( str[0] == '*' ){
			y = stack[--pt_stack];
			x = stack[--pt_stack];
			stack[pt_stack] = x * y;
			pt_stack++;
		}else{
			stack[pt_stack] = atoi(str);
			pt_stack++;
		}
	}

	printf( "%d\n", stack[0] );

	return 0;

}

Measured memory_bytes: 1848
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <numeric>
#define ALL(c) (c).begin(), (c).end()

using namespace std;
using ll = long long;
using pli = pair<ll, int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdi = pair<double, int>;
using pdd = pair<double, double>;

int L;
vector<int> A;

int main() {
	cin >> L;
	for (int i = 0; i < L; i++)
	{
		int tmpa;
		cin >> tmpa;
		A.push_back(tmpa);
	}
	vector<ll> v,x, a, b, c;
	v.push_back(0);
	x.push_back(0);
	a.push_back(0);
	b.push_back(0);
	c.push_back(0);
	for (int i = 0; i < L; i++)
	{
		v.push_back(v[i] + A[i]);
		ll tmpx = x[i] + (A[i] == 0 ? 2 : (A[i] % 2 == 0 ? 0 : 1));
		tmpx = min(tmpx, v[i] + (A[i] == 0 ? 2 : (A[i] % 2 == 0 ? 0 : 1)));
		x.push_back(tmpx);
		ll tmpa = x[i] + (A[i] % 2 == 1 ? 0 : 1);
		tmpa = min(tmpa, v[i] + (A[i] % 2 == 1 ? 0 : 1));
		tmpa = min(tmpa, a[i] + (A[i] % 2 == 1 ? 0 : 1));
		a.push_back(tmpa);
		ll tmpb = x[i] + (A[i] < 4 ? 4 - A[i] : (A[i] % 2 == 0 ? 0 : 1));
		tmpb = min(tmpb, v[i] + (A[i] == 0 ? 2 : (A[i] % 2 == 0 ? 0 : 1)));
		tmpb = min(tmpb, a[i] + (A[i] == 0 ? 2 : (A[i] % 2 == 0 ? 0 : 1)));
		tmpb = min(tmpb, b[i] + (A[i] == 0 ? 2 : (A[i] % 2 == 0 ? 0 : 1)));
		b.push_back(tmpb);
		ll tmpc = x[i] + A[i];
		tmpc = min(tmpc, a[i] + A[i]);
		tmpc = min(tmpc, b[i] + A[i]);
		tmpc = min(tmpc, c[i] + A[i]);
		c.push_back(tmpc);
	}
	ll ans = min(v[L], min(x[L], min(a[L], min(b[L], c[L]))));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9324
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    cout << N / 3 << endl;
}


Measured memory_bytes: 888
program sample
	implicit none
    integer(8) :: K,A,B,money,maisuu,i
    
    read(*,*) K,A,B
    
    maisuu = 1
    money = 0
    
    do i=1,K
        if (money == 1) then
        	money= money - 1
            maisuu = maisuu +B
        else if (A < B - 1 .and. maisuu >= A .and. i <= K-1) then
        	maisuu = maisuu - A
            money = money + 1
        else 
        	maisuu = maisuu + 1
        end if
        
   	end do
    
    write(*,*) maisuu
    
    stop
end program sample

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

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

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

const int N = 2e3 + 5;

int A[N], DP[N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n, x; cin >> n >> x;
	ll ans = INF * INF;
	for (int i = 0; i < n; i++) cin >> A[i], DP[i] = A[i];
	for (int i = 0; i < n; i++) {
		ll sum = 1LL * i * x;
		for (int j = 0; j < n; j++) DP[j] = min(DP[j], A[(j - i + n) % n]), sum += DP[j];
		ans = min(ans, sum);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()
ac = [0] * n
for i in range(n - 1):
    if s[i] == "A" and s[i + 1] == "C":
        ac[i + 1] = ac[i] + 1
    else:
        ac[i + 1] = ac[i]
for i in range(q):
    l, r = map(int, input().split())
    print(ac[r - 1] - ac[l - 1])

Measured memory_bytes: 51032
#define  _CRT_SECURE_NO_WARNiINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n;
	cin >> n;
	long long ans = 0;
	REP(i, n) {
		int b;
		cin >> b;
		ans += b - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
B = [int(_) for _ in stdin.readline().rstrip().split()]
C = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
ans += sum(B)
for i in range(N-1):
    if A[i+1] == A[i]+1:
        ans += C[A[i]-1]
print(ans)

Measured memory_bytes: 3064
from math import gcd
class Factor:
    def __init__(self, max_element):
        self.minFactor = [-1]*(max_element+1)
        for i in range(2, max_element+1):
            if self.minFactor[i] == -1:
                for j in range(i, max_element+1, i):
                    self.minFactor[j] = i
    def getFactorSet(self, element):
        retSet = set(1)
        while element > 1:
            retSet.add(element)
            retSet.add(self.minFactor[element])
            element //= self.minFactor[element]
        return retSet
    def getPrimeFactorSet(self, element):
        retSet = set()
        while element > 1:
            retSet.add(self.minFactor[element])
            element //= self.minFactor[element]
        return retSet
    def getPrimeFactorDic(self, element):
        retDic = {}
        while element > 1:
            val = self.minFactor[element]
            if val in retDic:
                retDic[val] += 1
            else:
                retDic[val] = 1
            element //= val
        return retDic

def main():
    n = int(input())
    a = list(map(int, input().split()))
    f = True
    fact = Factor(max(a))
    st = set()
    for v in a:
        fac_set = fact.getPrimeFactorSet(v)
        for u in fac_set:
            if u in st:
                f = False
                break
            st.add(u)
        if not f:
            break
    if f:
        print("pairwise coprime")
    else:
        all_gcd = a[0]
        for i in range(1, n):
            all_gcd = gcd(all_gcd, a[i])
        if all_gcd == 1:
            print("setwise coprime")
        else:
            print("not coprime")

if __name__ == "__main__":
    main()

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

using namespace std;

typedef long long ll;

const ll ts = 100005;

#define IOS  ios::sync_with_stdio(0); cin.tie(0);
#define endl "\n"
int a[ts * 2];
int b[ts * 2];
signed main() {

    IOS;
    int h , n  ; cin >> h >>  n ;
    int dp[h + 5][n + 5];
    for(int i = 1; i <= n ; i++) {
    	cin >> a[i] >> b[i];
	}
	
    for(int i=1;i<=h;i++){
	    dp[i][0]= INT_MAX;
	}
       
       for(int i=1;i<=h;i++){
       	for(int j=1;j<=n;j++){
       		if(i< a[j]){dp[i][j]= min(b[j],dp[i][j-1]);}
       		else{
       			dp[i][j]= min(dp[i][j-1],dp[i-a[j]][j]+b[j]);
       		}
       	}
    }
    cout << dp[h][n] ; 
    
 }
 
 
 
 
 
 
 
 
 
 
 
 
 


Measured memory_bytes: 39552
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define vp vector <pair<int,int>>
#define vpp vector <pair<pair<int,int>,int>>
#define si set<int>
#define f(x,y,z) for(x=y;x<z;x++)
#define fb(x,y,z) for(x=y;x>z;x--)
#define pb push_back
#define mp make_pair
#define ld long double
#define pqf priority_queue <int,vector <int>> 
#define pqb priority_queue <int,vector <int>,greater<int>> 
#define ps(x,y) fixed << setprecision(y) << x
#define setbits(x) __builtin_popcountll(x)
#define PI 3.1415926535897932
#define mod 1000000007

// AUTHOR AMAN DWIVEDI
int gcd(int a, int b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
int power(int a,int b)
{
    int c=1;
    while(b)
    {
        if(b&1)
        c*=a;
        a*=a;
        b/=2;
    }
    return c;
}

int32_t main()
{
    IOS
    int  x;
    cin >>x;
    cout<< !x;
    return 0;
}


Measured memory_bytes: 3636
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    int x[6];
    rep(i,1,5) {
    	cin >> x[i];
    	if(x[i]!=i){ cout<<i<<endl;
    	break;
    	}
    }
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3648
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
prime = [True] * (10 ** 6 + 10)
 
b = sorted(set(a))
 
for i in b:
    num = i * 2
    while True:
        if num >= 10 ** 6 + 1:
            break
        prime[num] = False
        num += i
 
ans = 0
for s in a:
    if prime[s] == True and c[s] == 1:
        ans += 1
 
print(ans)

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

ll countn(ll N,ll x){
    if(N >= 0)
        return N/x +1;
    else 
        return 0;
}

int main(void)
{
    ll a,b,x,ans;
    cin >> a >> b >> x;

    ans = countn(b,x)-countn(a-1,x);

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

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

long long gcd(long long number1, long long number2)
{
  //最大公約数
  long long m = number1;
  long long n = number2;

  if (number2 > number1)
  {
    m = number2;
    n = number1;
  }
  long long r = n % m;
  while (r != 0)
  {
    n = m;
    m = r;
    r = n % m;
  }

  return m;
}

int main()
{
  int N;
  long X;
  cin >> N >> X;
  vector<long> x(N);
  rep(i, N)
  {
    long in;
    cin >> in;
    x[i] = in - X;
  }

  long ans = x[0];
  rep(i, N - 1)
  {
    ans = gcd(ans, x[i + 1]);
  }

  cout << abs(ans) << endl;
  return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v(3);
    for(int i = 0; i < 3; i++) cin >> v[i];
    sort(v.begin(), v.end());
    for(int i = 0; i < 3; i++) {
        cout << v[i];
        if(i < 2) cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long int
 
int main()
{
	ll n,m;
	cin>>n>>m;
	char a[n+10][n+10],b[m+10][m+10];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>b[i][j];
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			bool bb=0;
			if(a[i][j]==b[0][0])
			{
				int cnt=0;
				for(int k=0;k<m;k++)
				{
					for(int l=0;l<m;l++)
					{
						if(a[i+k][j+l]==b[k][l])
						{
							cnt++;
						}
						else
						{
							bb==1;
							cnt=0;
							break;
						}
						if(cnt==(m*m))
						{
							cout<<"Yes"<<endl;
							return 0;
						}
					}
					if(bb==1) break;
				}
			}
		}
	}
	cout<<"No"<<endl;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	int arr[n+1];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	int dp[n+1];
	memset(dp,0,sizeof(dp));
	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0] );	
	for(int i=2;i<n;i++){
		dp[i] = min( dp[i-1] + abs( arr[i] - arr[i-1] ) , dp[i-2] + abs(arr[i] - arr[i-2] ) );
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
As = list(map(int,input().split()))
yen = 0
length = sum(As)
l = 0
for a in As:
  l += a
  if l == length/2:
    break
  if l > length/2:
    c = l - length/2
    diff = min(abs(c),abs(b))
    yen += int(diff*2)
    break
  b = length/2 - l
print(yen)

Measured memory_bytes: 88400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb emplace_back
int main()
{
   
    int n,w;
    cin >>n>>w;
    ll wt[n];
    ll val[n];
    for(int i=0;i<n;i++)
    {
    cin>>wt[i];
   
    cin>>val[i];
    }
    ll dp[w+1];
    for(int i=0;i<w+1;i++)
    dp[i]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=w;j>=wt[i];j--)
        {
            
            dp[j]=max(dp[j],dp[j-wt[i]]+val[i]);
           // cout<<i<<" "<<j<<" "<<dp[j]<<endl;
        }
    }
    cout<<dp[w]<<endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <limits>
#include <cstring>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

#define LIMIT 1000010
using namespace std;

bool isnotprime[LIMIT] = {0};
bool dp[31][LIMIT] = {0};
int n, x;
int dishes[31];

void erathos()
{
	CLR(isnotprime);
	
	FOR(i, 2, LIMIT)
	{
		if( !isnotprime[i] )
		{
			for(int j = 2; i*j < LIMIT; j++)
			{
				isnotprime[i*j] = true;
			}
		}
	}
	
	return;
}

int solve()
{
	int res = 0;
	
	CLR(dp);
	
	FOR(j, 0, n)
	{
		for(int i = dishes[j]; i <= x; i += dishes[j])
		{
			dp[j][i] = true;
		}
		
		if( j > 0 )
			for(int i = 1; i <= x; i++)
			{
				if(  ( dp[j-1][i] ) || ((i - dishes[j] >= 0) && dp[j][i - dishes[j]]) )
				{
					dp[j][i] = true;
				}
			}
	}
	
	RFOR(i, 0, x+1)
	{
		if( !isnotprime[i] && dp[n-1][i] )
		{
			res = i;
			break;
		}
	}
	
	return res;
}

int main()
{
	erathos();
	
	while(cin >> n >> x, (n||x))
	{
		FOR(i, 0, n)
		{
			cin >> dishes[i];
		}
		
		int r = solve();
		
		if(r != 0)
			cout << r << endl;
		else
			cout << "NA" << endl;
	}
		
	return 0;
}

Measured memory_bytes: 32416
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for i in range(N)]

ans = X
for i in A:
    num = 1
    count = 1
    while num <= D:
        num += i
        if num <= D:
            count += 1
        else:
            break
    ans += count
print(ans)

Measured memory_bytes: 3060
n = int(input())
Max = 0
number = 1
for i in range(1, n+1):
    i0 = i
    count = 0
    while i0 % 2 == 0:
        i0 //= 2
        count += 1
    if count > Max:
        Max = count
        number = i
print(number)


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

const string YES = "Yes";
const string NO = "No";

void solve(long long a, long long b, long long c)
{
    if (c < a + b)
    {
        cout << NO << endl;
    }
    else if ((a - b) * (a - b) + c * c > 2 * (a + b) * c)
    {
        cout << YES << endl;
    }
    else
    {
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    long long c;
    scanf("%lld", &c);
    solve(a, b, c);
    return 0;
}


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

int main() {
  pair<char, int> p[2];
  int num = 0;
  char temp;
  for (int i = 0; i < 4; i++) {
    cin >> temp;
    if (p[0].first == temp) {
      p[0].second++;
      continue;
    }
    if (p[1].first == temp) {
      p[1].second++;
      continue;
    }
    if (num < 2) {
      p[num].first = temp;
      p[num].second = 1;
      num++;
      continue;
    }
    cout << "No";
    return 0;
  }
  if (p[0].second == 2 && p[1].second == 2)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

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

class position{
public:
  int x,y;
  int height;
};

int main(){
  int n,m,a;
  while(1){
    cin>>n>>m>>a;
    if(!n && !m && !a)break;
    int dt[n+1];
    rep(i,n+1)dt[i]=i;
    position p[m];
    rep(i,m)cin>>p[i].height>>p[i].x>>p[i].y;
    for(int i=1;i<m-1;i++){
      for(int j=m-1;j>=i;j--){
	if(p[j].height<p[j-1].height){
	  position alt=p[j];
	  p[j]=p[j-1];
	  p[j-1]=alt;
	}
      }
    }
    rep(i,m){
      int alt=dt[p[i].x];
      dt[p[i].x]=dt[p[i].y];
      dt[p[i].y]=alt;
    }
    cout<<dt[a]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1172
#!/usr/bin/perl
use POSIX qw(floor);

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);
my @l = sort { $a <=> $b } map { $_ - 0 } split(/\s+/,<STDIN>);

if( $n < 3 ){
  print "0\n"; exit(0);
}

my $cnt = 0;
for(my $i=0;$i<$n-2;$i++){
  for(my $j=$i+1;$j<$n-1;$j++){
    for(my $k=$j+1;$k<$n;$k++){
      my $x = $l[$i];
      my $y = $l[$j];
      my $z = $l[$k];
      if( $x + $y > $z and $x != $y and $y != $z and $x != $z ){
        $cnt++ ;
      }
    }
  }
}

print "$cnt\n";




Measured memory_bytes: 6644
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

void OutputCentralCoodinateAndRadius(double x1, double y1, double x2, double y2, double x3, double y3)
{
	double x, y, r;
	if(y1 == y2 || y2 == y3 || y3 == y1){
		if(y2 == y3){
			swap(x3, x1);
			swap(y3, y1);
		}else if(y3 == y1){
			swap(x2, x3);
			swap(y2, y3);
		}
		double xa = (x2 + x3) / 2;
		double ya = (y2 + y3) / 2;
		double a  = (-x3 + x2) / (y3 - y2);
		x = (x1 + x2) / 2;
		y = a * (x - xa) + ya;
	}else{
		double xa = (x1 + x2) / 2;
		double ya = (y1 + y2) / 2;
		double a  = (-x2 + x1) / (y2 - y1);
		double xb = (x2 + x3) / 2;
		double yb = (y2 + y3) / 2;
		double b  = (-x3 + x2) / (y3 - y2);
		x = (b * xb - a * xa - yb + ya) / (b - a);
		y = a * (x - xa) + ya;
	}
	r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
	cout << fixed << setprecision(3) << x << ' ' << y << ' ' << r << endl;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		OutputCentralCoodinateAndRadius(x1, y1, x2, y2, x3, y3);
	}
	return 0;
}

Measured memory_bytes: 3192
using System.Linq;
using System.Text;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Diagnostics;
using System.Reflection.Metadata;
using System.Threading;

namespace AtCoder
{
    class Program
    {

        struct Point
        {
            public int x;
            public int y;

            public Point(int x, int y)
            {

                this.x = x;
                this.y = y;

            }

        }


        const int BiggestMod = 1000000007;

        public static void Main()
        {

            var args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var x = args[0];
            var n = args[1];

            if (n == 0)
            {

                Console.WriteLine(x);
                return;

            }
            args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            for (int i = 0; i <= 100; i++)
                if (!args.Any(info => (x - i) == info))
                {

                    Console.WriteLine(x - i);
                    break;

                }
                else if (!args.Any(info => (x + i) == info))
                {

                    Console.WriteLine(x + i);
                    break;

                }

            return;


        }

    }

}

Measured memory_bytes: 28300
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << (s == "AAA" || s == "BBB" ? "No" : "Yes") << endl;
    return 0;
}


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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

void solve(int n, int m) {
	vector<int> a(n), b(m);
	int sa = 0;
	rep(i, n) {
		cin >> a[i];
		sa += a[i];
	}
	rep(i, m) {
		cin >> b[i];
		sa -= b[i];
	}
	int ra = 1000, rb = 1000;
	rep(i, n) {
		rep(j, m) {
			if ((a[i] - b[j]) * 2 == sa && a[i] + b[j] < ra + rb) {
				ra = a[i];
				rb = b[j];
			}
		}
	}
	if (ra == 1000) {
		cout << -1 << endl;
	} else {
		cout << ra << ' ' << rb << endl;
	}
}

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




Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin>>A>>B;
    //cout<<A<<B<<endl;
    int ans;
    ans=max(A+B,A-B);
    ans=max(ans,A*B);
    cout<<ans<<endl;
}


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

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  map<int,int>mp;
  map<char,int>mp1;
  map<int,int>mp2;
  for(int i=0;i<N;i++){
    if(mp1[S.at(i)]==1) continue;
    mp1[S.at(i)]++;
    for(int j=i+1;j<N;j++){
      if(mp2[(S.at(i)-'0')*10+(S.at(j)-'0')]==1) continue;
      mp2[(S.at(i)-'0')*10+(S.at(j)-'0')]++;
      for(int k=j+1;k<N;k++){
        mp[(S.at(i)-'0')*100+(S.at(j)-'0')*10+(S.at(k)-'0')]++;
      }
    }
  }
  cout<<mp.size()<<endl;
  return 0;
}



Measured memory_bytes: 3724
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int n,i,j,s;
	cin >> n;
		for (i=0;i<n;i++) {
			cin >> s;
			cout << "Case " << i+1 << ":" << endl;
			for (j=0;j<10;j++) {
				s=(s*s/100) % 10000;
				cout << s << endl;
			}
		}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;
public class Main {

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

		for(int i=0; i<N; i++) {
			W[i] = sc.next();
		}

		int judge1 = 0;

		for(int j=0; j<N-1; j++) {
			char c1 = W[j].charAt(W[j].length()-1);
			char c2 = W[j+1].charAt(0);

			if(c1 == c2) {
				judge1 += 1;
			}
		}

		int judge2 = 0;

		for(int k=0; k<N-1; k++) {
			for(int l=1; l<N-k; l++) {
				if(W[k].equals(W[k+l])) {
					judge2 += 1;
				}
			}
		}

		if(judge1 == N-1 && judge2 == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 23124
//By Huseyn Hajiyev
#include <bits/stdc++.h>
#define FAST_READ ios_base::sync_with_stdio(false);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define VI vector<int>
#define VIL vector<long long>
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define huscout(n) cout<<n<<endl
#define husscanint(n) scanf("%d",&n)
#define husscanll(n) scanf("%lld",&n)
#define husscandouble(n) scanf("%lf",&n)
#define husprintint(n)  printf("%d",n)
#define husprintll(n) printf("%lld",n)
#define MAXN 200010

using namespace std;

ll x,a,b;

int main(){
FAST_READ;
cin>>x>>a>>b;
ll rast=abs(x-a);
ll rastb=abs(x-b);
if(rast>rastb)cout<<"B"<<endl;
else cout<<"A"<<endl;





return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N = input().rstrip()

    s = 0
    for i in range(len(N)):
        s += int(N[i])

    if s % 9 == 0:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()


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

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define MOD 1000000007
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<=n;i++)

using namespace std;

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

	ll n; cin >> n;

	vector<string> v;

	f(i, 1, n) {
		string s; cin >> s;

		sort(s.begin(), s.end());

		v.pb(s);
	}

	sort(v.begin(), v.end());

	// for (auto i : v) cout << i << endl;

	ll x = 1;
	ll ans = 0;
	for (ll i = 0; i < v.size() - 1; i++) {
		if (v[i] == v[i + 1]) {
			x++;
		}

		else {
			ans += ((x * (x - 1)) / 2);
			x = 1;
		}
	}
	ans += ((x * (x - 1)) / 2);


	cout << ans;

	return 0;
}

Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;
template <typename T>
void vecin(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n - 1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<ll> que;
    REP(i,n){
        ll x;
        cin >> x;
        que.emplace(x);
    }
    REP(i,m){
        ll now = que.top();
        que.pop();
        now = now / 2;
        que.emplace(now);
    }
    ll ans = 0;
    while (que.size())
    {
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (506)
ll n, P[MAXN*MAXN], dist[MAXN][MAXN], ans, order[MAXN*MAXN];
ll dx[]={0,0,1,-1};
ll dy[]={1,-1,0,0};
pi get_pos(ll x){
	return pi((x-1)/n+1, (x-1)%n+1);
}
int main(){
	FAST
	cin>>n;
	FOR(i,1,n*n)cin>>P[i],order[P[i]]=i;
	FOR(i,1,n)FOR(j,1,n)dist[i][j]=min({i-1,j-1,n-i,n-j});
	FOR(i,1,n*n){
		ans += dist[get_pos(P[i]).f][get_pos(P[i]).s];
		deque<pi> q;
		q.eb(get_pos(P[i]));
		while(q.size()){
			ll x=q.front().f,y=q.front().s;
			q.pop_front();
			bool b=order[(x-1)*n+y] > i;
			FOR(i,0,3){
				ll nx=x+dx[i],ny=y+dy[i];
				if(nx<=0||nx>n||ny<=0||ny>n||dist[nx][ny]<=dist[x][y]+b)continue;
				dist[nx][ny]=dist[x][y]+b;
				if(b) q.eb(nx,ny); else q.emplace_front(nx,ny);
			}
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 11104
#!/usr/bin/perl
use Data::Dumper;

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @d = ();
$#d = $n;

for(my $x = 1;$x<=100;$x++){
  for(my $y = 1;$y<=100;$y++){
    for(my $z = 1;$z<=100;$z++){
      my $c = $x * $x + $y * $y + $z * $z + $x * $y + $y * $z + $z * $x;
      $d[$c] ++ if( $c <= $n );
    }
  }
}

for(my $i=1;$i<=$n;$i++){
  my $r = $d[$i] - 0;
  print "$r\n";
}



Measured memory_bytes: 6556
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int k,x,res=0; cin>>k>>x;
 FOR(i,-1000000,1000001){
   if(abs(i-x)<=k-1)cout<<i<<" ";
 }
 
 cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int A[210];
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  int counter = 0;
  while(true){
     bool flag = false;
    for(int i = 0; i < N; i++){
      if(A[i] % 2 == 1) flag = true;
    }
    if(flag) break;
    for(int i = 0; i < N; i++){
      A[i] /= 2;
    }
    counter++;
  }
  cout << counter << endl;
}
    

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int H, W;
    while(true){
      H = sc.nextInt();
      W = sc.nextInt();
      if (H == 0 && W == 0) break;
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          if (i % 2 == 0) {
            if (j % 2 == 0) {
              System.out.print('#');
            } else {
              System.out.print('.');
            }
          } else {
            if (j % 2 == 0) {
              System.out.print('.');
            } else {
              System.out.print('#');
            }
          }
        }
        System.out.println();
      }
      System.out.println();
    }
  }
}


Measured memory_bytes: 39288
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int n;
    int a[100];
    int i = 0;
    char buf[256];
    
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%s", buf);
        a[i] = atoi(buf);
    }
    for (i = n - 1; i >= 0; i--)
    {
        printf("%d", a[i]);
        if (i != 0)
            putchar(' ');
    }
    putchar('\n');

    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

typedef long long ll;

double comb(int a,int b){//aCbを計算
    double res=1;
    for(int i=0;i<b;i++)res*=(a-i);
    for(int i=1;i<=b;i++)res/=i;
    return res+0.1;
}

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

    int n,a,b;
    cin>>n>>a>>b;
    vector<ll> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());

    double ans1=0;
    for(int i=0;i<a;i++)ans1+=v[i];
    printf("%lf\n",ans1/a);

    ll ans2=0;
    if(v[0]==v[a-1]){
        int sum=0;
        for(int i=0;i<n;i++)if(v[0]==v[i])sum++;
        for(int i=0;a+i<=b;i++){
            //printf("%20lf\n",comb(sum,a+i));
            ans2+=comb(sum,a+i);
        }
    }
    else{
        int sum1=0,sum2=0;
        for(int i=0;i<n;i++)if(v[a-1]==v[i])sum1++;
        for(int i=0;i<a;i++)if(v[a-1]==v[i])sum2++;
        ans2=comb(sum1,sum2);
    }
    printf("%ld\n",ans2);

}

Measured memory_bytes: 256
///not today

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef pair<long long, long long> pll;

#define SZ(x) (int)(x).size()
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
//#define int long long
#define accept_sho ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define lc (v << 1)
#define rc ((v << 1)| 1)
#define mid ((R + L) >> 1)

int32_t main(){
      string s;
      cin >>s;
      cout <<s[0] <<s[1] <<s[2] <<endl;
}


Measured memory_bytes: 3628
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),k=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt(),f=0;
    for(int i=1;i<=n;i++){
      if(i<=k){
        f+=x;
      }else{
        f+=y;
      }
    }
    System.out.println(f);
  }
}


Measured memory_bytes: 21588
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

M1, D1 = map(int, raw_input().split())
M2, D1 = map(int, raw_input().split())

print int(M1 != M2)

Measured memory_bytes: 4396
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
map<ll,ll>prime_factor(ll m)
{
  map<ll,ll>res;
  for(ll i=2;i*i<=m;i++)
  {
    while(m%i==0){res[i]++;m/=i;}
  }
  if(m>1)res[m]++;
  return res;
}



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,p;cin>>n>>p;
  auto ma=prime_factor(p);
  ll res=1;
  for(auto tp: ma){
    if(tp.second>=n){
      rep(i,tp.second/n)res*=tp.first;
    }
  }
  cout<<res<<endl;

  return 0;

}


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

using namespace std;

int main() {
  int H = 0, N = 0;
  cin >> H >> N;
  
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int A = 0;
    cin >> A;
    
    sum += A;
  }
    
  if (sum >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{   
    long n,m;
    cin >> n >> m;
    vector<long> height(n);
    vector<vector<long>> links(n);
    for(long i=0;i<n;i++){
        cin >> height[i];
    }

    for(long i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        links[a-1].push_back(b-1);
        links[b-1].push_back(a-1);
    }

    long cnt=0;
    for(long i=0;i<n;i++){
        bool good=true;
        for(long j=0;j<links[i].size();j++){
            if(height[i] <= height[links[i][j]] ){
                good=false;
            }
        }
        if(good)cnt++;
    }
    cout << cnt;

    return 0;
}

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


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
const int nmax=8;
vector<bool> used(nmax);
vector<vector<bool>> connect(nmax,vector<bool>(nmax));
int n,m;
int dfs(int now,int depth){
  if(used[now]){
    return 0;
  }
  if(depth==n){
    return 1;
  }
  used[now]=true;
  int ans=0;
  for(int i=0;i<n;i++){
    if(connect[now][i]){
      ans+=dfs(i,depth+1);
    }
  }
  used[now]=false;
  return ans;
}     

int main(){
  cin >> n >> m;
  vector<int> a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
  }
  cout << dfs(0,1) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long n,h,N,sum=0;
    double w;
    while(scanf("%lld",&N)!=EOF)
    {
        sum=0;
        for(h=1 ; h<=3500 ; h++)
        {
            for(n=1 ; n<=3500 ; n++)
            {
                if(4*h*n-N*n-N*h==0)
                    continue;
                w=1.0*(N*h*n)/(4*h*n-N*n-N*h);
                if(w-(long long )w==0&&w>0)
                {
                    printf("%lld %lld %lld\n",h,n,(long long)w);
                    sum++;
                }
                if(sum==1)
                    break;
            }
            if(sum==1)
                break;
        }
    }
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep2(i,a,b) for (ll i = (a); i < (b); ++i)
#define INF (1<<18)




int main() {
    int n;
    cin>>n;
    pair<pair<string,int>,int> a[110];
    rep(i,n){
        string s;
        int m;
        cin>>s>>m;
        a[i] = make_pair(make_pair(s,-m),i);
    }

    sort(a, a+n);

    rep(i,n) cout<<a[i].second + 1 <<endl;

    return 0;
}

Measured memory_bytes: 256
K,N = map(int,input().rstrip().split(" "))
A = list(map(int,input().rstrip().split(" ")))
A.append(A[0] + K)
ans = 0
for i in range(N):
  if A[i + 1] - A[i] > ans:
    ans = A[i + 1] - A[i]
print(K - ans)

Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace std;
struct node{

int ind;
int val;
};
bool comp(struct node p,struct node q)
{
    if(p.val>q.val)
        return true;
    else
        return false;
}

int main()
{

    long long int a,b,c,d,i,j,k,l;
    cin>>b>>a;
    long long int a1[a];
    for(i=0;i<a;i++)
        cin>>a1[i];
    if(b>=a)
    {
        cout<<0;
        return 0;
    }
    sort(a1,a1+a);
    struct node a2[a-1];
    for(i=0;i<a;i++)
    {
        a2[i].val=a1[i+1]-a1[i];
        a2[i].ind=i;
    }
    sort(a2,a2+a-1,comp);

    bool ok[a];
    memset(ok,false,sizeof(ok));
    for(i=0;i<b-1;i++)
    {
        ok[a2[i].ind]=true;
    }

        int str=a1[0];
        long long int cnt=0;
    for(i=0;i<a;i++)
    {
        if(ok[i])
        {
            cnt+=a1[i]-str;
            str=a1[i+1];
        }
        if(i==a-1)
        {
            cnt+=a1[i]-str;
            break;
        }
    }
    cout<<cnt;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
unordered_map<ll,ll> rv; unordered_map<ll,int> vis,num;
int pri[N],p[N],fuck[N],tot; ll b[N];
inline void sieve1(int n)
{	for(rint i=2;i<=n;i++)
	{	if(!fuck[i]) p[++tot]=i;
		for(rint j=1;j<=tot&&p[j]*i<=n;j++)
		{	fuck[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
	}
}
inline void sieve2(int n)
{	tot=0;
	for(rint i=2;i<=n;i++)
	{	if(!pri[i]) p[++tot]=i;
		for(rint j=1;j<=tot&&p[j]*i<=n;j++)
		{	pri[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
	}
}
struct gg{ll v,rev;int s;}a[N];
inline int check(ll x){ll y=sqrtl(x);return y*y!=x?0:!fuck[y];}
int main()
{	int n,t=0,ans=0; ll lim=0; cin>>n;
	for(rint i=1;i<=n;i++) scanf("%lld",&b[i]),lim=max(lim,b[i]);
	sieve1(pow(lim,1.0/2)); sieve2(pow(lim,1.0/3));
	for(rint i=1;i<=n;i++)
	{	ll x=b[i],cur=1,rev=1;
		for(rint j=1;j<=tot;j++)
		{	int cnt=0;
			while(x%p[j]==0) x/=p[j],(++cnt)%=3;
			for(rint k=1;k<=cnt;k++) cur*=p[j];
			for(rint k=1;k<=(3-cnt)%3;k++) rev*=p[j];
		}
		cur*=x;
		if(check(x)) rev*=ll(sqrtl(x)); else rev*=x*x;
		b[i]=cur; rv[b[i]]=rev;
	}
	sort(b+1,b+n+1);
	for(rint i=1,j;i<=n;i=j)
	{	a[++t].v=b[i]; a[t].rev=rv[b[i]]; a[t].s++;// debug(a[t].v);debug(a[t].rev);
		for(j=i+1;j<=n&&b[j]==b[i];j++) a[t].s++; num[a[t].v]=a[t].s;
	}
	for(rint i=1;i<=t;i++)
	if(!vis[a[i].v])
	{	if(a[i].v==a[i].rev) ans++;
		else ans+=max(a[i].s,num[a[i].rev]),vis[a[i].rev]=1;
	}
	cout<<ans;
	return 0;
}


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

Measured memory_bytes: 35652