akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#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;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

int main(){
  int N,K;
  cin >> N >>K;
  vector<int> a(N);
  rep(i,N){
    cin >> a[i];
  }
  vector<int> dp(K+1);
  rep(i,a[0]){
    dp[i]=0;
  }
  srep(i,a[0],K+1){
    bool flag=false;
    rep(j,N){
      if(a[j]<=i && dp[i-a[j]]==0){
        flag=true;
        break;
      }
    }
    if(flag==true){
      dp[i]=1;
    }
    else{
      dp[i]=0;
    }
  }

  if(dp[K]==1){
    printf("First\n");
  }
  else{
    printf("Second\n");
  }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

struct Node{
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

bool find(int k){
    Node *x = root, *y = NIL;
    while(x != NIL){
        y = x;
        if(x -> key > k){
            x = x -> left;
        }
        else {
            x = x -> right;
        }
        if(y -> key == k)return true;
    }
    return false;
}

void insert(int k){
    Node *y = NIL, *x = root, *z;
    z = (Node*)malloc(sizeof(Node));
    z -> key = k;
    z -> right = NIL;
    z -> left = NIL;
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x -> left;
        }
        else{
            x = x -> right;
        }
    }
    z -> parent = y;
    if(y == NIL) root = z;
    else{
        if(z -> key < y -> key){
            y -> left = z;
        }
        else{
            y -> right = z;
        }
    }
    return;
}

void inParse(Node *u){
    if(u == NIL)return;
    inParse(u -> left);
    cout << " " << u -> key;
    inParse(u -> right);
}

void preParse(Node *u){
    if(u == NIL)return;
    cout << " " << u -> key;
    preParse(u -> left);
    preParse(u -> right);
}

int main() {
    int n, x;
    string q;
    cin >> n;
    rep(i, n){
        cin >> q;
        if(q == "insert"){
            cin >> x;
            insert(x);
        }
        else if(q == "print"){
            inParse(root);
            cout << endl;
            preParse(root);
            cout << endl;
        }
        else {
            cin >> x;
            if(find(x))cout << "yes" << endl;
            else cout << "no" << endl;
        }
    }
}


Measured memory_bytes: 21760
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll, ll>
#define mii         map<pii, ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define lb          lower_bound
#define ub          upper_bound

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a + b + p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int b) {a = max(a, b); }
void self_min(int &a, int b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) { a += b; if(a >= p) a -= p;}
void self_sub(int &a, int b, int p = MOD) { a -= b; if(a < 0) a += p;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
#define N	    	500
ll a[N];
ll dp[N][N];
bool check[N][N];
ll sum[N];

ll get(int l, int r) {
    ll tmp = -1;
    if(check[l][r]) 
        return dp[l][r];

    check[l][r] = true;
    if(l == r) {
        return 0;
    }
    rep(i, l, r) {
        ll a = get(l, i);
        ll b = get(i+1, r);
        if(tmp == -1)
            tmp = a + b;
        else
            tmp = min(tmp, a + b);
    }
    ll ans = sum[r] - sum[l-1] + tmp;
    dp[l][r] = ans;
    return ans;
}

void solve(){
    ll n;
    cin>>n;
    rep(i, 1, n+1) {
        cin>>a[i];
        if(i)
            sum[i] = a[i] + sum[i-1];
        else
            sum[i] = a[i];
    }
    cout<<get(1, n)<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 2048
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    in >> a >> b;
    if (a + b >= 10) out << "error" << endl;
    else out << a+b << endl;
}


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

int main(int argc, char const *argv[])
{
	int a,b;
	cin>>a>>b;
	if (a>=13)
	{
		cout<<b<<endl;
	}
	else if (a<=5)
	{
		cout<<"0\n";
	}
	else
	{
		cout<<b/2<<endl;
	}
	return 0;
}


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

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

int main() {
	int n = ri();
	int m = ri();
	int l = -1000000000;
	int r= 1000000000;
	for (int i = 0; i < m; i++) {
		l = std::max(l, ri());
		r = std::min(r, ri());
	}
	std::cout << std::max(0, r - l + 1) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  vector<char> ans(2 * n);
  for (int i = 0; i < n; i++)
  {
    ans.at(2 * i) = s.at(i);
    ans.at(2 * i + 1) = t.at(i);
  }
  for (int i = 0; i < 2 * n; i++)
  {
    cout << ans.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
using System;

namespace _20190330_ExsaWisards2019
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, C;
            string[] line = Console.ReadLine().Split(' ');
            A = int.Parse(line[0]);
            B = int.Parse(line[1]);
            C = int.Parse(line[2]);

            if (A == B && A == C && B == C) {
                Console.Write("Yes");
            }
            else
            {
                Console.Write("No");
            }
        }
    }
}


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

