akhauriyash/Code-Regression huggingface dataset:
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int n, m, x;
int c[20], a[20][20], vis[20], ans=INT_MAX;
int cnt[20];
void dfs(int res, int pos)
{
      if (res>=ans) return ;
      int flag=1;
      _for(i,1,m+1){
            if (cnt[i]<x){
                  flag=0;
                  break;
            }
      }
      if (flag){ans=min(ans,res);return;}
      _for(i,pos+1,n+1){
            if (vis[i]==0){
                  _for(j,1,m+1)cnt[j]+=a[i][j];
                  vis[i]=1;
                  dfs(c[i]+res, i);
                  vis[i]=0;
                  _for(j,1,m+1)cnt[j]-=a[i][j];
            }
      }
}
int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	 cin >> n >> m >> x;
      _for(i,1,n+1){
            cin >> c[i];
            _for(j,1,m+1)cin>>a[i][j];
      }
      dfs(0, 0);
      if (ans==INT_MAX) cout << -1 << endl;
      else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3656
#A
"""
a,b = map(int, input().split())
if b % a == 0:
    print(b + a)
else:
    print(b-a)
"""

#B
"""
n, m = map(int, input().split())
ans = list(map(int, input().split()))
del ans[0]
ans = set(ans)
for i in range(n-1):
    a = list(map(int, input().split()))
    del a[0]
    ans = ans & set(a)
print(len(ans))
"""


#C
"""
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))
"""

#D
n,m = map(int, input().split())
a = list(map(int, input().split()))
num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
ans = [-float("inf") for _ in range(n + 1)]
num_ans = []
a.sort(reverse=True)
for i in a:
    num_ans.append(num[i])
ans[0] = 0
for i in range(n + 1):
    for b in num_ans:
        if i - b >= 0:
            ans[i] = max(ans[i - b] + 1, ans[i])
anse = ""
while ans[n] > 0:
    for k, i in enumerate(num_ans):
        if n - i >= 0:
            
            if ans[n] - 1 == ans[n - i]:
                anse += str(a[k])
                n -= i
                break
    if n < 0:
        break
            
print(anse)

Measured memory_bytes: 3316
#include <stdio.h>

int t[1000000];
int main(void)
{
	int n, i, j, small, large;	
	
	for (i = 2; i * i <= 1000000; i++){
		if (t[i] == 0){
			for (j = 2 * i; j <= 1000000; j++){
				if (j % i == 0){
					t[j] = 1;
				}
			}
		}
	}
	
	while (scanf("%d", &n) != EOF){
		small = large = 0;
		
		for (i = n - 1; i > 1; i--){
			if (t[i] == 0){
				small = i;
				break;
			}
		}
		for (i = n + 1; i <= 1000000 ; i++){
			if (t[i] == 0){
				large = i;
				break;
			}
		}
		printf("%d %d\n", small, large);
	}
	
	return 0;
}

Measured memory_bytes: 4500
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);
	
	int i, j, k, prime[10000] = {};
	for (i = 2, k = 0; i <= 55555; i++) {
		for (j = 0; j < k; j++) if (i % prime[j] == 0) break;
		if (j == k) prime[k++] = i;
	}
	
	int ans[55];
	for (i = 0, j = 0; i < k && j < N; i++) if (prime[i] % 5 == 1) ans[j++] = prime[i];
	for (i = 0; i < N - 1; i++) printf("%d ", ans[i]);
	printf("%d\n", ans[N-1]);
	fflush(stdout);
	return 0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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 gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  vector<ll> C(N), S(N), F(N); rep(i, N - 1) cin >> C[i] >> S[i] >> F[i];
  rep(i, N - 1) {
    ll t = 0;
    for(ll j = i; j < N - 1; j++) {
      ll ls = (((t - 1) / F[j]) + 1) * F[j];
      //      cerr << "   " << ls << " " << S[j] << endl;
      ls = max(ls, S[j]);
      t = ls + C[j];
      //      cerr << i << ":" << j << " ls:" << ls << " t:" << t  << endl; 
    }
    cout << t << endl;
  }
  cout << 0 << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3748
s = list(input())

