akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        long sum = 0;
        for (int i = 0; i < N; i++)
        {
            long a = cin.nextLong();
            long tmp = 0;
            while (true)
            {
                if (a % 2 != 0)
                {
                    break;
                }
                a /= 2;
                tmp++;
            }

            sum += tmp;
        }
        Console.WriteLine(sum);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 13792
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int n,dum;
	vector<int> p;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&dum);
		p.push_back(dum);
	}
	sort(p.begin(),p.end());
	if(n==2){
		for(int i=1;i<=p[0];i++){
			if(p[0]%i==0&&p[1]%i==0)
			printf("%d\n",i);
		}
	}
	else{
		for(int i=1;i<=p[0];i++){
			if(p[0]%i==0&&p[1]%i==0&&p[2]%i==0)
			printf("%d\n",i);
		}
	}
}


Measured memory_bytes: 3244
#include<iostream>
#include<vector>
#define ull unsigned long long int 
using namespace std;


ull hcf(ull a,ull b){
    if(b==0)
    return a;
    return hcf(b,a%b);
}


ull lcm(ull a,ull b){
    
    ull den=hcf(a,b);
    
    ull result=0;
    
    if(a%den==0){
        result=a/den;
        result*=b;
    }
    else{
        result=b/den;
        result*=a;
    }
    return result;
}


int main(){
    ull n;
    cin>>n;
    vector<ull>t(n);
    for(int i=0;i<n;i++)
    {
        cin>>t[i];
    }
    ull result=1;
    for(int i=0;i<n;i++)
    {
        result=lcm(result,t[i]);
    
    }
    cout<<result;

}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define eb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define output(x) cout<<x<<endl;
#define fre(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define frd(i, a, b) for (int i = (int)(a); i >= b; --i)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int> > vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

const int maxn = 310000;

int dp[maxn][3];