int main(){
    int N,T,A,X;
    cin>>N>>T>>A;
    int res=0;
    int cc=1<<30;//30ビットシフトして巨大な数を指定
    for(int i=0;i<N;i++){
        cin>>X;
        int d=T*1000-X*6-A*1000;
        if(d<0)d=-d;
        if(cc>d)cc=d,res=i+1;
    }
    
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


signed main(){
	int K;
	cin >> K;

	cout << (K/2)*CEIL(K/2) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t h;
  cin >> h;
  int64_t n = 1;
  int64_t ans = 0;
  while(h > 0) {
    h /= 2 ;
    ans += n;
    n *= 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
#define MAX 20000000

int a, A[MAX + 1];

void maxHeapify(int i)
{
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;

    if ( l <= a && A[l] > A[i])
    {
        largest = l;
    }
    else
    {
        largest = i;
    }
    if ( r <= a && A[r] > A[largest])
    {
        largest = r;
    }

    if (largest != i)
    {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int main()
{
    scanf("%d", &a);

    for (int i = 1; i<= a; i++) cin >> A[i];

    for (int i = a / 2; i >= 1; i--) maxHeapify(i);

    for (int i = 1; i <= a; i++)
    {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
template<class T,class U>void cinpb(T &v, U n) { rep(i, n){cill(a);v.pb(a);} }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    cis(s);
    foreach(i, s){
        char c;
        c = i + n;
        if (c > 'Z'){
            c -= 26;
        }
        cout << c;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#define pi 3.141592653589
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)
#define pii pair<int,int>
using namespace std;



int main() {

	int n, d, f[101] = {}, cnt = 0;

	cin >> n;
	rep(i, 0, n) {
		cin >> d;
		if (!f[d])f[d]++;
		else cnt++;
	}
	cout << n - cnt << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        String target = st.nextToken();

        if(Character.isUpperCase(target.charAt(0))) {
            pw.println("A");
        } else {
            pw.println("a");
        }

        br.close();
        pw.close();
    }
}

Measured memory_bytes: 32856
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

pair<vector<int>, vector<int>> dijkstra(const vector<vector<P>>& graph, int n, int s){
    vector<int> d(n+1, INF);
    d[s] = 0;

    vector<int> p(n+1, -1);
    p[s] =  s;

    priority_queue<P, vector<P>, greater<P>> que;
    que.emplace(0, s);

    while(!que.empty()){
        int w = que.top().first;
        int to = que.top().second;
        que.pop();

        if(d[to] < w){
            continue;
        }

        rep(i, (int)graph[to].size()){
            int from = graph[to][i].first;
            int nw = w + graph[to][i].second;
            if(nw < d[from]){
                d[from] = nw;
                p[from] = to;
                que.emplace(nw, from);
            }
        }
    }
    return make_pair(d, p);
}

signed main(){
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<vector<P>> edgeA(n+1, vector<P>());
    vector<vector<P>> edgeB(n+1, vector<P>());

    rep(i, m){
        int u, v, a, b;
        cin >> u >> v >> a >> b;

        edgeA[u].emplace_back(v, a);
        edgeA[v].emplace_back(u, a);
        edgeB[u].emplace_back(v, b);
        edgeB[v].emplace_back(u, b);
    }

    pair<vector<int>, vector<int>> yen = dijkstra(edgeA, n, s);
    pair<vector<int>, vector<int>> snuk = dijkstra(edgeB, n, t);

    vector<int> ans(n+1, 0);
    for(int i = n; i > 0; i--){
        int money = 1e15;

        int yy = yen.first[i];
        int ss = snuk.first[i];
        money -= yy + ss;

        if(i == n){
            ans[n] = money;
            continue;
        }

        if(ans[i+1] < money){
            ans[i] = money;
            continue;
        }
        ans[i] = ans[i+1];
    }

    rep(i, n){
        cout << ans[i+1] << endl;
    }



    return 0;
}


Measured memory_bytes: 22076
#include <cstdio>
#include <cstring>
#define MAXN 105
char a[MAXN], b[MAXN];

int mycmp(char *s1, char *s2) {
	int len1 = strlen(s1);
	int len2 = strlen(s2);
	if(len1 < len2)	return -1;
	else if(len1 > len2) return 1;
	else {
		for(int i = 0; i < len1; i++)
			if(s1[i] > s2[i])	return 1;
			else if(s1[i] < s2[i])	return -1;
			else continue;
	} 
	return 0;
}

int main() {
	scanf("%s\n%s", a, b);
	if(mycmp(a, b) > 0)
		printf("GREATER\n");
	else if(mycmp(a, b) == 0)
		printf("EQUAL\n");
	else 
		printf("LESS\n");
	return 0;
} 


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	string s;
	cin>>s;
	int c = 0;
	int ans = 0;
	f(i,3){
		if(s[i]=='R')c++;
		else{
			ans = max(ans,c);
			c = 0;
		}
	}
	ans = max(ans,c);
	cout<<ans<<"\n";
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 3620
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut r#as: [u64; n],
    }

    r#as.sort();

    let prod = r#as.into_iter().fold(1, u64::saturating_mul);
    if prod > 10u64.pow(18) {
        println!("-1");
    } else {
        println!("{}", prod);
    }
}


Measured memory_bytes: 5092
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define inrange(a, x, b) (a <= x && x <= b)
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
// using namespace atcoder;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print(T x,bool cl=1){cout<<(cl?"\x1b[36m":"")<<x<<(cl?"\x1b[39m":"")<<'\n';}
template<class T> void print1d(T x,ll n=-1,bool cl=true){if(n==-1)n=x.size();rep(i,0,n){cout<<(cl?"\x1b[36m":"")<<x[i]<<(i==n-1?'\n':' ');}cout<<(cl?"\x1b[39m":"");}
template<class T> void print2d(T x,ll r=-1,ll c=-1,bool cl=1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c,cl);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N, A, B;
        cin >> N >> A >> B;
        if (even(B - A)) {
                cout << "Alice" << endl;
        } else {
                cout << "Borys" << endl;
        }
}


Measured memory_bytes: 3632
N = int(input())
K = int(input())

def keta1(n):
    s = str(n)
    return (len(s) - 1) * 9 + int(s[0])

def keta2(n):
    if n < 10:
      return 0
    s = str(n)
    cnt = [0] * 101
    for i in range(2, 101):
        cnt[i] = 9 * 9 * (i - 1)
    res = 0
    for i in range(len(s)):
        res += cnt[i]
    res += (int(s[0]) - 1) * keta1(10 ** (len(s) - 1) - 1) + keta1(int(s[1:]))
    return res

def keta3(n):
    s = str(n)
    cnt = [0] * 101
    for i in range(3, 101):
        cnt[i] = 9 * 9 * 9 * (i - 1) * (i - 2) // 2
    res = 0
    for i in range(len(s)):
        res += cnt[i]
    res += (int(s[0]) - 1) * keta2(10 ** (len(s) - 1) - 1) + keta2(int(s[1:]))
    return res

if K == 1:
    print(keta1(N))
elif K == 2:
    print(keta2(N))
elif K == 3:
    print(keta3(N))

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int A, B;
    cin >> A >> B;

    cout << max({A+B, A-B, A*B}) << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
def eGCD(a,b):
    if b==0:
        return a,1,0
    else:
        g,x,y=eGCD(b,a%b)
        return g,y,x-a//b*y

a,b=map(int,input().split())
gcd,x,y=eGCD(a,b)
print(x,y)


Measured memory_bytes: 5600
length, _, position = [int(x) for x in input().split()]
fee_stations = [int(x) for x in input().split()]
former = 0
latter = 0
#cont fee_station
for station_place in fee_stations:
    if station_place < position:
        former += 1
    else:
        latter += 1
print(min(former, latter))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main(){
  char a;
    cin >> a;
    if(a=='A') cout << 'T';
    else if(a=='G') cout << 'C';
    else if(a=='T') cout << 'A';
    else cout << 'G';


    cout << endl;

}


Measured memory_bytes: 256
S = [0 for _ in range(1000)]
A = list(input().split())
top = 0

def initialize():
  global top
  top = 0

def isEmpty():
  global top
  return top == 0

def isFull():
  global top
  return top > 1000

def push(x):
  if isFull():
    print('over flow')
  global top
  top += 1
  S[top] = x

def pop():
  if isEmpty():
    print('under flow')
  global top
  top -= 1
  return S[top+1]

for i in range(len(A)):
  if A[i] == '*':
    b = pop()
    a = pop()
    result = a * b
    push(result)
  elif A[i] == '+':
    b = pop()
    a = pop()
    result = a + b
    push(result)
  elif A[i] == '-':
    b = pop()
    a = pop()
    result = a - b
    push(result)
  else:
    push(int(A[i]))

print(S[1])



Measured memory_bytes: 5624
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RREP(i,x) for(int i=(x)-1;i>=0;i--)
#define RFOR(i,c) for(auto i=(c).rbegin();i!=(c).rend();++i)
#define ALL(container) container.begin(), container.end()
#define SZ(container) ((int)container.size())

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

string s;

vi calc(int p, int q){
	int bra = 0;
	if(s[p] == '('){
		int f = 1;
		for(int i=p+1;i<q-1;i++){
			if(s[i] == '(') bra ++;
			if(s[i] == ')') bra --;
			if(bra < 0) f = 0;
		}
		if(f) return calc(p+1, q-1);
	}else{
		int f = 0;
		for(int i=p;i<q;i++){
			if(!isalnum(s[i])){
				f = -1;
				break;
			}
			f = f*10 + s[i] - '0';
		}
		if(f >= 0) return vi(1, f);
	}
	bra = 0;
	vi ret;
	for(int i=p;i<q;i++){
		if(s[i] == '(') bra ++;
		else if(s[i] == ')') bra --;
		else if(!bra && !isalnum(s[i])){
			vi a = calc(p, i);
			vi b = calc(i+1, q);
			FOR(it, a)FOR(jt, b){
				if(s[i] == '+') ret.push_back(*it + *jt);
				if(s[i] == '-') ret.push_back(*it - *jt);
				if(s[i] == '*') ret.push_back(*it * *jt);
				if(s[i] == '/' && *jt) ret.push_back(*it / *jt);
			}
		}
	}
	sort(ALL(ret));
	ret.erase( unique(ALL(ret)), ret.end() );
	return ret;
}

main(){
	while(cin >> s, s!="#"){
		cout << calc(0, s.size()).size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] s = new int[M];
		int[] c = new int[M];
		int ans = -1;
		
		for(int j=0; j<M ;j++) {
			s[j] = sc.nextInt();
			c[j] = sc.nextInt();
		}
		
		if(N==1) {
			for(int i=0; i<10 ;i++) {
				int check = 0;
				for(int j=0; j<M ;j++) {
					if(s[j]==1 && c[j] == i) check++;
				}
				if(check == M) {
					ans = i;
					break;
				}
			}
		}else if(N==2) {
			for(int i=10; i<100 ;i++) {
				int check = 0;
				for(int j=0; j<M ;j++) {
					if(s[j]==1 && c[j] == i%100/10) check++;
					if(s[j]==2 && c[j] == i%10) check++;
				}
				if(check == M) {
					ans = i;
					break;
				}
			}
		}else if(N==3) {
			for(int i=100; i<1000 ;i++) {
				int check = 0;
				for(int j=0; j<M ;j++) {
					if(s[j]==1 && c[j] == i/100) check++;
					if(s[j]==2 && c[j] == (i%100)/10) check++;
					if(s[j]==3 && c[j] == i%10) check++;
				}
				if(check == M) {
					ans = i;
					break;
				}
			}
			
			
		}
		System.out.println(ans);

	}
}




Measured memory_bytes: 22740
class Puzzle
  attr_accessor :mat, :step, :cost
  def initialize(mat, step)
    @mat = mat
    @step = step
    @cost = distance
  end
  def >(other)
    return self.cost + self.step < other.cost + other.step ? true : false
  end
  def <(other)
    return self.cost + self.step > other.cost + other.step ? true : false
  end
  def distance
    goal = [1,2,3,4,5,6,7,8,0]
    d = 0
    9.times{|n|
      m = @mat.index(goal[n])
      y1, x1 = n.divmod(3)
      y2, x2 = m.divmod(3)
      d += (y1-y2).abs + (x1-x2).abs
    }
    return d
  end
end

class Heep
  def initialize
    @node = []
  end
  def insert(num)
    i = @node.size
    @node[i] = num
    p = (i+1)/2-1
    while i > 0 && @node[p] < @node[i]
      @node[i], @node[p] = @node[p], @node[i]
      i = p
      p = (i+1)/2-1
    end
  end
  def extract
    ret = @node[0]
    if @node.size > 1
      @node[0] = @node.pop()
      maxHeapify(0)
    else
      @node = []
    end
    return ret
  end
  def maxHeapify(i)
    h = @node.size
    largest = i
    l = 2 * i + 1
    largest = l if l < h && @node[l] > @node[largest]
    r = 2 * i + 2
    largest = r if r < h && @node[r] > @node[largest]
    if largest != i then
      @node[i], @node[largest] = @node[largest], @node[i]
      maxHeapify(largest)
    end
  end
  def size
    return @node.size
  end
  def contain(node)
    if @node.index(node) == nil
      return false
    else
      return true
    end
  end
end

mat = []
3.times{|i|
  mat[3*i],mat[3*i+1],mat[3*i+2] = gets.split.map(&:to_i)
}

ini = Puzzle.new(mat, 0)
q = Heep.new
q.insert(ini)

done = {}
loop do
  break if q.size == 0
  it = q.extract
  if it.cost == 0 then
    p it.step
    exit
  else
    done[it.mat.join("")] = true
  end
  idx = it.mat.index(0)
  y, x = idx.divmod(3)
  #Down
  unless y == 0 then
    mat = it.mat.clone
    mat[idx], mat[idx-3] = mat[idx-3], mat[idx]
    unless done[mat.join]
      tmp = Puzzle.new(mat, it.step+1)
      q.insert(tmp)
    end
  end

  #Up
  unless y == 2 then
    mat = it.mat.clone
    mat[idx], mat[idx+3] = mat[idx+3], mat[idx]
    tmp = Puzzle.new(mat, it.step+1)
    unless done[mat.join]
      tmp = Puzzle.new(mat, it.step+1)
      q.insert(tmp)
    end
  end
  
  #Left
  unless x == 0 then
    mat = it.mat.clone
    mat[idx], mat[idx-1] = mat[idx-1], mat[idx]
    tmp = Puzzle.new(mat, it.step+1)
    unless done[mat.join]
      tmp = Puzzle.new(mat, it.step+1)
      q.insert(tmp)
    end
  end

  #Right
  unless x == 2 then
    mat = it.mat.clone
    mat[idx], mat[idx+1] = mat[idx+1], mat[idx]
    tmp = Puzzle.new(mat, it.step+1)
    unless done[mat.join]
      tmp = Puzzle.new(mat, it.step+1)
      q.insert(tmp)
    end
  end
  
end

Measured memory_bytes: 16088
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	ll r,d,x; cin >> r >> d >> x;
	FOR(10){
		x = r*x - d;
		cout << x << '\n';
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,q;
    cin >> n >> q;
    vvi tree(n);
    rep(i,n-1) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        tree[a].pb(b);
        tree[b].pb(a);
    }
    vi sum(n,0);
    rep(_,q) {
        int p,x;
        cin >> p >> x;
        p--;
        sum[p] += x;
    }
    function<void(int,int)> dfs = [&](int now,int p) {
        for(int i : tree[now]) {
            if(i == p) continue;
            sum[i] += sum[now];
            dfs(i,now);
        }
    };
    dfs(0,-1);
    rep(i,n-1) cout << sum[i] << " ";
    cout << sum[n-1] << endl;
}


Measured memory_bytes: 29824
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 200005;

int n, cnt[26];
char s[MAXN];
LL ans;

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	scanf("%s", s + 1); n = strlen(s + 1); ans = 1LL * n * (n + 1) >> 1;
	for (int i = 1; i <= n; i ++)
		cnt[s[i] - 'a'] ++;
	for (int i = 0; i < 26; i ++)
		ans -= 1LL * cnt[i] * (cnt[i] + 1) >> 1;
	ans ++;
	return printf("%lld\n", ans), 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

int main() {
  int N, M, L; cin >> N >> M >> L;
  vector<vector<P>> edge(N);
  rep(i,M) {
    int a, b, c; cin >> a >> b >> c; --a; --b;
    edge[a].push_back(P(c, b));
    edge[b].push_back(P(c, a));
  }

  Graph move(N);
  rep(i,N) {
    priority_queue<P> pq;
    vi fuel(N, -1);
    pq.push(P(L, i));
    fuel[i] = L;

    while (!pq.empty()) {
      auto p = pq.top(); pq.pop();
      int f, v; tie(f, v) = p;
      if (fuel[v] > f) continue;

      for (auto np : edge[v]) {
        int d, nv; tie(d, nv) = np;
        if (f < d) continue;
        if (fuel[nv] >= f-d) continue;
        fuel[nv] = f-d;
        pq.push(P(f-d, nv));
      }
    }

    fuel[i] = -1;
    rep(j,N) {
      if (fuel[j] != -1) move[i].push_back(j);
    }
  }

  const int INFTY = 500;
  Graph query(N, vi(N, INFTY));
  rep(i,N) {
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P(-1, i));

    while (!pq.empty()) {
      auto p = pq.top(); pq.pop();
      int d, v; tie(d, v) = p;
      if (query[i][v] < d) continue;

      for (auto nv : move[v]) {
        if (query[i][nv] <= d+1) continue;
        query[i][nv] = d+1;
        pq.push(P(d+1, nv));
      }
    }
  }

  int Q; cin >> Q;
  rep(i,Q) {
    int s, t; cin >> s >> t; --s; --t;
    if (query[s][t] == INFTY) cout << -1 << endl;
    else cout << query[s][t] << endl;
  }
  return 0;
}


