akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define int llong
#define be(x) x.begin(), x.end()
typedef pair<int, int> P;


signed main(){
	int N, M;
	int eat[31] = {};
	int k;

	cin >> N >> M;
	for(int i = 0; i < N; i++){
		cin >> k;
		int in;
		for(int j = 0; j < k; j++){
			cin >> in;
			eat[in]++;
		}
	}

	int ans = 0;
	for(int i = 0; i <= M; i++){
		if(eat[i] == N)
			ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
e = gcd(c,d)
f = c * d // e

b_c = b // c
s_c = (a-1) // c
C = b_c - s_c

b_d = b // d
s_d = (a-1) // d
D = b_d - s_d

b_cd = b // f
s_cd = (a-1) // f
CD = b_cd - s_cd

ans = b - a + 1 - (C + D - CD)
print(ans)

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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

int cost(vector<bool>& vec, int l, int r) {
    int cnt = 0;
    FOR (i, l, r + 1)
        cnt += vec[i];
    return cnt;
}

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

    int N, M, X, tmp;
    cin >> N >> M >> X;
    vector<bool> vec(N + 1);
    rep (i, M) {
        cin >> tmp;
        vec[tmp] = true;
    }

    print(min(cost(vec, 0, X), cost(vec, X, N)));

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>

int main(){
    
    long K;
  std::cin >> K;
  for(long i=0; i<K; i++){
    std::cout << "ACL";
  }
  std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 3516
while True:
	try:
		ans = 0
		n = int(raw_input())
		for i in xrange(10):
			for j in xrange(10):
				for k in xrange(10):
					for l in xrange(10):
						if i+j+k+l == n:
							ans += 1
		print ans
	except EOFError:
		break

Measured memory_bytes: 4212
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, c, d; cin >> a >> b >> c >> d;
	int ans = 0;
	for( int t = 0; t <= 100; ++t ){
		if( a <= t && t < b && c <= t && t < d ) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

int main() {
  
  LL n;
  cin >> n;

  LL ans = 0;

  for (LL i=1; i<=n; i++) {
    LL num = n / i;
    LL end = num * i;
    ans += num * (i + end) / 2;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  string s;
  map<char, int> mp;
  while (getline(cin, s)) {
    for (int i = 0; i < s.length(); i++)
      mp[tolower(s[i])]++;
  }
  for (char c = 'a'; c <= 'z'; c++)
    cout << c << " : " << mp[c] << endl;
  return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,K;

void input(){
    #ifdef __LOCAL
        fs::path path_to_file = __FILE__;
        fs::path input,output;
        input = output = path_to_file.parent_path();
        input += string("/input/") + string(path_to_file.stem()) + string(".txt");
        output += string("/output/") + string(path_to_file.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> K;
}

int num_pow(int x){
    return ceil(log2((double)K/x));
}

int solve(){
    double ans=0;
    for(int i=1;i<=N;i++) {ans += (i<K)?(double)pow(0.5,num_pow(i))/N:(double)1/N;}
    cout << fixed << setprecision(10) << ans << endl;
    return 0;    
}

int main(){
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

};

int main(){
  ll q,h,s,d; cin >> q>>h>>s>>d;
  ll n; cin >> n;
  chmin(s,4*q);
  chmin(s,2*h);
  chmin(d,2*s);

  cout << (n/2LL)*d + (n%2LL)*s << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N;
	cin >> N;
	int ans = N;
	for (int i = 0; i <= N; ++i)
	{
		int t = i;
		int coin = 0;
		while (t > 0)
		{
			coin += t % 6;
			t /= 6;
		}
		t = N - i;
		while (t > 0)
		{
			coin += t % 9;
			t /= 9;
		}
		ans = min(ans, coin);
	}
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,g,b,a;
  cin >> r >> g >> b;
  a=r*100+g*10+b;
  if(a%4==0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3612
N = gets.to_i
as = gets.split.map(&:to_i)

max = as.max
min = as.min
max_i = as.find_index(max)
min_i = as.find_index(min)

operations = []

if min.abs <= max.abs
    N.times do |i|
        next if i == max_i
        operations.push([max_i, i])
    end
    (N - 1).times do |i|
        operations.push([i, i + 1])
    end
else
    N.times do |i|
        next if i == min_i
        operations.push([min_i, i])
    end
    (N - 1).times do |i|
        operations.push([N - 1 - i, N - 2 - i])
    end
end

print operations.length, "\n"
operations.each do |op|
    print op[0] + 1, ' ', op[1] + 1, "\n"
end

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

#define all(v)   v.begin(), v.end()
#define endl "\n";
#define pb push_back
#define F first
#define S second
#define JULEE_DO_THE_THING fast()
#define to_str to_string
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMIN INT_MIN
#define IMAX INT_MAX
#define pow POW

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef string str;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef pair<int, int> pii;

void fast() {
	cin.tie(0);
	cout.tie(0);
	cin.sync_with_stdio(0);
}

bool compare(int &a, int &b) {
	return a > b;
}

ll numOfDigits(ll n) {
	if (!n)
		return 1;
	return (ll) (log10(n)) + 1;
}

ull POW(ll a, ll b);

/*

*/

ll BN();

int main() {
	JULEE_DO_THE_THING;
	//freopen("test cases\\.txt", "r", stdin) ;
    ll a, b, c; cin>>a>>b>>c;
    ll div = (b/c  - a/c);
    if(!(a%c))div++;
    cout<<div;
	return 0;
}

ll BN() {
	int low = 1;
	int up = 0;
	int ans = -1;
	while (low <= up) {
		ll mid = (((ll)low + up) / 2);
		if (mid){
			ans = mid;
			low = mid + 1;
		} else
			up = mid - 1;
	}
	return ans;
}

ull POW(ll a, ll b) {
	ull res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a;
		a = a * a;
		b >>= 1;
	}
	return res;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
ans=1
m=p[0]
for i in range(1,len(p)):
  if p[i]==1:
    ans=ans+1
    break
  elif p[i]>m:
    continue
  else:
    ans=ans+1
    m=p[i]
print(ans)

Measured memory_bytes: 24744
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
string s;
cin>>n;
cin>>s;
string ans="Yes";
if(n%2==0){
    rep(i,n/2){
     if(s[i]!=s[i+(n/2)]) ans="No";   
    }
}
else{
    ans="No";
}
cout<<ans<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
    int a;
    cin >> a;
    for (int t = 1; ; t++) {
        switch (a) {
            case 4:
            case 2:
            case 1:
                cout << t + 3 << endl;
                return 0;
            default:
                if (a % 2 == 0) {
                    a /= 2;
                } else {
                    a *= 3;
                    a += 1;
                }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
	int i,j,h,w,n;
	char a[110][110];
int main()
{	
	cin>>h>>w;
	for(i=1;i<=h;i++)
		for(j=1;j<=w;j++)
			cin>>a[i][j];
	for(i=1;i<=h;i++)
		for(j=1;j<=w;j++)
			if(a[i][j]=='.')
			{
				n=0;
				if(a[i-1][j]=='#') n++;
				if(a[i+1][j]=='#') n++;
				if(a[i][j-1]=='#') n++;
				if(a[i][j+1]=='#') n++;
				if(a[i-1][j-1]=='#') n++;
				if(a[i-1][j+1]=='#') n++;
				if(a[i+1][j-1]=='#') n++;
				if(a[i+1][j+1]=='#') n++;
				a[i][j]=char(n+48);
			}
	for(i=1;i<=h;i++)
	{
		for(j=1;j<=w;j++)
			cout<<a[i][j];
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {

	while (true) {
		VI c(3); rep(i, 3)cin >> c[i];
		if (c[0] == 0 && c[1] == 0 && c[2] == 0)break;

		sort(all(c));
		double max = hypot((double)c[0] / 2., (double)c[1] / 2.);
		
		int n; cin >> n;
		rep(i, n) {
			double r; cin >> r;
			puts(r > max ? "OK" : "NA");
		}
	}
}


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

using namespace std;
using llong = long long;
int main(){
  llong size[] = { 25,50,100,200 };
  llong val[4];
  cin >> val[0] >>val[1] >> val[2] >> val[3];
  llong n;
  cin >> n;
  n *= 100;
  llong minprice = 0;
  
  while(n!=0){
    llong min_price_per_l = 10000000000;
    llong min_i = 0;
    for(int i=0;i<4;++i){
      llong price_per_l = val[i]*100/size[i];
      if(min_price_per_l > price_per_l&&n>=size[i]){
        min_price_per_l = price_per_l;
        min_i = i;
      }
    }
    minprice += n/size[min_i]*val[min_i];
    n = n%size[min_i];
  }
  cout << minprice << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    double ans=0;
    double T,X;
    cin>>T>>X;

    Sp(T/X);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = false;
#else
const bool testing = false;
#endif

    static void program(TextReader input)
    {
        var k = int.Parse(input.ReadLine());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var res = 2;
        long minPos = 2;
        long maxPos = 2;
        for(var i = k - 1; i >= 0; i--)
        {
            var cur = data[i];
            var minI = (long)Math.Ceiling((double)minPos / cur);
            if(minI == 0)
            {
                minI++;
            }
            if(minI*cur > maxPos)
            {
                Console.WriteLine(-1);
                return;
            }
            var maxI = (maxPos / cur);
            minPos = minI * cur;
            maxPos = maxI * cur + cur - 1;
        }
        Console.WriteLine(minPos + " " + maxPos);
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("2\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("4 3\n2 1 1\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("3 9\n1 1 3\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("2147483648\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("12345678 87654321\n43043751 1000000000 53798715\n"));
        Console.WriteLine();

    }
}


Measured memory_bytes: 26588
"""
青木君は任意の整数 x

に対し、以下の操作を行うことができます。

操作: x
を x と K

の差の絶対値で置き換える。

整数 N
の初期値が与えられます。この整数に上記の操作を 0 回以上好きな回数行った時にとりうる N

の最小値を求めてください。
制約
"""
n,k=map(int,input().split())
x=n
if k==x:
    r=0
elif k>x:
    r=min(x,(k-x))
else:
    if (x-k)>=k:
        r=min(k-(x-k)%k,(x-k)%k)
    else:
        r=min(k-k%(x-k),k%(x-k))
print(r)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9+7;
const double PI = 3.14159265359;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	//ctrl + /cin>>t;
	t = 1;
	while(t--){
		string s;
		cin>>s;
		for(int i=0;i<3;i++){
			if(s[i]=='7'){
				cout<<"Yes";
				return 0;
			}
		}
		cout<<"No";
		
	}
	return 0;
}
































Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define ff first
#define ss second

using namespace std ;

long double PI = 3.14159265 ;
const int N = 2e6 + 1000 ;
long long int ans = 1 , ans1 , ans2 , ans3 ;
long long int n , p , m , h ;
long long int a[N] ;
long long int b[N] ;
long long int c[N] ;
string s , t ;
vector <long long int> v ;
vector <long long int> k ;

int main (){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin >> n >> p ;
	if(n == 1){
		cout << p ;
		return 0 ;
	}
	for(long long int i = 2 ; i * i <= p ; i++ ){
		if(p % i == 0){
			v.push_back(i);
			while(p % i ==  0){
				h++ ;
				p /= i;
			}
			k.push_back(h) ;
			h = 0;
		}
	}
	for(long long int i = 0 ; i < v.size() ; i++){
		long long int jjj = k[i] / n ;
		while(jjj --){
			ans *= v[i] ;
		}
	}
	cout << ans ;
 	return 0 ;
}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      int n;
      cin>>n;
      int a[n];
      REP(i,n)
      {
          cin>>a[i];
      }
      sort(a,a+n);
      cout<<a[n/2]-a[(n-2)/2];
  }
  return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

ll mod(ll x) {
    x %= MOD;
    if (x < 0) { x += MOD; }
    return x;
}

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

    ll n, k;
    cin >> n >> k;

    ll m = 0, M = 0;
    rep(i, 0, k) {
        m = mod(m + i);
        M = mod(M + n - i);
    }

    ll ans = 0;
    rep(i, k, n + 2) {
        ans = mod(ans + M - m + 1);
        m = mod(m + i);
        M = mod(M + n - i);
    }
    cout << ans << endl;

    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;




int main() {
    string s, t;
    cin >> s >> t;
    rep(i, sz(s)) {
        string ss = s.substr(i) + s.substr(0, i);
        if (ss == t) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    int dx, dy, nx, ny;
    dx = x2 - x1;
    dy = y2 - y1;
    nx = x2, ny = y2;
    rep(i, 2) {
      swap(dx, dy);
      dx *= -1;
      nx += dx;
      ny += dy;
      if(i == 0) {
        cout << nx << " " << ny << " ";
      } else {
        cout << nx << " " << ny << '\n';
      }
    }

    return 0;
}


Measured memory_bytes: 256
void main()
{
    long n = rdElem;

    string march = "MARCH";
    long[] list = new long[5];
    foreach (i; 0 .. n)
    {
        string s = rdStr;
        foreach (j, m; march)
        {
            if (m == s[0]) ++list[j];
        }
    }

    long result;
    foreach (i; 0 .. 3)
    {
        foreach (j; i+1 .. 4)
        {
            foreach (k; j+1 .. 5)
            {
                result += list[i] * list[j] * list[k];
            }
        }
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 1276
using System;
class Program
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int n = int.Parse(str[0]);
        string[] s = new string[n];
        for (int i = 0; i < n; i++)
            s[i] = Console.ReadLine();
        Array.Sort(s);
        for (int i = 0; i < n; i++)
            Console.Write(s[i]);
        Console.WriteLine();
    }
}

Measured memory_bytes: 11360
N = int(input())
A = list(map(int,input().split()))

#A内の奇数を0にする
for i in range(len(A)):
	if A[i]%2 != 0:
		A[i] = 0
#A内偶数をチェックする
for t in range(len(A)):
	if A[t] > 0:
		if A[t]%3 == 0 or A[t]%5 == 0:
			A[t] = 0
print("APPROVED" if sum(A) == 0  else "DENIED")



Measured memory_bytes: 3060
a, b = map(int, input().split())
l = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]

if a == b:
    print("Draw")
elif l.index(a) > l.index(b):
    print("Alice")
else:
    print("Bob")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  // 水の有効な組み合わせ
  int water_mass_ans = 100 * a;
  int sugar_mass_ans = 0;
  double tmp_max_concentration = 0;

  // 水の組み合わせ
  for(int ai = 0; ai * a * 100 <= f; ai++) {
    for(int bi = 0; ai * a * 100 + bi * b * 100 <= f; bi++) {
      int water_mass = (ai * a * 100 + bi * b * 100);
      int left_mass = f - water_mass;
      int can_max_suggar_max = water_mass / 100 * e;

      // 砂糖の組み合わせ
      for(int ci = 0; ci * c <= left_mass; ci++)  {
        for(int di = 0; ci * c + di * d <= left_mass; di++) {
          int sugar_mass = ci * c + di * d ;

          if(sugar_mass <= can_max_suggar_max) {
            if((water_mass + sugar_mass) == 0) {
              continue;
            }

            double concentration = 100 * sugar_mass / (double)(water_mass + sugar_mass);

            if(concentration > tmp_max_concentration) {
              water_mass_ans = water_mass;
              sugar_mass_ans = sugar_mass;
              tmp_max_concentration = concentration;
            }
          }
        }
      }
    }
  }

  cout << water_mass_ans + sugar_mass_ans << " " << sugar_mass_ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N >> A;
  B=N % 500;
  
  if (B <= A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::{HashMap, HashSet};

fn size(parents: &mut Vec<isize>, i: isize) -> isize {
  let ii = find(parents, i) as usize;
  -1 * parents[ii]
}

fn find(parents: &mut Vec<isize>, i: isize) -> isize {
  let ii = i as usize;
  if parents[ii] < 0 {
    i
  } else {
    parents[ii] = find(parents, parents[ii]);
    parents[ii]
  }
}

fn connect(
  parents: &mut Vec<isize>,
  a: isize,
  b: isize
) -> bool {
  let mut pa = find(parents, a);
  let mut pb = find(parents, b);
  
  if pa == pb { return false }
  
  if size(parents, pa) < size(parents, pb) {
    let temp = pa;
    pa = pb;
    pb = temp;
  }
  
  let paa = pa as usize;
  let pbb = pb as usize;
  parents[paa] += parents[pbb];
  parents[pbb] = pa;
  
  true
}


fn main() {
  input! {
    n: usize,
    m: usize,
    vals: [(Isize1, Isize1);m]
  }
  
  let mut parents: Vec<isize> = vec![-1;n];
  
  for (a, b) in vals.iter() {
    connect(&mut parents, *a, *b);
  }
  for (a, b) in vals {
    connect(&mut parents, a, b);
  }
  
  let mut map: HashMap<isize, HashSet<usize>> = HashMap::new();
  for (i, v) in parents.into_iter().enumerate() {
    if v < 0 {
      let entry = map.entry(i as isize).or_insert(HashSet::new());
      entry.insert(i);
    } else {
      let entry = map.entry(v as isize).or_insert(HashSet::new());
      entry.insert(i);
    }
  }
  println!("{}", map.keys().len() - 1);
}

Measured memory_bytes: 17740
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
////////////////////

int n;
vector<ll> a;
void solve(){
	a.pb(2);
	a.pb(1);
	fi(2, n+1){
		a.pb(a[i-2] + a[i-1]);
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d",&n);

	solve();

	printf("%lld\n",a[n]);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>

using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define repe_r(i,s,n)for(int i = n;i>=s;i--)

ll a[200001] = {};
ll b[200001] = {};
ll ans[200001] = {};
int main() {
	ll n; cin >> n;
	repe(i, 1, n) cin >> a[i];

	repe_r(k, 1, n) {
		ll ball = 0;
		rep(s, 2, 200001) {
			if (k*s <= n) {
				ball += b[k*s];
			}
			else {
				break;
			}
		}

		if (ball % 2) {
			if (a[k]) {
				b[k] = 0;
			}
			else {
				b[k] = 1;
			}
		}
		else {
			if (a[k]) {
				b[k] = 1;
			}
			else {
				b[k] = 0;
			}
		}
	}

	//ans;
	ll p = 0;
	repe(i, 1, n) {
		if (b[i]) {
			ans[p++] = i;
		}
	}

	cout << p << endl;
	rep(i, 0, p) {
		cout << ans[i];
		if (i != p - 1)cout << " ";
	}

	cout << endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    rep(i, n - 1)
    {
        if (h[i] <= h[i + 1])
            ;
        else if (h[i] == h[i + 1] + 1)
            h[i + 1]++;
        else
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <climits>

int solve(int& N, int& M)
{
    int L = 0, R = INT_MAX;
    
    for(int i=0; i<M; i++)
    {
        int Lt, Rt;
        std::cin >> Lt >> Rt;
        L = std::max(Lt, L);
        R = std::min(Rt, R);
    }

    int ans = R - L + 1;

    if (ans > 0) return ans;
    else return 0;
}

int main()
{
    int N, M; std::cin >> N >> M;
    int L = 0, R = INT_MAX;

    int ans = solve(N, M);
    
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = 998244353;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);
const int N = (int)1e5 + 9;

bool isprime(ll n) {
	if (n <= 1)
		return 0;
	for (ll i = 2; i*i <= n; i++)
		if (n%i == 0)
			return false;
	return 1;
}
ll intlog(ll base, ll x) {
	return (log(x) / log(base));
}
bool prime[N];
void primee()
{

	for (int p = 2; p*p <= N; p++)
	{

		if (prime[p] == true)
		{
			for (int i = p * 2; i < N; i += p)
				prime[i] = false;
		}
	}

}
string decToBinary(ll n)
{
	string z = "";
	int i = 0;
	while (n > 0) {

		z += (n % 2) + 48;
		n = n / 2;
		i++;
	}
	reverse(all(z));
	return z;
}
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll power(ll x, int y)
{
	ll temp;
	if (y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp*temp;
}
int n, k,dp[2][100005];
vector<int> v;
int calc(int p, int kk) {
	if (kk < 0) {
		return p;
	}
	int &ret = dp[p][kk];
	if (ret != -1) return ret;
	if (!p) {
		ret = 1;
		for (int i = 0; i < n; i++)
		{
			ret = min(ret, calc(!p, kk - v[i]));
		}
	}
	else {
		ret = 0;
		for (int i = 0; i < n; i++)
		{
			ret = max(ret, calc(!p, kk - v[i]));
		}
	}
	return ret;
}
int main()
{
	let(dp, -1);
	scanf("%d %d", &n, &k);
	v.resize(n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &v[i]);
	}
	(calc(0, k)) ? cout << "Second\n" : cout << "First\n";
	return 0;
}

Measured memory_bytes: 5760
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def make_divisors2(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)

    # divisors.sort()
    return divisors

n=int(input())
l = make_divisors(n-1)
ans = len(l)

l2 = make_divisors2(n)
for i in l2[1:]:
    n1 = n
    while n1%i == 0:
        n1 = n1//i
    if n1%i == 1:
        ans += 1
print(ans)

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

int main(){
    string s; cin >> s;
    string sp = s.substr(0, 1);
    int it = 1;
    int count = 0;
    bool fl = false;
    while(it < s.size()) {
        if(fl) break;
        int le = 1;
        while(it + le <= s.size()) {
            string sc = s.substr(it,le);
            if(sc == sp && it == s.size() - 1) {
                fl = true;
                break;
            }
            if(sc == sp) le++;
            else {
                //cout << sc << endl;
                sp = sc;
                it += le;
                count++;
                break;
            }
        }
    }
    cout << count + 1 << endl;
}
   

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  ll ans=0;
  for(ll i=1;i<=N;i++) {
    ll A=N/i;
    ll count=1;
    for(ll j=0;j<A;j++) {
ans+=i*count;
      count++;
    }
  }
  
  cout<<ans<<endl;
}
  
  
  
  


Measured memory_bytes: 3596
s = input()
if s == 'SUN':
  print(7)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s == 'WED':
  print(4)
elif s == 'THU':
  print(3)
elif s == 'FRI':
  print(2)
elif s == 'SAT':
  print(1)







Measured memory_bytes: 9028
nums = input().split()
W = int(nums[0])
H = int(nums[1])
X = int(nums[2])
Y = int(nums[3])
R = int(nums[4])
if (X - R) >= 0 and (X + R) <= W:
    if (Y - R) >= 0 and (Y+ R) <= H:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 6724
import math
a,b,x=map(int,input().split())
ans = math.degrees(math.atan(2*(b-x/a**2)/a))
if ans <= math.degrees(math.atan(b/a)):
    print(max(ans,0))
else:
    ans = math.degrees(math.atan(b/(2*x/a/b)))
    print(max(ans,0))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
	using namespace std; 
	#define max(a, b) (a < b ? b : a) 
	#define min(a, b) ((a > b) ? b : a) 
	#define mod 1e9 + 7 
	#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
	#define FORL(a, b, c) for (int(a) = (b); (a) < (c); (a)++) 
	#define FORR(a, b, c) for (int(a) = (b); (a) > (c); (a)--) 
	#define INF 1000000000000000003 
	typedef long long int ll; 
	typedef vector<int> vi; 
	typedef vector<long long int> vl; 
	typedef pair<int, int> pi; 
	typedef pair<long long int, long long int> pl; 
	#define F first 
	#define S second 
	#define pb push_back 
	#define POB pop_back 
	#define mp make_pair 
	
	int main()
	 {ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	 	
	 	ll x;
	 	cin>>x;
	 	if(x<30)
	 	cout<<"No"<<endl;
	 	else
	 	cout<<"Yes"<<endl;
				
		
	return 0;
	}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int n;
	cin >> n;
	map<string, int> mp;
	string inp;
	for(int i = 0; i < n; i++){
		cin >> inp;
		mp[inp]++;
	}
	cout << "AC" << " x " << mp["AC"] << endl;
	cout << "WA" << " x " << mp["WA"] << endl;
	cout << "TLE" << " x " << mp["TLE"] << endl;
	cout << "RE" << " x " << mp["RE"] << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i =0;i<(int)(n);i++)
#define endl '\n'
typedef pair<int,int> P;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll res = 0;
    sort(a.begin(),a.end());
    for(int i=1;i<n;i++){
        res+=a[n-1-i/2];
    }
    cout << res << endl;
}

Measured memory_bytes: 3972
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#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 MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

//#define __DEBUG__
#ifdef  __DEBUG__
#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    REP(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
// pair出力
template<typename T, typename U>
ostream& operator << (ostream& os, pair<T, U>& p) {
    return os << "(" << p.first << ", " << p.second << ")";
}
// map出力
template<typename T, typename U>
ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set 出力
template<typename T>
ostream& operator << (ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#endif

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int A, B; cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    }
    else if (A >= 6) {
        cout << B / 2 << endl;
    }
    else {
        cout << 0 << endl;
    }
    getchar(); getchar();
}

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

int main() {
	int n;
	int q;
	cin >> n >> q;

	string name;
	int time;
	queue<pair<string, int>> task;
	for (int i = 0; i < n; ++i) {
		cin >> name >> time;
		task.push(make_pair(name, time));
	}
	int t = 0;
	while (!task.empty()) {
		if (task.front().second > q) {
			t += q;
			task.front().second -= q;
			pair<string, int> tmp = task.front();
			task.pop();
			task.push(tmp);
		}
		else {
			t += task.front().second;
			cout << task.front().first << " " <<t<< endl;
			task.pop();
		}
	}

	return 0;
}


Measured memory_bytes: 6296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (A*N < B) {
    cout << A*N << endl;
  }
  else if (A*N == B) {
    cout << A*N  << endl;
  }
  else if (A*N > B) {
    cout << B << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
int n, k, q;
int a[100000];
int ans[100000];
int main() {
	scanf("%d%d%d", &n, &k, &q);
	for (int i = 0; i < n; i++) {
		ans[i] = k - q;
	}
	for (int i = 0; i < q; i++) {
		scanf("%d", a + i);
		a[i]--;
	}
	for (int i = 0; i < q; i++) {
		ans[a[i]]++;
	}
	for (int i = 0; i < n; i++) {
		if (ans[i] > 0)printf("Yes\n");
		else printf("No\n");
	}
}

Measured memory_bytes: 1280
n = int(input())
d = {}
for i in range(n):
    S = input()
    d[S] = d[S]+1 if S in d else 1
L = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(*sorted([l[0] for l in L if l[1] == L[0][1]]), sep='\n')

Measured memory_bytes: 49936