int main(){
	cin.tie(0);ios_base::sync_with_stdio(0);	
	int n;
	cin>>n;
	int a[n+1],b[n+1],c[n+1];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i+1]>>b[i+1]>>c[i+1];
	}
	fre(i,1,n){
		dp[i][0]=max(dp[i-1][1]+a[i] , dp[i-1][2]+a[i]);
		dp[i][1]=max(dp[i-1][0]+b[i] , dp[i-1][2]+b[i]);
		dp[i][2]=max(dp[i-1][1]+c[i] , dp[i-1][0]+c[i]);
	}
	int ans=max(dp[n][0],dp[n][1]);
	ans=max(dp[n][2],ans);
	output(ans);
	return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  double a, b, x;
  cin >> a >> b >> x;
  if (a * a * b == x) {
    put(0);
    return 0;
  }

  if ((a * a * b) / 2 >= x) {
    double h = (2 * x) / (a * b);
    double theta = atan2(h, b) * 180.0 / PI;
    putf(90.0 - theta, 10);
    return 0;
  }

  double e = (2 * x) / (a * a) - b;
  double theta = atan2(a, b - e) * 180.0 / PI;
  putf(90.0 - theta, 10);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[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]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main(){
  int n;
  ll k;
  cin>>n>>k;
  vector<pair<int,int>> p(n);
  for(int i=0;i<n;i++) cin>>p[i].first>>p[i].second;

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

  ll cnt = 0;
  ll ans = 0;
  for(int i=0;i<n;i++){
    cnt += p[i].second;
    if(k <= cnt){
      ans = p[i].first;
      break;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
n = int(input())
sum = 0
for _ in range(n):
    a = int(input())
    if a == 2:
        continue
    for i in range(a):
        x = i + 2
        if a%x == 0:
            sum += 1
            break
        if x > a ** 0.5:
            break
print(n - sum)



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

int main (){
  int N,D,X,A;
  int ans = 0;

  std::cin >> N>>D>>X;

  for (int i = 0 ; i < N ; i ++ ) {
    int day = 1;

    cin >> A;
    while  (day <= D){
      day = day + A;
      ans++;

    }
  }



  std::cout << ans+X<< '\n';

return 0;
  }


Measured memory_bytes: 256
N =int(input())
para = [i for i in map(int,input().split())]

"""
min : 3200以上の人間が既出の色にする
max : 3200以上の人間が出来るだけ出ていない色にすru
"""
color = [i//400 for i in para]
ans = []
cnt = 0
cnt_g = 0
for i in range(N):
    if color[i] >= 8 :
        cnt_g += 1
    else : 
        if  color[i] in ans : pass
        else: ans.append(color[i])
        

max_val = len(ans) + cnt_g
min_val = 0
if len(ans) >= 1 : min_val = len(ans)
else : min_val = 1
print("{} {}".format(min_val,max_val))

Measured memory_bytes: 3064
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    int res = 0;
    for (int i = a; i <= b; i++) {
        string orig = to_string(i);
        string rev = orig;
        reverse(rev.begin(), rev.end());
        if (orig == rev) res++;
    }
    printf("%d\n", res);
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define INF (int)1e8

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  vi h(N);
  rep(i, N) cin >> h[i];

  double m = INF;
  int res = -1;
  rep(i, N) {
    double t = T - h[i] * 0.006;
    m = min(m, abs(A - t));
  }
  rep(i, N) {
    double t = T - h[i] * 0.006;
    if (m == abs(A - t)) {
      res = i + 1;
      break;
    }
  }

  cout << res << endl;
}

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

int main() {
  long long x, y;
  cin >> x >> y;
  
  int ans = 1;
  while(1){
    if(x * 2 <= y){
      x *= 2;
      ans++;
    }
    else break;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = input().strip().split()
A = [int(i) for i in A]
for i in range(N):
    if i == N-1:
        print(A[i])
    else:
        print(A[i],end=' ')


for i in range(N-1):
    j = i
    while True:
        if j == -1:
            break
        if A[j]>A[j+1]:
            v = A[j]
            A[j] = A[j+1]
            A[j+1] = v
        j += -1
        
    for x in range(N):
        if x == N-1:
            print(A[x])
        else:
            print(A[x],end=' ')


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

char dict[30600000];

char word[26];

long encode(const char *key){
  int n=strlen(key),i;
  long sum=0;
  long keta=1;
  for(i=0;i<n;i++){
    int keyi=key[i];
    sum = sum + keta * word[keyi];
    keta=keta*5;
  }
  return (sum);
}

void insert(const char *key2) {
  long key=encode(key2);
  long keta=key/8;
  dict[keta]=(dict[keta]|(1<<(key%8)));
}

int find_h(const char *key2) {
  long key=encode(key2);
  return (dict[key/8] & 1<<(key%8));
}

int main(void) {
  long n,i;
  word['A'] = 1;
  word['C'] = 2;
  word['G'] = 3;
  word['T'] = 4;
  scanf("%ld\n",&n);
  for(i=0;i<n;i++){
    char cmd[8], str[14]; scanf("%s %s\n",cmd, str);
    if(cmd[0]=='i') {
      insert(str);
    }
    else {
      if(find_h(str)) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1432
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)                    cerr<<#x<<": "<<x<<endl
#define trace2(x, y)                 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)                 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)             cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)         cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f)     cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll ans=inf;
    for(ll i=1; i*i<=n; i++){
        if(n%i==0){
            string s,t;
            s=to_string(i);
            t=to_string(n/i);
            ll x=max(s.size(),t.size());
            ans=min(ans,x);
        }
    }
    cout << ans;
    return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    long long k, n, T;
    //cin>>T;
    T=1;
    while(T--)
    {
        cin>>n;
        if(n>=30) cout<<"Yes";
        else cout<<"No";
        
    }
    return 0;
}

Measured memory_bytes: 3132
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
using ll = long long int;
 
typedef pair<int,int> P;
 
int main(void){
 string str;
 cin >> str;
 int ans=0;
        if(str[0]=='R'){
            if(str[1]=='R'){
                if(str[2]=='R'){
                    ans=3;
                }else{
                    ans=2;
                }
            }else{
                ans=1;
            }
        }else{
            if(str[1]=='R'){
                if(str[2]=='R'){
                    ans=2;
                }else{
                    ans=1;
                }
            }else{
                if(str[2]=='R')ans=1;
            }
        }
        cout << ans<<endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define M 1000000007
//#define M 998244353
using namespace std;
const int inf=4e18;
const double pi=3.14159265358979;
int knapsack(int n,int W,int w[],int v[])
{
	int i,j,V=0;
	for(i=1;i<=n;i++)
		V+=v[i];
	int dp[n+1][V+1],o=-inf;//CAREFUL: 1-indexing
	for(j=0;j<=V;j++)
	{
		for(i=0;i<=n;i++)
		{
			if(j==0&&i==0)
				dp[i][j]=0;
			else if(i==0)
				dp[i][j]=inf;
			else
			{
				if(j-v[i]>=0)
					dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
				else
					dp[i][j]=dp[i-1][j];
			}
			if(dp[i][j]<=W)
				o=max(o,j);
		}
	}
	return o;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,W;cin>>n>>W;
	int v[n+1],w[n+1],i;
	for(i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	int o=knapsack(n,W,w,v);
	cout<<o<<endl;
}

Measured memory_bytes: 79104
from collections import deque

S = input()

heads = deque([])
tails = deque([])
reverse = False

Q = int(input())
for _ in range(Q):
    cmds = input().split()
    if cmds[0] == '1':
        reverse = not reverse
        heads, tails = tails, heads
    else:
        f, c = cmds[1], cmds[2]
        if f == '1':
            if reverse:
                heads.append(c)
            else:
                heads.appendleft(c)
        else:
            if reverse:
                tails.appendleft(c)
            else:
                tails.append(c)
    
    # if reverse:
    #     print(list(heads)[::-1], S[::-1], list(tails)[::-1])
    # else:
    #     print(list(heads), S, list(tails))
    # print('-' * 10)

if reverse:
    heads = list(heads)[::-1]
    tails = list(tails)[::-1]
    S = S[::-1]

heads = ''.join(map(str, heads))
tails = ''.join(map(str, tails))
ans = ''.join([heads, S, tails])
print(ans)

Measured memory_bytes: 12704
#ifdef _WIN32
#define DEBUG	1
#endif

#define _CRT_SECURE_NO_WARNINGS
#define MATH_PI 3.14159265358979323846264338327950288419716939
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;

#ifdef DEBUG
#include "include.h"
#else
inline void wait(){}
inline void dout(const char *arg, ...){}
#endif

template<typename T>inline void swap(T a, T b){T t = a; a = b; b = t;}

#define CLIP(ptr, min, max) {if((min)<=(max)){if(ptr<(min)){ptr=(min);}if(ptr>(max)){ptr=(max);}}}
#define max(a, b) a > b ? a : b;
#define min(a, b) a > b ? b : a;
#define Sin(deg) sin((deg)*MATH_PI/180)
#define Cos(deg) cos((deg)*MATH_PI/180)
#define Tan(deg) tan((deg)*MATH_PI/180)
#define Rad(deg) ((deg)*MATH_PI/180)
#define ff(param, num) for(int param=0 ; param<num ; ++param)
#define fi(num) for(int i=0 ; i<num ; ++i)
#define fj(num) for(int j=0 ; j<num ; ++j)
#define fk(num) for(int k=0 ; k<num ; ++k)
#define fl(num) for(int l=0 ; l<num ; ++l)
#define ffr(param, num) for(int param=num-1 ; param>=0 ; --param)
#define fir(num) for(int i=num-1 ; i>=0 ; --i)
#define fjr(num) for(int j=num-1 ; j>=0 ; --j)
#define fkr(num) for(int k=num-1 ; k>=0 ; --k)
#define flr(num) for(int l=num-1 ; l>=0 ; --l)
#define in_i(p) Scanf("%d", p)
#define in_i2(p1, p2) Scanf2("%d %d", p1, p2)
#define in_i3(p1, p2, p3) Scanf3("%d %d %d", p1, p2, p3)
#define in_i4(p1, p2, p3, p4) Scanf4("%d %d %d %d", p1, p2, p3, p4)
#define in_ll(p) Scanf("%lld", p)
#define in_ll2(p1, p2) Scanf2("%lld %lld", p1, p2)
#define in_ll3(p1, p2, p3) Scanf3("%lld %lld %lld", p1, p2, p3)
#define in_ll4(p1, p2, p3, p4) Scanf4("%lld %lld %lld %lld", p1, p2, p3, p4)
#define in_f(p) Scanf("%f", p)
#define in_f2(p1, p2) Scanf2("%f %f", p1, p2)
#define in_f3(p1, p2, p3) Scanf3("%f %f %f", p1, p2, p3)
#define in_f4(p1, p2, p3, p4) Scanf4("%f %f %f %f", p1, p2, p3, p4)
#ifdef DEBUG
#define in_c(buf) fscanf(local_in.fp, "%s", buf)
#define Scanf(expr, p) fscanf(local_in.fp, expr, &p)
#define Scanf2(expr, p1, p2) fscanf(local_in.fp, expr, &p1, &p2)
#define Scanf3(expr, p1, p2, p3) fscanf(local_in.fp, expr, &p1, &p2, &p3)
#define Scanf4(expr, p1, p2, p3, p4) fscanf(local_in.fp, expr, &p1, &p2, &p3, &p4)
#else
#define in_c(buf) Scanf("%s", buf)
#define Scanf(expr, p) scanf(expr, &p)
#define Scanf2(expr, p1, p2) scanf(expr, &p1, &p2)
#define Scanf3(expr, p1, p2, p3) scanf(expr, &p1, &p2, &p3)
#define Scanf4(expr, p1, p2, p3, p4) scanf(expr, &p1, &p2, &p3, &p4)
#endif
#define ans(p) cout << p << endl;
signed main() {

	int ii, jj, kk, ll;
	int ret = 0;
	int flag = 0;
	char cbuf[8192];

	in_i2(ii, jj);
	fi(2){
		if(ii > jj){
			ret += ii;
			--ii;
		}else{
			ret += jj;
			--jj;
		}
	}

	ans(ret);

	wait();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include<map>
#include <utility>
#include <math.h>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[100010] = {}, f[100010];
double syo = 0, su = 0;
long long   mur=0, kmr=0, yju=0, counto[5003],counto1[5003];
char fir='z',sec='z',mado[5010];
string rik,tok[25003];
bool mazi[110], gi[110],zi,manji;
pair<int, int>n[110];
vector<int> aa[50] = {}, cc;
vector<string> bb;
map<int, int>pos;
int gcd(int a,int b) {
	int d;
	if (a > b) {
		int t = b;
		b = a;
		a = t;
	}
	while ((d = b % a) != 0) {
		b = a;
		a = d;
	}
	return a;
}
int main() 
{
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> e[i];
		pos[e[i]]++;
		if (pos[e[i]] % 2 == 0) {
				cc.emplace_back(e[i]);
		}
	}
	if (cc.size() < 2) {
		cout << '0' << endl;
		return 0;
	}
	sort(cc.begin(), cc.end(),greater<int>());
	mur = cc[0];
	kmr = cc[1];
	yju = mur * kmr;
	cout << yju << endl;
	return 0;
}

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    
    int sum = 0;
    for(int i = 0; i <= 100; i++){
        if((i>=a&&i<=b)&&(i>=c&&i<=d)) sum++;
    }
    
    if(sum) cout << sum - 1;
    else cout << sum;
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define all(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
	ll s, w;
	scanf("%lld%lld", &s, &w);
	if(w>=s) puts("unsafe");
	else puts("safe");
}

Measured memory_bytes: 3760
N, M = map(int, input().split())
P = [list(map(int, input().split())) for k in range(M)]
G = [[0 for k in range(N)] for k in range(N)]
for p in P:
    G[p[0]-1][p[1]-1] = G[p[1]-1][p[0]-1] = 1

def dfs(ima,itta):
    if len(itta)==N:
        return 1
    ans = 0
    for k in range(N):
        if ima[k]==1 and k not in itta:
            itta.append(k)
            ans += dfs(G[k],itta)
            itta.remove(k)
    return ans

print(dfs(G[0],[0]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define lld long long int
// #define M 1000000007
#define fors(i,n) for(int i=0;i<n;++i)
#define fore(i,a,b) for(int i=a;i<=b;++i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vv std::vector<int>
#define endl "\n"
#define test(i) cout<<i<<endl
#define tests(i) cout<<"i: "<<i<<endl;
#define itrt int t; cin>>t; fors(i,t)
#define itr1 int t; cin>>t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a,n) sort(arr,arr+n)
#define sortv(x) sort(x.begin(),x.end())
void file(){
    #ifdef LOCAL
    freopen("demo.in","r",stdin);
    freopen("demo.out","w",stdout);
    #endif
}

#define N 10000005

void test_case(){
    int x;
    cin>>x;
    for(int i=-120;i<=120;++i){
        for(int j=-120;j<=120;++j){
            if(pow(i,5)-pow(j,5)==x){
                cout<<i<<" "<<j;
                goto label;
            }
        }
    }
    label:{
        
    }
}

int main(){
    fastio;
    file();
    int T=1;
    // int T;
    // cin>>T;
    for(int nr=1;nr<=T;++nr) {
        // cout<<"Case #"<<nr<<": ";
		test_case();
		return 0;
    }
}

Measured memory_bytes: 4104
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n;
		int k, p;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			k = scan.nextInt();
			p = scan.nextInt();
			
			if(k % p == 0)System.out.println(p);
			else System.out.println(k%p);
		}
	}
}

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

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String s = br.readLine();
        int toppingCount = 0;
        
        for(int i = 0; i < 3; i++){
            if(s.charAt(i) == 'o'){
                toppingCount++;
            }
        }
        
        out.println(700 + 100 * toppingCount);
        out.close();
        
    }
}

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

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

int main() {
  ll n, ans = 0;
  cin >> n;
  string s;
  unordered_set<string> st;
  rep(i, n) cin >> s, st.insert(s);
  ans = st.size();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17720
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),
  fast;
	
	ll a , b ;
	cin>>a>>b ;
	ll ans = -1 ;
	for(ll i=1 ;i<=10000000;i++){
		if((i*8)/100==a && (i*10)/100==b){
			ans = i ;
			break;
		}
	}	
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
S=input()

a=int(S[:2])
b=int(S[2:])

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


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long double,int> P;
const ll MOD=998244353;
ll a,b,c,d;
ll dp[3005][3005];
int main(void){
    cin>>a>>b>>c>>d;
    if(a==c&&b==d){
        cout<<1<<endl;
        return 0;
    }
    if(a==1&&b==1&&c==1&&d==1){
        cout<<1<<endl;
        return 0;
    }
    if(a==1&&c==1){
        cout<<1<<endl;
        return 0;
    }
    if(b==1&&d==1){
        cout<<1<<endl;
        return 0;
    }
    dp[a-1][b-1]=1;
    for(ll i=a;i<c;i++){
        dp[i][b-1]=dp[i-1][b-1]*b%MOD;
        //cout<<dp[i][b-1]<<endl;
    }
    for(ll i=b;i<d;i++){
        dp[a-1][i]=dp[a-1][i-1]*a%MOD;
        //cout<<dp[a-1][i]<<endl;
    }
    for(ll i=a;i<c;i++){
        for(ll j=b;j<d;j++){
            dp[i][j]=(dp[i-1][j]*(j+1)+dp[i][j-1]*(i+1)-dp[i-1][j-1]*(i*j))%MOD;
        }
    }
    while(dp[c-1][d-1]<0){
        dp[c-1][d-1]+=MOD;
    }
    cout<<dp[c-1][d-1]<<endl;

}



Measured memory_bytes: 74024
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Aug  2 21:01:23 JST 2020
 **/

/// @docs src/Helper/BinarySearch.md
template <class F> long long binary_search(long long ok, long long ng, F check) {
    while (std::abs(ok - ng) > 1) {
        long long mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    return ok;
}

signed main() {
    Int n, K;
    std::cin >> n >> K;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Int ans = binary_search(1e10, 0, [&](Int mid) {
        Int num = 0;
        REP(i, n) { num += (a[i] + mid - 1) / mid; }
        return num <= K + n;
    });
    std::cout << ans << std::endl;
}


Measured memory_bytes: 4736
#include <stdio.h>

typedef struct List {
	struct List *next;
	int v;
} list;

list *adj[500001] = {}, *adj_inv[500001] = {}, e[1000001], *sc[500001] = {}, d[500001], *sc_adj[500001] = {}, f[500001];

void DFS1(int u, int label[], int q[])
{
	if (label[u] != 0) return;
	else label[u] = 1;
	
	list *p;
	for (p = adj[u]; p != NULL; p = p->next) DFS1(p->v, label, q);
	q[label[0]++] = u;
}

void DFS2(int u, int label[])
{
	if (label[u] != 0) return;
	else {
		label[u] = label[0];
		d[u].v = u;
		d[u].next = sc[label[0]];
		sc[label[0]] = &(d[u]);
	}
	
	list *p;
	for (p = adj_inv[u]; p != NULL; p = p->next) DFS2(p->v, label);
}

int SCC(int N, int label[], int size[], int deg[])
{
	int i, k, u, q[500001];
	for (i = 1; i <= N; i++) DFS1(i, label, q);
	for (i = 0; i <= N; i++) label[i] = 0;
	for (i = N - 1, k = 1; i >= 0; i--) {
		if (label[q[i]] == 0) {
			label[0] = k++;
			DFS2(q[i], label);
		}
	}
	
	list *p;
	for (i = 1, k--; i <= k; i++) for (p = sc[i]; p != NULL; p = p->next, size[i]++);
	for (u = 1, i = 0; u <= N; u++) {
		for (p = adj[u]; p != NULL; p = p->next) {
			if (label[p->v] == label[u]) continue;
			f[i].v = label[p->v];
			f[i].next = sc_adj[label[u]];
			sc_adj[label[u]] = &(f[i++]);
			deg[label[p->v]]++;
		}
	}
	return k;
}

int main()
{
	int i, N, M, u, w;
	scanf("%d %d", &N, &M);
	for (i = 0; i < M; i++) {
		scanf("%d %d", &u, &w);
		if (u == w) continue;
		e[i*2].v = w + 1;
		e[i*2+1].v = u + 1;
		e[i*2].next = adj[u+1];
		e[i*2+1].next = adj_inv[w+1];
		adj[u+1] = &(e[i*2]);
		adj_inv[w+1] = &(e[i*2+1]);
	}
	
	int label[500001] = {}, size[500001] = {}, deg[500001] = {}, k = SCC(N, label, size, deg), q[500001], head, tail;
	list *p;
	printf("%d\n", k);
	for (i = 1, tail = 0; i <= k; i++) if (deg[i] == 0) q[tail++] = i;
	for (head = 0; head < tail; head++) {
		i = q[head];
		printf("%d", size[i]);
		for (p = sc[i]; p != NULL; p = p->next) printf(" %d", p->v - 1);
		printf("\n");
		
		for (p = sc_adj[i]; p != NULL; p = p->next) {
			deg[p->v]--;
			if (deg[p->v] == 0) q[tail++] = p->v;
		}
	}
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 61448
import math
N=int(input())


n_max=math.ceil(math.sqrt(N))
res=[0]*(N+1)

for x in range(1,n_max+1):
  for y in range(1,n_max+1):
    for z in range(1,n_max+1):
      v=x*x+y*y+z*z+x*y+y*z+z*x
      if v <= N:
        res[v]+=1

for i in range(1,N+1):
  print(res[i])


Measured memory_bytes: 9112
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int[] A = new int[5];
      	int[] B = new int[5];
      	for(int i = 0; i < 5; i++){
        	A[i] = scan.nextInt();
          	B[i] = tenth(A[i]);
        }
      	int min = ichi(A[0]);
      	int pointer = 0;
      	int all = 0;
      	int k = 0;
      	for(int i = 0; i < 5; i++){
        	if(ichi(A[i]) < min && ichi(A[i]) != 0){
            	min = ichi(A[i]);
              	pointer = i;
            }
        }
      	all = B[0] + B[1] + B[2] + B[3] + B[4] - B[pointer];
      	all = all + A[pointer];
      	System.out.print(all);
    }
  	public static int tenth(int a){
    	while(a % 10 != 0){
        	a++;
        }
      	return a;
    }
  	public static int ichi(int b){
    	while(b >= 10){
        	b = b - 10;
        }
      	return b;
    }
 
}

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

Measured memory_bytes: 20948
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = int.Parse(Console.ReadLine());
            Int64 sum = 0;
            for(int i = 1; i < num + 1; i++)
            {
                if(i % 3 != 0 && i % 5 != 0)
                {
                    sum += i;
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 27540
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {

        // Input
        Scanner sc = new Scanner(System.in);

        String str = sc.next();
        String result = "Good";

        for ( int i = 0; i < str.length()-1; i++ ) {
           int j = i + 1;
           if ( str.substring(i, i+1).equals(str.substring(j, j+1)) ) {
              result = "Bad";
              break;
           }
        }

        // Output
        System.out.println(result);

        sc.close();
    }
}


Measured memory_bytes: 35780
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>


using namespace std;

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

	string t;
	int i = 0;
	while (s[i] != '\0') {
		if (i == 0 || i % 2 == 0) {
			t += s[i];
		}
		i++;
	}
	cout << t;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
  int n;
  int a;
  int min=1000000;
  int max=-1000000;
  long long sum=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a;
    sum=sum+a;
    if(a<min){
      min=a;
    }
    if(a>max){
      max=a;
    }
  }
  cout << min << " " << max << " " << sum << endl;
}

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

public class Main{

	
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		int a=sc.nextInt(),b=sc.nextInt(),k=sc.nextInt();
		int count=0;
		for(int i=a;i>=1;i--)
			if(a%i==0 && b%i==0) {
				if(++count==k)
					System.out.println(i);
			}
		out.close();

	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		
	}
}


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

using namespace std;

typedef long long ll;

int main() {
    int n,x,t;
    cin >> n >> x >> t;
    int cnt = 0;
    while(n>0){
        n = n - x;
        cnt += t;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void OUT(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void OUT(T t,Ts... ts){cout<<t<<" ";OUT(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type FILL(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type FILL(T&t,const V&v){for(auto &e:t)FILL(e,v);}
constexpr long long INF = 1e18;

int gcd(int x,int y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
int lcm(int x, int y)
{
	return (x * y / gcd(x, y));
}

signed main(){
	int N;
	cin>>N;
	auto a = mv(N);
	cin>>a;
	int now = 1;
	REP(i,N){
		if(a[i]==now){
			now++;
		}
	}
	if(now==1)OUT(-1);
	else OUT(N-(now-1));
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C ; cin >> A >> B >> C;
    if(A == B){
        cout << C << endl;
    }
    else if(B == C){
        cout << A << endl;
    }
    else if(A == C){
        cout << B << endl;
    }
    return 0;
}

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

int main()
{
	int n;
	while( std::cin >> n, ~n )
	{
		std::vector<int> v;

		if( !n )
			v.push_back( 0 );

		while( n > 0 )
		{
			v.push_back( n & 3 );
			n >>= 2;
		}

		for( int i = v.size() - 1; i >= 0; --i )
			std::cout << v[i];
		std::cout << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define LL long long
#define mp make_pair
#define pb push_back
#define INF (1<<29)
using namespace std;
typedef pair<int,int>pii;
int n,m,k;
int a[2010][2010],f[2010][2010],f1[2010][2010],f2[2010][2010];
int sum(int x1,int y1,int x2,int y2){
	return f[x2][y2]-f[x1-1][y2]-f[x2][y1-1]+f[x1-1][y1-1];
}
int sum1(int x1,int y1,int x2,int y2){
	return f1[x2][y2]-f1[x1-1][y2]-f1[x2][y1-1]+f1[x1-1][y1-1];
}
int sum2(int x1,int y1,int x2,int y2){
	return f2[x2][y2]-f2[x1-1][y2]-f2[x2][y1-1]+f2[x1-1][y1-1];
}
int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			char ch;
			cin>>ch;
			a[i][j]=ch-'0';
		}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			f[i][j]=f[i][j-1]+f[i-1][j]-f[i-1][j-1]+a[i][j];
//			cout<<f[i][j]<<' ';
		}
//		puts("");
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<=m;j++){
			f1[i][j]=f1[i][j-1]+f1[i-1][j]-f1[i-1][j-1]+((a[i][j]&&a[i+1][j])?1:0);
//			cout<<f1[i][j]<<' ';
		}
//		puts("");
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<m;j++){
			f2[i][j]=f2[i][j-1]+f2[i-1][j]-f2[i-1][j-1]+((a[i][j]&&a[i][j+1])?1:0);
//			cout<<f2[i][j]<<' ';
		}
//		puts("");
	}
	while(k--){
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		int f1=sum(x1,y1,x2,y2);
		int f2=sum1(x1,y1,x2-1,y2)+sum2(x1,y1,x2,y2-1);
		cout<<f1-f2<<endl;
	}
	return 0;
}


Measured memory_bytes: 64896
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())

    a = [0 for _ in range(n)]
    b = [0 for _ in range(n)]

    for i in range(n):
        _a, _b = map(int, input().split())
        a[i] = _a
        b[i] = _b

    counter = 0
    for i in range(n):
        a[-(i+1)] += counter
        if a[-(i+1)] % b[-(i+1)] == 0:
            pass
        else:
            counter += (b[-(i+1)] - (a[-(i+1)] % b[-(i+1)]))

    print(counter)


if __name__ == "__main__":
    main()


Measured memory_bytes: 15016
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define s(x)   scanf("%d",&x);
#define bug(x) printf("  %s = %d \n",#x,x);
#define mem(arr,x) memset(arr,x,sizeof arr);
const int maxn = 2e5 + 5;
typedef long long LL;
using namespace std;

int main(){
	int n;
	while(cin >> n){
		printf("ABC%d\n",n);
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
    long i,s,ans,temp,temp2;
    bool flg=false;
    vector<long> ss;
    cin>>s;
    ss.push_back(s);
    while(1){
        temp=ss[ss.size()-1];
        if(temp%2==0){
            temp=temp/2;
        }else{
            temp=3*temp+1;
        }
    for(i=0;i<ss.size();i++) {
        if(temp==ss[i]){
            flg=true;
            ans=ss.size()+1;
        }
    }
    if(flg){
        break;
    }else{
        ss.push_back(temp);
    }

    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
#include<algorithm>
using namespace std;

#define debug(x) cout << #x << " = " << x << endl
#define lowbit(x) (x & (-x))

typedef long long LL;
typedef pair<int, int>PII;
const int maxn = 1e5 + 10;
const int inf = 0xfffffff;
const double pi = acos(-1);

int a[maxn];

int main()
{
	int n, k;
	int Min = 1e9 + 10;
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	sort(a + 1, a + 1 + n);
	for(int i = 1; i + k - 1 <= n; i++) Min = min(Min, a[i + k - 1] - a[i]);
	printf("%d\n", Min);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll a[225816];

int main(void){
	int n,k,i;
	std::cin >> n >> k;
	for(i=0; i<n; ++i){
		std::cin >> a[i];
	}
	for(i=k; i<n; ++i){
		std::cout << ((a[i]>a[i-k])?"Yes":"No") << std::endl; 
	}
	return 0;
}


Measured memory_bytes: 5156
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
public class Main  
{ 
    public static void main(String[] args) throws IOException  
    { 
        //Enter data using BufferReader 
        BufferedReader reader =  
                   new BufferedReader(new InputStreamReader(System.in)); 
         
        // Reading data using readLine 
        String s =reader.readLine();
      //System.out.println(s.toLowerCase());
      s=s.toLowerCase();
     //if(s.charAt(s.length()-1)=='s')
     if(s.lastIndexOf('s')==s.length()-1)
       s=s+"es";
       // System.out.println(s.lastIndexOf('s')==s.length()-1);
       // System.out.println(s.lastIndexOf('s'));
            //System.out.println(s.length()-1);
     else
       s=s+"s";
      // System.out.println(s.charAt(s.length()-1)); 
      System.out.println(s);
    }
}

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

int min(int a, int b) {
    if(a < b) {
        return a;
    }
    else {
        return b;
    }
}

int main(void){
    int W, a, b;
    scanf("%d %d %d", &W, &a, &b);
    if(a <= b) {
        if(b <= a+W) {
            printf("0\n");
            return 0;
        }
    }
    else{
        if(a <= b+W) {
            printf("0\n");
            return 0;
        }
    }
    printf("%d\n", min(abs(b+W-a), abs(a+W-b)));
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Map<String ,Integer> M = new HashMap<>();
        
        int N = sc.nextInt();
        
        for(int i=0;i<N;i++){
            int q = sc.nextInt();
            
            if(q == 0){
                M.put(sc.next(),sc.nextInt());
            }else if(q == 1){
                String str = sc.next();
                if(M.get(str) == null){
                	System.out.println(0);
                }else{
                    System.out.println(M.get(str));
                }
            }else{
                M.remove(sc.next());
            }
        }
    }
}


Measured memory_bytes: 193920
#include<iostream>
#include<vector>
#define _USE_MATH_DEFINES
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
#define Rep(i,n) for(int i = 0;i < (n);i++)	
typedef long long ll;

int gcd(int a, int b) { if (b == 0)  return a;  else  return gcd(b, a % b);  }
int lcm(int a, int b) { return a * b / gcd(a, b); }
void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }
int ncr(int n, int r) { int a = 1; Rep(i, r) a = (a * (n - i)) / (i + 1); return a; }
int npr(int n, int r) { int a = 1; Rep(i, r) a *= n - i; return a; }
int mod(int a, int b) { return a % b; }


int floot(double a, double b) { return a / b; }



int main() {
	int n,m;
	std::vector<ll> H;
	std::vector<int>flag;
	std::vector<int> A;
	std::vector<int>B;
	int ans = 0;
	std::cin >> n >> m;
	Rep(i, n) {
		ll _h;
		std::cin >> _h;
		H.emplace_back(_h);
		flag.emplace_back(1);
	}
	Rep(i, m) {
		int a, b;
		std::cin >> a >> b;
		a--;
		b--;
		if (H[a] > H[b]) {
			flag[b] = 0;
		}
		else if (H[a] < H[b]) {
			flag[a] = 0;
		}
		else {
			flag[a] = 0;
			flag[b] = 0;
		}
	}
	Rep(i, n) {
		ans += flag[i];
	}
	std::cout << ans << std::endl;
	return 0;

}

Measured memory_bytes: 4956
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)

n,m,x = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(n)]

def dfs(asum, b):
    global n, m, x
    rst = 10 ** 8
    if b == n:
        if all(asum[i] >= x for i in range(1, m + 1)):
            rst = asum[0]
    else:
        rst = min(rst, dfs(asum, b+1))
        asum2 = tuple(asum[i] + c[b][i] for i in range(m + 1))
        rst = min(rst, dfs(asum2, b+1))

    return rst

rst = dfs(tuple([0] * (m + 1)), 0)
ans = rst if rst < 10 ** 8 else -1
print(ans)

Measured memory_bytes: 9324
def main():
    N, K  = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()


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

int main() {
    int n, r;
    int ret;

    cin >> n >> r;

    if (n >= 10) {
        ret = r;
    } else {
        ret = ((10 - n) * 100) + r;
    }

    cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 4000000000000000000
int dx8[8]={-1,0,1,1,1,0,-1,-1};
int dy8[8]={1,1,1,0,-1,-1,-1,0};
int dx4[4]={-1,0,1,0};
int dy4[4]={0,-1,0,1};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int uni[100010];
int root(int a){
    if(uni[a]<0)return a;
    return uni[a]=root(uni[a]); 
}
bool connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return false;
    if(uni[a]>uni[b]){
        swap(a,b);
    }
    uni[a]=uni[a]+uni[b];
    uni[b]=a;
    return true;
}
signed main(void){
    int a,b;cin>>a>>b;
    cout<<a/gcd(a,b)*b<<endl;
}
        


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long LL;

int main() {
	int n;
	while (cin >> n && n) {
		vector<LL> v;
		map<LL, LL> m;
		LL no, price, amount;
		int na = 1;
		for (int i = 0; i < n; i++) {
			cin >> no >> price >> amount;
			if (m.find(no) != m.end())
				m[no] += price * amount;
			else {
				m[no] = price * amount;
				v.push_back(no);
			}
		}
		vector<LL>::iterator it = v.begin();
		while (it != v.end()) {
			if (m[*it] >= 1000000) {
				cout << *it << endl;
				na = 0;
			}
			it++;
		}
		if (na)
			cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1288
### constant

MAX_H = 1000

### main

loop do
  n, m, a = gets.split.map(&:to_i)
  #p [n, m, a]
  break if n == 0

  hls = Array.new(n + 1){Array.new(MAX_H + 1){0}}
  maxh = 0
  
  m.times do
    h, pi, qi = gets.split.map(&:to_i)
    #p [h, pi, qi]

    hls[pi][h] = qi
    hls[qi][h] = pi
    maxh = h if maxh < h
  end

  x = a
  y = maxh

  while y >= 1
    x = hls[x][y] if hls[x][y] > 0
    y -= 1
  end

  puts x
end

Measured memory_bytes: 9188
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, H, M = map(int, input().split())

theta = abs(30 * H + 0.5 * M - 6 * M)
if theta > 180:
    theta = 360 - theta

import math
ans = (A**2) + (B**2) - (2 * A * B * math.cos(math.radians(theta)))
ans = math.sqrt(ans)
print(ans)

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

int main(){
  int k,s[31];

  for(int i=0;i<=30;i++) s[i]=0;

  for(int j=0;j<28;j++){
    cin>> k;
    s[k]=1;
  }

  for(int m=1;m<=30;m++){
    if(s[m]==0){
      cout <<m<<endl;
    }
  }
 
}

Measured memory_bytes: 1164