Measured memory_bytes: 2676
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long A = sc.nextLong();
      long B = sc.nextLong();
      long C = sc.nextLong();
      long D = sc.nextLong();
      long bmade = B/C+B/D-B/(lcm(C,D));
      long amade = (A-1)/C+(A-1)/D-(A-1)/(lcm(C,D));
      

 
      System.out.println(B-A-(bmade-amade)+1);
    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

Measured memory_bytes: 23764
import heapq
N, M = map(int, input().split())
work = [[0] for _ in range(M + 1)]
for _ in range(N):
  d, p = map(int, input().split())
  if d > M: continue
  work[d].append(-p)
#print(work)
money = 0
q = work[1]
heapq.heapify(q)
for i in range(1, M + 1):
  #print(q)
  if len(q) != 0:
    money += heapq.heappop(q)
  if i == M: continue
  for p in work[i + 1]:
    heapq.heappush(q, p)
print(-money)



Measured memory_bytes: 19268
from itertools import accumulate, permutations
import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A = [0] + list(accumulate(A))
B = [0] + list(accumulate(B))

ans = 0
for i in range(N+1):
    a = A[i]
    if a > K:
        break
    r = K - a
    j = bisect.bisect(B, r) - 1
    ans = max(ans, i + j)

print(ans)


Measured memory_bytes: 41244
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