sf = []
sb = []
for i in range(len(s)):
  if i % 2 == 0:
    sf.append("1")
    sb.append("0")
  else:
    sf.append("0")
    sb.append("1")
    
cntf = 0
cntb = 0
for i in range(len(s)):
  if sf[i] != s[i]:
    cntf += 1
  if sb[i] != s[i]:
    cntb += 1
print(min(cntf, cntb))

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

int main() {
  double W,H,x,y,ans;
  cin>>W>>H>>x>>y;
  int a;
  ans=W*H/2;
  if(W/2==x&&H/2==y){
    a=1;
  }
  else{
    a=0;
  }
  cout<<ans<<" "<<a<<endl;
}

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

const ll INF = 2e+18;

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = INF;

    ans = min(ans, abs((a/2*2-a)*b*c));
    ans = min(ans, abs(a*(b/2*2-b)*c));
    ans = min(ans, abs(a*b*(c/2*2-c)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int n;
set<string> s;
string str[105];
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>str[i],s.insert(str[i]);
    if(s.size()!=n){
        cout<<"No";
        return 0;
    }
    for(int i=1;i<n;i++){
        if(str[i][str[i].length()-1]!=str[i+1][0]){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}



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

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner kb=new Scanner(System.in);
		int a=kb.nextInt(),b=kb.nextInt(),
				c=kb.nextInt();
		if(a<b&&b<c&&a<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		kb.close();
	}

}

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

const int maxn = 10000;
int row[maxn], col[maxn];

int main()
{
//    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    //freopen("B1.txt","r",stdin);
    int n, m, t, p;
    while( scanf("%d%d%d%d",&n,&m,&t,&p) && n )
    {
        memset(row,0,sizeof(row)), memset(col,0,sizeof(col));
        for(int i = 0; i < n; ++i)
            col[i] = 1;
        for(int i = 0; i < m; ++i)
            row[i] = 1;

        int tx = 0, ty = 0;
        int d, c;
        for(int i = 0; i < t; ++i)
        {
            scanf("%d%d",&d,&c);

            if(d == 1)
            {

                for(int j = tx + c; j < tx + 2 * c; ++j)
                    col[j] += col[2*tx+2*c-1-j];
                tx += c;
            }
            else//向下翻折
            {

                for(int j = ty + c; j < ty + 2 * c; ++j)
                    row[j] += row[2*ty+2*c-1-j];
                ty += c;
            }
        }

        int x, y;
        for(int i = 0; i < p; ++i)
        {
            scanf("%d%d",&x,&y);
            printf("%d\n",row[ty+y] * col[tx+x]);
        }
    }
    return 0;
}



Measured memory_bytes: 3304
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	ll n; cin >> n;
	vll cap(5);
	rep(i,5) cin >> cap[i];
	ll mn = LL_INF;
	rep(i,5) mn = min(mn,cap[i]);
	ll ans = (n+mn-1)/mn + 4;
	cout << ans << endl;

}




Measured memory_bytes: 256
# バブルソート

def bubbleSort(array)
  sorted = false
  i = 0
  count = 0
  until sorted
    sorted = true
    (array.length - 1).step(i + 1, -1).each do |j|
      print "i: #{i}, j: #{j}, array: " if $debug
      p array if $debug
      if array[j] < array[j-1]
        smaller, larger = array[j], array[j-1]
        array[j-1], array[j] = smaller, larger
        count += 1
        sorted = false
      end
    end
    i += 1
  end
  [count, array]
end

$debug = false
_n = gets.to_i
array = gets.split.map(&:to_i)
count, array = bubbleSort(array)
puts array.join(" ")
puts count



Measured memory_bytes: 6876
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

int main() {
  long long int n;
  cin >> n;
  
  vector<long long int> a(n);
  
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  sort(a.begin(), a.end());
  
  long long int ans = a[0];
  
  priority_queue<long long int, vector<long long int>, greater<long long int> > pq;
  pq.push(ans);
  for (long long int i = 1; i < n; i++) {
    if (a[i] % ans != 0) {
     pq.push(a[i] % ans);
    }
  }
  
  while (pq.size() > 1) {
    ans = pq.top();
    pq.pop();
    priority_queue<long long int, vector<long long int>, greater<long long int> > pq2;
    pq2.push(ans);
    while (!pq.empty()) {
      long long int b = pq.top();
      pq.pop();
      if (b % ans != 0) {
        pq2.push(b%ans);
      }
    }
    pq = pq2;
  }
  
  ans = pq.top();
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n;
	cin >> n;
	
	int tmp = n,han = 0;
	
	while(tmp)
	{
		han += tmp%10;
		tmp /= 10;
	}
	
	if(n % han == 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int k;
    cin>>k;
    char c = s[k-1];
    REP(i,n)if(s[i] != c)s[i]='*';
    PUTS(s);
}

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


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, p;
string s, t;
ld w;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	ll X,Y,n;
	cin>>X>>Y>>n;
	pll X_range = {0,X};
	pll Y_range = {0,Y};

	for(ll i=0;i<n;i++) {
		ll X_pt, Y_pt, color;
		cin>>X_pt>>Y_pt>>color;

		switch(color) {
			case 1: {
				X_range.f = max(X_range.f, X_pt);
				break;
			}case 2: {
				X_range.s = min(X_range.s, X_pt);
				break;
			}case 3: {
				Y_range.f = max(Y_range.f, Y_pt);
				break;
			}case 4: {
				Y_range.s = min(Y_range.s, Y_pt);
				break;
			}
		}
	}

	ll area = max(0ll, max(0ll, X_range.s - X_range.f) * max(0ll, Y_range.s - Y_range.f));
	cout<< area;

}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

signed main(){
  int N; cin >> N;
  vector<int> dp(N + 1, INF);
  dp[0] = 0;
  for(int i = 0; i <= N; i++){
    for(int p6 = 1; p6 + i <= N; p6 *= 6) dp[i + p6] = min(dp[i + p6], dp[i] + 1);
    for(int p9 = 1; p9 + i <= N; p9 *= 9) dp[i + p9] = min(dp[i + p9], dp[i] + 1);
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 300000
#define INF 10000000000000000
using Graph=vector<vector<int>>;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  vector<ll> sum_o(N,0),sum_e(N,0);
  sum_o.at(0)=A.at(0);
  for(int i=2;i<N;i+=2){
    sum_o.at(i)=sum_o.at(i-2)+A.at(i);
  }
  sum_e.at(1)=A.at(1);
  for(int i=3;i<N;i+=2){
    sum_e.at(i)=sum_e.at(i-2)+A.at(i);
  }
  if(N%2==0){
    ll ans=sum_e.at(N-1);
    for(int i=0;i<N;i+=2){
      ans=max<ll>(ans,sum_o.at(i)+sum_e.at(N-1)-sum_e.at(i+1));
    }
    cout<<ans<<endl;
  }else{
    vector<vector<ll>> dp(N,vector<ll>(3,-INF));
    dp.at(0).at(2)=A.at(0);
    dp.at(1).at(1)=A.at(1);
    dp.at(2).at(0)=A.at(2);
    for(int i=0;i<N;i++){
      if(i+2<N){
        for(int j=0;j<3;j++){
          dp.at(i+2).at(j)=max<ll>(dp.at(i).at(j)+A.at(i+2),dp.at(i+2).at(j));
        }
      }
      if(i+3<N){
        for(int j=1;j<3;j++){
          dp.at(i+3).at(j-1)=max<ll>(dp.at(i).at(j)+A.at(i+3),dp.at(i+3).at(j-1));
        }
      }
      if(i+4<N){
        dp.at(i+4).at(0)=max<ll>(dp.at(i).at(2)+A.at(i+4),dp.at(i+4).at(0));
      }
    }
    ll ans=dp.at(N-1).at(0);
    ans=max<ll>(ans,dp.at(N-2).at(1));
    ans=max<ll>(ans,dp.at(N-3).at(2));
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 18840
x1,y1,x2,y2=map(int,input().split())
z=((x2-x1)+(y2-y1)*1j)#from 1 to 2 vector
z3=z*1j+(x2+y2*1j)#counter clockwise 90 degree
z4=z*1j+(x1+y1*1j)#counter clockwise 90 degree
x3,y3=int(z3.real),int(z3.imag)
x4,y4=int(z4.real),int(z4.imag)
print(x3,y3,x4,y4)


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

typedef long long ll;
typedef long double Double;
#define rep(i,n) for(int i = 0; i < (int)(n) ; i++)

// chmax, chmin
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;
}


void solve(long long X, long long Y){
    long long ans = 0;
    if( X <= 3) ans += 400000 - X * 100000;
    if( Y <= 3) ans += 400000 - Y * 100000;
    if( X == 1 && Y == 1 ) ans += 400000;
    cout << ans << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(X, Y);
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int mod=1000000007;
string s;
int n;
ll dp[100001][13];
int main(){
    cin>>s;
    n=s.size();
    dp[0][0]=1;
    rep(i,n){
        if(s[i]=='?'){
            rep(j,13){
                rep(k,10){
                    dp[i+1][(j*10+k)%13]+=dp[i][j];
                    dp[i+1][(j*10+k)%13]%=mod;
                }
            }
        }
        else{
            rep(j,13){
                dp[i+1][(j*10+(s[i]-'0'))%13]+=dp[i][j];
                dp[i+1][(j*10+(s[i]-'0'))%13]%=mod;
            }
        }
    }
    cout<<dp[n][5]<<endl;
    return 0;
}


Measured memory_bytes: 10624
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cmath>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;


class BinaryIndexedTree {
   int N;
   VI tree;
public:
   BinaryIndexedTree(int _N) : N(_N), tree(VI(_N+1)) {}
   int get_cumfreq(int idx) {
      int sum = 0;
      for (; idx > 0; idx -= (idx & -idx))
         sum += tree[idx];
      return sum;
   }

   void update(int idx, int val = 1) {
      for (; idx <= N; idx += (idx & -idx))
         tree[idx] += val;
   }
};

struct Event {
   int a, b;
   int pos, key;
   Event(int _a = 0, int _b = -1, int _pos = 0) :
      a(_a), b(_b), pos(_pos), key(_b < 0 ? _pos : b) {}
   bool operator<(const Event& e) const {
//    return key < e.key;
      if (key != e.key) return key < e.key;
      if ((b < 0) ^ (e.b < 0))
         return b < 0;
      return a < e.a;
   }
};

int N, Q;
vector<Event> events;
VI ans;

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   cin >> N >> Q;
   for (int i = 0; i < N; ++i) {
      int a;
      cin >> a;
      events.push_back( Event(a, -1, i+1) );
   }

   for (int i = 0; i < Q; ++i) {
      int a, b;
      cin >> a >> b;
      events.push_back( Event(a, b, i+1) );
   }

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

   BinaryIndexedTree bit(N);
   VI last_pos(N+1);
   VI ans(Q);
   for (Event e : events) {
      if (e.b < 0) {
         int a = e.a;
         if (last_pos[a] > 0)
            bit.update(last_pos[a], -1);
         bit.update(e.pos, +1);
         last_pos[a] = e.pos;
      }
      else {
         ans[ e.pos-1 ] = bit.get_cumfreq(e.b) -
                                  bit.get_cumfreq(e.a-1);
      }
   }

   for (int i = 0; i < Q; ++i)
      cout << ans[i] << '\n';

   return 0;
}


Measured memory_bytes: 25224
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N];
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b){
        if(a==c){
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }else if(a==c){
        cout << "Yes\n";
    }else{
        if(b==c){
            cout <<"Yes\n";
        }else{
            cout <<"No\n";
        }
    }


    return 0;
}

Measured memory_bytes: 384
/*
ID: seekho
PROG: friday
LANG: C++14                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
const int N = 100005;

int n;
int cost[N];
int ans[N];

int go(int i) {
	if(i == n-1)
		return 0;
	if(ans[i] != -1) return ans[i];

	ans[i] = go(i+1) + abs(cost[i+1]-cost[i]);
	if(i+2 <= n-1)
		ans[i] = min(ans[i],go(i+2) + abs(cost[i+2]-cost[i]));

	return ans[i];
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
    cin >> n;
    rep(i,n) {
    	cin >> cost[i];
    	ans[i] = -1;
    }

    cout << go(0) << '\n';
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;

using Edge = pair<int, int>;

int getRoot(const int n, const vector<Edge>& edges) {
  set<int> rootie;
  for (int i = 0; i < n; ++i)
    rootie.insert(i);
  for (auto& e : edges)
    rootie.erase(e.second);
  return *rootie.begin();
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<Edge> edges;
  for (int i = 0; i < n + m - 1; ++i) {
    int u, v;
    cin >> u >> v;
    edges.emplace_back(u - 1, v - 1);
  }
  const int root = getRoot(n, edges);

  vector<vector<int>> children(n);
  vector<set<int>> parents(n);
  for (auto& e : edges) {
    children[e.first].push_back(e.second);
    parents[e.second].insert(e.first);
  }

  vector<int> parent(n, -2);
  queue<int> q;
  q.push(root);
  parent[root] = -1;
  while (!q.empty()) {
    int p = q.front();
    for (int c : children[p]) {
      if (parents[c].size() == 1) {
        parent[c] = p;
        q.push(c);
      } else {
        parents[c].erase(p);
      }
    }
    children[p].clear();
    q.pop();
  }

  for (int p : parent)
    cout << (p + 1) << "\n";

  return 0;
}


Measured memory_bytes: 16884
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N;

void solve() {

	cin >> N;

	set<pii> ans;

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i == j || (N % 2 == 0 && i + j == N + 1) || (N % 2 == 1 && i + j == N)) continue;
			int a = i, b = j;
			if (a > b) swap(a, b);
			ans.emplace(a, b);
		}
	}

	cout << ans.size() << endl;
	for (auto &o : ans) {
		cout << o.fst << " " << o.scd << endl;
	}

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


vector<pair<ll,int>> vectorCnt(vector<ll> a) {
    sort(a.begin(),a.end());
    int n=a.size();
    vector<pair<ll,int>> b;
    int cnt=1;
    rep(i,n-1) {
            if (a[i+1]!=a[i]) {
                b.push_back(make_pair(a[i],cnt));
                cnt=1;
            } else {
                ++cnt;
            }
    }
    b.push_back(make_pair(a[n-1],cnt));
    return b;
}

int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
        a[i]-=i;
    }
    vector<pair<ll,int>> p=vectorCnt(a);
    sort(p.begin(),p.end());
    vector<ll> c(p.size());
    rep(i,p.size()) c[i]=p[i].first;
    ll ans=0;
    rep(i,n) {
        ll k=-2*i-a[i];
        int j=lower_bound(c.begin(),c.end(),k)-c.begin();
        if (c[j]==k) {
            ans+=p[j].second;
        }
        int jj=lower_bound(c.begin(),c.end(),a[i])-c.begin();
        --p[jj].second;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10528
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(a[k-1])

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a1[n];
    for (int i = 0; i < n; i++) cin >> a1[i];
    int a2[n];
    for (int i = 0; i < n; i++) cin >> a2[i];
    int res = 0;
    for (int i = 0; i < n; i++) {
        int t1 = accumulate(a1, a1 + i + 1, 0);
        int t2 = accumulate(a2 + i, a2 + n, 0);
        res = max(res, t1 + t2);
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define repp(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define popcnt __builtin_popcount
#define all(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
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> T gcd(T a, T b){return b?GCD(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/GCD(a,b);}

int main(){
    long double a,b,c; cin >> a >> b >> c;

    if(sqrt(a/c) + sqrt(b/c) < 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N + 1];
    for (int i = 1; i <= N; i++) {
      a[i] = sc.nextInt();
    }
    int light = 1;
    int[] used = new int[N + 1];
    int count = 0;
    while (true) {
      if (used[light] > 0) {
        System.out.println(-1);
        return;
      }
      if (light == 2) {
        System.out.println(count);
        return;
      }
      used[light] = 1;
      light = a[light];
      count++;
    }
  }
}

Measured memory_bytes: 50692
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
void _OUT() {}; template<class H, class... T> void _OUT(H &h, T &... t) { cout<<' '<<h; _OUT(t...); };
template<class H, class... T> void _P(H &h, T &... t) { cout<<h; _OUT(t...); };
#define _PN(...) _P(__VA_ARGS__); cout << endl;
#define EXEC(...) void exec() { (__VA_ARGS__ - 1) ? multi() : solve(0); }

void exec();
void solve(int t);
void multi() { int TT; cin>>TT; REP1(t,TT) solve(t); }
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    exec();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,M;
vector<int> A(SIZE);

struct UnionFind {
    vector<int> parent;
    int size;
    UnionFind(int size) {
        reset(size);
    }
    void reset(int size) {
        this->size = size;
        parent.resize(size);
        REP(i,size) parent[i]=i;
    }
    int root(int i) {
        if (parent[i] == i) return i;
        return parent[i] = root(parent[i]);
    }
    void merge(int i, int j) {
        int ir = root(i);
        int jr = root(j);
        if (ir == jr) return;
        int next = min(ir, jr);
        int hide = (ir == next) ? jr : ir;
        parent[ir] = parent[jr] = next;
    }
    bool same(int i, int j) {
        return root(i) == root(j);
    }
};

int K,L;
void solve(int _t) {
    cin>>N>>K>>L;
    int u,v;
    auto uf0 = UnionFind(N);
    REP(i,K) {
        cin>>u>>v;
        uf0.merge(--u, --v);
    }
    auto uf1 = UnionFind(N);
    REP(i,L) {
        cin>>u>>v;
        uf1.merge(--u, --v);
    }
    map<pair<int,int>,int> M;
    REP(i,N) {
        M[{uf0.root(i),uf1.root(i)}]++;
    }
    REP(i,N) {
        out("%lld ",M[{uf0.root(i),uf1.root(i)}]);
    }
    out("\n");
}
EXEC(1)



Measured memory_bytes: 19620
from collections import deque
import sys
sys.setrecursionlimit(10**7)
N,M=map(int,input().split())
A=[]
B=[]
road=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  road[a-1].append(b-1)
  road[b-1].append(a-1)
visit=[0]*N

q=deque([0])
ans=[0]*N
visit[0]=1
def bfs(q):
  while(q):
    v=q.popleft()
    #print(v)
    for x in road[v]:
      if(visit[x]==0):
        q.append(x)
        #print(q)
        visit[x]=1
        ans[x]=v+1
        #print(x)
bfs(q)
print("Yes")
for i in range(N-1):
  print(ans[i+1])

Measured memory_bytes: 37952
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
S, T = rs().split()

ret = [0]*(len(S)+len(T))

for i in range(len(S)+len(T)):
	if i % 2 == 0:
		ret[i] = S[i//2]
	else:
		ret[i] = T[i//2]
print(''.join(ret))

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    char S[100];

    int cnt = 0;
    if (N == 0)
    {
        S[0] = '0';
        cnt++;
    }
    else
    {
        while(N != 0)
        {
            if (abs(N) % 2 == 1) S[cnt] = '1';
            else S[cnt] = '0';

            if (N < 0) N = (N - 1) / (-2);
            else N = N / (-2);

            cnt++;
        }
    }

    for (int i = cnt - 1; i >= 0; --i) cout << S[i];
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

//?´??????°????§£?????????????????°??????
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = Long.parseLong(sc.nextLine());
		System.out.print(n + ":");
		for (int i = 2; n >= i * i;) {
			if (n % i == 0) {
				n = n / i;
				System.out.print(" " + i);
			} else {
				i++;
			}
		}
		System.out.println(" " + n);
	}

}

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

def post_order(id, list):
    if id > -1:
        post_order(node_dic[id].left, list)
        post_order(node_dic[id].right, list)
        list.append(id)

def gen_tree(root):
    i = iol.index(root)
    iol[i] = 0
    if iol[i-1] != 0:
        glt(root)
    if iol[i+1] != 0:
        grt(root)

def glt(root): #generate_left_tree
    global p
    p += 1
    tmp = p
    i = iol.index(pol[p])
    gen_tree(pol[p])
    node_dic[root].left = pol[tmp]

def grt(root): #generate_right_tree
    global p
    p += 1
    tmp = p
    i = iol.index(pol[p])
    gen_tree(pol[p])
    node_dic[root].right = pol[tmp]

class Node_Class():
    def __init__(self, left, right):
        self.left = left
        self.right = right

n = int(raw_input())
node_dic = {}
for i in range(1, n+1):
    node_dic[i] = Node_Class(-1, -1)
pol = map(int, raw_input().split()) #pre_order_list
iol = map(int, raw_input().split()) #in_order_list
iol.insert(n, 0)
iol.insert(0, 0)
p = 0
gen_tree(pol[p])
root = 0
for i in range(1, n+1):
    root += i
for i in range(1, n+1):
    left = node_dic[i].left
    right = node_dic[i].right
    if left > -1:
        root -= left
    if right > -1:
        root -= right
A = []
post_order(root, A)
print  " ".join(map(str, A))

Measured memory_bytes: 6492
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(a) cerr << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define forr(i, st, en) for(int i = st; i <= en; i++)
#define all(v) (v).begin(),(v).end()
#define X first
#define Y second
#define pb push_back
#define fast cin.tie(0); ios::sync_with_stdio(false)
#define vi vector<int>
#define vii vector<vector<int>>

int32_t main(){ fast;
	double d, s, t; cin>>d>>t>>s;
	if(d / s > t){
		puts("No");
	}
	else puts("Yes");
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

ll a, v, w, b, t;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> a >> v >> b >> w >> t;

	if (a < b) {
		if (a + v * t >= b + w * t) cout << "YES" << endl;
		else cout << "NO" << endl;
	} else {
		if (a - v * t <= b - w * t) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 3688
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int N,Q;
typedef pair<unsigned int,pair<unsigned int,string> > P;
vector<P> que;
int main(){
	while(cin>>N>>Q,N||Q){
		que.clear();
		unsigned int A[1010]={0};
		for(int i = 0;i < 1010;i++){
			A[i] = 0;
		}

		for(int i = 0;i < N;i++){
			string str;
			unsigned int eray,wesy;
			cin>>str>>eray>>wesy;
			que.push_back(P(wesy,mp(eray,str)));
			A[i] = wesy;
		}
		sort(que.begin(),que.end());
		sort(A,A+N);
		for(int i = 0;i<Q;i++){
			unsigned wes;
			cin>>wes;
			bool flag =true;
			//cout<<que[k].first-wes<<endl;
			rep(j,N){
				if(wes>que[j].first-que[j].second.first&&wes<=que[j].first){
					cout <<que[j].second.second<<" "<<wes-que[j].first+que[j].second.first<<endl;
					flag = false;
					break;
				}
			}
			if(flag){
				cout <<"Unknown"<<endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1320
using System;
using System.Linq;

namespace id_0004
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while((line = Console.ReadLine()) != null)
            {
                double[] coefficients = line.Trim().Split(' ').Select(a => double.Parse(a)).ToArray();
                double x = Math.Round((coefficients[2] * coefficients[4] - coefficients[1] * coefficients[5]) / (coefficients[0] * coefficients[4] - coefficients[1] * coefficients[3]),3,MidpointRounding.AwayFromZero);
                double y = Math.Round((coefficients[0] * coefficients[5] - coefficients[2] * coefficients[3]) / (coefficients[0] * coefficients[4] - coefficients[1] * coefficients[3]),3,MidpointRounding.AwayFromZero);
                Console.WriteLine("{0:f3} {1:f3}", x,y);
            }
        }
    }
}



Measured memory_bytes: 10012
#include<bits/stdc++.h>
using namespace std;
long long n,a[3001],dp[3001][3001];
int main()
{
    cin >> n;
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
          	if(i + j - 1 > n) break;
            if(i == 1) dp[i][j] = a[j];
            else if(i == 2) dp[i][j] = abs(a[j]-a[j+1]);
            else
            {
                int l = j;
                int r = i + j - 1;
                long long t1 = a[r] - dp[i-1][j];
                long long t2 = a[l] - dp[i-1][j+1];
                dp[i][j] = max(t1,t2);
            }
        }
    }
    cout << dp[n][1];
}

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

int N;
string S;
bool same = true;

int main(){
  cin >> N >> S;
  if(N % 2 != 0) same = false;
  else {
    for(int i = 0; i < N/2; i++){
      if(S[i] != S[i+N/2]){
        same = false;
        break;
      }
    }
  }
  if(same) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int p[N];
  REP(i,N)cin>>p[i];
  sort(p,p+N);
  p[N-1]/=2;
  int ans=0;
  REP(i,N)ans+=p[i];
  cout<<ans<<endl;
  return 0;
}


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


int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}

int main() {
	int n = ri(), m = ri();
	std::pair<int, int> a[n];
	// second : until
	for (int i = 0; i < n; i++) a[i].first = m - ri(), a[i].second = ri();
	std::sort(a, a + n, std::greater<>());
	std::multiset<int, std::greater<int> > possible;
	int head = 0;
	int64_t res = 0;
	for (int i = m - 1; i >= 0; i--) {
		while (head < n && a[head].first >= i) possible.insert(a[head].second), head++;
		if (possible.size()) {
			res += *possible.begin();
			possible.erase(possible.begin());
		}
	}
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 5632
import math

def calc(N):
    ans = N

    v2 = int(math.sqrt(N))
    if N == v2 * v2:
        ans = v2 
    else:
        v3 = v2 + 1
        for v in range(2, v3):
            div = int(N / v)
            if div * v == N:
                rc = max(v, div)
                if rc < ans:
                    ans = rc

    return ans


N = int(input())
v = calc(N)
print(len(str(v)))



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    int n,k;
    cin>>n>>k;

    map<int,int> p;

    while(k--)
    {
        int d;
        cin>>d;

        while(d--)
        {
            int v;
            cin>>v;
            p[v]++;
        }
    }

    cout<<n-p.size()<<endl;

}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

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

typedef long long ll;

vector<ll> s;

bool check(ll k,int n){
    int left=0,right = n;
    while(right-left>1){
        int mid = (left + right)/2;
        if(s[mid]>k){
            right = mid;
        }else{
            left = mid;
        }
    }
    if(s[left] == k)return true;
    else return false;
}

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a;
    for(int i=0;i<n;i++){
        cin >> a;
        s.push_back(a);
    }
    sort(s.begin(),s.end());
    unique(s.begin(),s.end());

    int q;
    cin >> q;

    ll t,cou=0;;
    for(int i=0;i<q;i++){
        cin >> t;
        if(check(t,n))cou++;
    }
    cout << cou << endl;
}



Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void)
{
    int N, D, answer = 0;
    double tmpDouble, tmpInt, tmp = 0;
    cin >> N >> D;
    vector<vector<double>> X(N, vector<double>(D));
    for (int count = 0; count < N; count++)
    {
        for (int index = 0; index < D; index++)
        {
            cin >> X.at(count).at(index);
        }
    }
    for (int count = 0; count < N - 1; count++)
    {
        for (int index = count + 1; index < N; index++)
        {
            for (int counter = 0; counter < D; counter++)
            {
                tmp += pow(X.at(count).at(counter) - X.at(index).at(counter), 2);
            }
            tmpDouble = pow(tmp, 0.5);
            tmpInt = ceil(tmpDouble);
            if (tmpInt == tmpDouble)
            {
                answer++;
            }
            tmp = 0;
            tmpDouble = 0;
            tmpInt = 0;
        }
    }
    cout << answer << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll ans;
ll n,m;
ll a[105],b[105];
ll p[10];
bool e[10][10];
int main(void){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		e[a[i]][b[i]]=true;
		e[b[i]][a[i]]=true;
	}
	for(int i=0;i<n;i++){
		p[i]=i+1;
	}
	do{
		bool t=true;
		for(int i=0;i<n-1;i++){
			if(e[p[i]][p[i+1]]==false){
				t=false;
			}
		}
		if(t&&p[0]==1) ans++;
	} while(next_permutation(p,p+n));
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,s=0,t=0;
    string c;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            s++;
        if(a[i]%3==0||a[i]%5==0)
        {
            t++;
        }
    }}
    if(s==t)
    {
        cout<<"APPROVED";
    }
    else{
        cout<<"DENIED";
    }
}


Measured memory_bytes: 256