def main():
  n,k=LI()
  ans=Base_10_to_n(n,k)
  return len(str(ans))

# main()
print(main())


Measured memory_bytes: 5068
using System;
class Program{
  static void Main()
  {
    string S = Console.ReadLine();
    string ans = "Yes";
    for (int i = 0; i < S.Length; i++)
    {
      string ss = S.Substring(i, 1);
      
      if (i % 2 == 0) // odd
      {
        if (ss != "R" && ss != "U" && ss != "D")
        {
          ans = "No";
          break;
        }
      } else // even
      {
        if (ss != "L" && ss != "U" && ss != "D")
        {
          ans = "No";
          break;
        }
      }
    }
    
    Console.WriteLine(ans);
    
  }
}

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

int n,s[100];
int temp,ave,sum;

void sort(void){
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(s[i]>s[j]){
	temp=s[i];
	s[i]=s[j];
	s[j]=temp;
      }
    }
  }
}

int main(){
  while(cin >> n,n){
    for(int i=0;i<n;i++)
      cin >> s[i];  
    
    sort();
    
    sum=0;

    for(int i=0;i<n-2;i++)
      sum+=s[i+1];

    cout << sum/(n-2) << endl;
  }
  return 0;
}

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

using namespace std ;

const long long mod = 1e9 + 7 ;
const int MAX = 1e5 + 10 ;

int arr[MAX] ;
long long dp[MAX] ;
int n , m ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		int x ;
		cin>>x ;
		arr[x] = 1 ;
	}
	dp[0] = 1ll ;
	for(int i = 1 ; i <= n ; ++i)
	{
		if(arr[i] == 1)
			continue ;
		dp[i] = dp[i-1] ;
		if(i > 1)
			dp[i] = (dp[i] + dp[i-2]) % mod ;
		dp[i] %= mod ;
	}
	return cout<<dp[n]<<"\n" , 0 ;
}		

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;
typedef pair<int, int> P;

int main()
{
    int N, M, Q;
    cin >> N >> M >> Q;

    vector<P> L(M), q(Q);
    rep(i, M) cin >> L[i].first >> L[i].second;
    rep(i, Q) cin >> q[i].first >> q[i].second;

    vector<vector<int>> match(N, vector<int>(N, 0));

    rep(i, M) {
        P p = L[i];
        match[p.first - 1][p.second - 1]++;
    }

    rep(i, N) {
        repd(j, 1, N) {
            match[i][j] += match[i][j - 1];
        }
    }

    rep(i, Q) {
        P p = q[i];
        ll cnt = 0;
        repd(j, p.first - 1, p.second) {
            cnt += match[j][p.second - 1];
        }
        cout << cnt << endl; 
    }

    return 0;
}

Measured memory_bytes: 4224
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;

typedef pair<int, int> P;
int di[] = {1, -1, 0, 0};
int dj[] = {0, 0, 1, -1};

const int INF = 1001001001;

int main() {
  int h, w;
  cin >> h >> w;
  vector <string> g(h);
  rep(i, h) cin >> g[i];

  // init graph
  int n = h*w;
  vector<vi> dist(n, vi(n, INF));
  rep(i, n) dist[i][i] = 0;

  rep(i, h) rep(j, w){
    if (g[i][j] == '#') continue;
    rep(k, 4){
      int dy = i + di[k];
      int dx = j + dj[k];
      if (dy < 0 or dy >= h or dx < 0 or dx >= w) continue;
      if (g[dy][dx] == '#') continue;
      dist[(i * w)+j][(dy * w)+dx] = 1;
    }
  }

  rep(k, n){
    rep(i, n){
      rep(j, n){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = 0;
  rep(i, n){
    rep(j, n){
      if (dist[i][j] != INF) ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 896
from collections import Counter

N,P = map(int,input().split())
S = input()

def two_or_five():
    global S,N,P
    ans = 0
    for k,v in enumerate(S):
        v = int(v)
        if v % P:
            continue
        ans += k + 1
    return ans

def other():
    global S,N,P
    S = reversed(S)
    T = [0] * N
    a = 1
    for k,v in enumerate(S):
        T[k] = T[k-1] + a * int(v)
        T[k] %= P
        a *= 10
        a %= P
    T.append(0)
    ans = 0
    for k,v in Counter(T).items():
        ans += v * (v-1) // 2
    return ans

if P in {2,5}:
    print(two_or_five())
else:
    print(other())

Measured memory_bytes: 45772
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x, n, y, z=0, i, t;
	scanf("%d", &n);
	z=800*n;
	if(n>15){
		i=n/15;
		t=z-(i*200);
		printf("%d", t);
	}
	else{
		printf("%d", z);
	}
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  if (N % K == 0)
    cout << 0 << '\n';
  else
    cout << 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

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

template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif

  int n, k;
  cin >> n >> k;
  vector<int> h(n + 2);
  for (int i = 1; i <= n; ++i) {
    cin >> h[i];
  }
  const long long INF = 1e18L + 5;
  vector<long long> dp(n + 2, INF);
  dp[1] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k && i + j <= n; ++j) {
      uin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[n] << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 1408
s = input()
stack = []
ans = 0
for i in range(len(s)):
    if len(stack) == 0 or stack[len(stack) - 1] == s[i]:
        stack.append(s[i])
    elif stack[len(stack) - 1] != s[i]:
        stack.pop(len(stack)- 1)
        ans += 2

print(ans)

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

vector<vector<int>> Z(512,vector<int>(512));
vector<int> movs(0);
vector<int> movt(0);
vector<int> movg(0);
vector<int> movh(0);

int main(){
  int N,M; cin>>N>>M;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>Z[i][j];
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(j==M-1){
        if(Z[i][j]%2 && i!=N-1){
          movs.push_back(i);
          movt.push_back(j);
          movg.push_back(i+1);
          movh.push_back(j);
          Z[i+1][j]++;
        }
      }
      else if(Z[i][j]%2){
        movs.push_back(i);
        movt.push_back(j);
        movg.push_back(i);
        movh.push_back(j+1);
        Z[i][j+1]++;
      }
    }
  }
  cout<<movs.size()<<endl;
  for(int i=0;i<movs.size();i++){
    cout<<movs[i]+1<<" "<<movt[i]+1<<" "<<movg[i]+1<<" "<<movh[i]+1<<endl;
  }
}

Measured memory_bytes: 5224
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double EPS = 1e-10;


int main(void) {
  string S;
  cin >> S;

  if (S.back() == 's') {
    cout << S << "es" << endl;
  } else {
    cout << S << "s" << endl;
  }
  
  return 0;
}

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

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;


int main(){
  ll a,b;
  cin>>a>>b;
  if(b>=a)cout<<a<<endl;
  else cout<<a-1<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int TEST,CASE=1;
#define sf scanf
#define pf printf
#define pb push_back
#define nl cout<<endl
#define all(x) x.begin(),x.end()
#define clr(a,b) memset(a,b,sizeof(a))
typedef long long int ll;
typedef long double ld;
ll n,m,a,b,c,k,x,y,z,ans=0,total=0;
string s;
int main(void){
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='9')s[i]='1';
		else s[i]='9';
	}
	cout<<s<<endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<tuple<string, int, int>> tpl(n);
  for(int i = 0; i < n; i++){
    string a;
    int b;
    cin >> a >> b;
    tpl[i] = make_tuple(a, 100-b, i+1);
  }
  sort(tpl.begin(), tpl.end());
  
  for(int i=0; i < n; i++){
    int num;
    tie(ignore, ignore, num) = tpl[i];
    cout << num << endl;
  }
  
}


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

/*int main(void)
{
    int64_t n ,k;
    cin >> n >> k;

    int ans = 0, b = 0;
    vector<int64_t> a;
    a[0] = n;
    for (int i = 1; i < n; i++)
    {
        n = abs(n-k);
        a.push_back(n);
    }
    sort(a.begin(), a.end());
    cout << a[0] << endl;
}*/

int main(void)
{
    long long n, k;
    cin >> n >> k;
    long long a = n % k;
    long long ans = min(a, k-a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256