akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    vector<vi> graph(N);
    REP(i, N - 1) {
        int u, v;
        cin >> u >> v, u--, v--;

        graph[u].pb(v);
        graph[v].pb(u);
    }

//
//    priority_queue<Pin> q;
//    q.emplace(0, 0);
//
//    vector<ll> dist(N, inf), prev(N);
//    dist[0] = 0;
//    while(!q.empty()) {
//        auto p = q.top(); q.pop();
//
//        ll d = p.fi + 1;
//        for (auto e: graph[p.se]) {
//            if (dist[e] <= d) continue;
//
//            dist[e] = d;
//            prev[e] = p.se;
//            q.emplace(d, e);
//        }
//    }

    vi ans(N);

    vector<bool> used(N, false);
    auto dfs = [&] (auto &&f, int from, int cur, vll& dp) -> void {
        // update dp table
        auto it = lower_bound(ALL(dp), A[cur]);
        int rev = *it;
        *it = A[cur];

        ans[cur] = lower_bound(ALL(dp), inf) - dp.begin();

        // go to next nodes
        for(auto e: graph[cur]) {
            if (used[e]) continue;
            used[e] = true;
            f(f, cur, e, dp);
        }

        // revert
        *it = rev;
    };

    vll dp(N, inf);
    used[0] = true;
    dfs(dfs, -1, 0, dp);

    REP(i, N) {
        print(ans[i]);
    }
    
}


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

double N;
int K;

double solve(int n) {
  double x = 1;
  while (n < K) {
    n = n * 2;
    x /= 2;
  }
  return x;
}

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

  double sum = 0;

  for (int i = 1; i <= N; i++) {
    double cnt = solve(i);
    sum += cnt;
  }
  sum /= 1 * N;
  cout << setprecision(15) << sum << endl;
}


Measured memory_bytes: 256
# AGC 003: A – Wanna go back home
S = input()

canReturn = 'Yes'

if (('N' in S and 'S' not in S) or ('N' not in S and 'S' in S)) \
        or (('E' in S and 'W' not in S) or ('E' not in S and 'W' in S)):
    canReturn = 'No'

print(canReturn)

Measured memory_bytes: 2940
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		long x[] = new long[N];
		for(int i=0;i<N;i++)x[i]=sc.nextLong();
		sc.close();
		
		long ans = Math.abs(X-x[0]);
		for(int i=0;i<N-1;i++) {
			int dist = (int)Math.abs(x[i+1]-x[i]);
			ans = gcd(ans,dist);
		}
		
		System.out.println(ans);
		
	}
	
	static long gcd(long x, long y) {
		return y==0? x:gcd(y, x%y);
	}
}


Measured memory_bytes: 50116
#include <iostream>

using namespace std;

int b[500099], n = 0, ans = 0;

void Merge(int a[], int l, int r){
    int m = (l + r) / 2;
    int i = l, j = m + 1, sum[r - l + 1], cnt = -1;
    ans += r - l + 1;
    while (i <= m && j <= r){
        if (a[i] < a[j])
            sum[++cnt] = a[i++];
        else
            sum[++cnt] = a[j++];
    }
    while (i <= m)  sum[++cnt] = a[i++];
    while (j <= r)  sum[++cnt] = a[j++];
    for (int i = l; i <= r; i++)
        a[i] = sum[i - l];
}

void Merge_sort(int a[], int l, int r){
    if (l < r){
        int m = (l + r) / 2;
        Merge_sort(a, l, m);
        Merge_sort(a, m + 1, r);
        Merge(a, l, r);
    }
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> b[i];
    Merge_sort(b, 0, n - 1);
    for (int i = 0; i < n - 1; i++)
        cout << b[i] << " ";
    cout << b[n - 1] << endl;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 6996
n, m = map(int, input().split())
ablst = [list(map(int, input().split())) for _ in range(n)]

ablst = sorted(ablst, key = lambda x: x[0])

count = 0
amount = 0
for shop in ablst:
    if count + shop[1] < m:
        count += shop[1]
        amount += shop[1] * shop[0]
    else:
        for i in range(shop[1]):
            count += 1
            amount += shop[0]
            if count == m:
                print(amount)
                break
        break

Measured memory_bytes: 29796
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
//#define MOD 998244353
#define MOD 1000000007
#define PI 3.14159265358979
using ll = long long;
using namespace std;

int main(){
    int n;
    cin>>n;
    ll t=1000000000000000000, ans=1;
    bool isbigger=false;
    rep(i,n){
        ll in;
        cin>>in;
        if(in==0){
            cout<<0;
            return 0;
        }
        else{
            t/=in;
            ans*=in;
            if(t<1){
                isbigger=true;
            }
        }
    }
    if(isbigger) cout<<"-1";
    else cout<<ans;
    return 0;
}


Measured memory_bytes: 3636
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	string s,out="";
	cin>>s;
	int n=s.size(),m;
	cin>>m;
	for(int i=0;i<n;i+=m) out+=s[i];
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n,k;
    cin >> n >> k;
    for(int i=0;i<n;i+=2){
        k--;
    }
    if(k<=0){
        cout <<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
}
    



Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int cnt = 0;
		for(int i = a; i <= b; i++){
			if(c % i == 0){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 26408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] get = br.readLine().split("");
		int A = Integer.parseInt(get[0]);
		int B = Integer.parseInt(get[1]);
		int C = Integer.parseInt(get[2]);
		int D = Integer.parseInt(get[3]);


		for(int op1 = 0;op1<2;op1++){
			for(int op2 = 0;op2<2;op2++){
				for(int op3 = 0;op3<2;op3++){
					int ans = 0;
					String o1,o2,o3;
					if(op1 == 0){
						ans += A+B;
						 o1 = "+";
					}else{
						ans += A-B;
						o1 = "-";
					}

					if(op2 == 0){
						ans += C;
						 o2 = "+";

					}else{
						ans = ans-C;
						 o2 = "-";

					}

					if(op3 == 0){
						ans += D;
						o3 = "+";

					}
					else{
						ans = ans -D;
						o3 = "-";

					}

					if(ans == 7){
						System.out.println(A + o1 + B + o2 + C + o3 + D + "=7");
						System.exit(0);
					}
				}
			}
		}
	}
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;

struct matku{
	int sz;
	long long arr[55][55];
};

struct matku mul(struct matku a, struct matku b){
	struct matku tmp;
	tmp.sz = a.sz;
	memset(tmp.arr,0,sizeof tmp.arr);
	
	for(int i =0;i<a.sz;i++){
		for(int j= 0;j<a.sz;j++){
			for(int k= 0;k<a.sz;k++){
				tmp.arr[i][j] += ((a.arr[i][k]%MOD)*(b.arr[k][j]%MOD))%MOD;
				tmp.arr[i][j] %=MOD;
			}
		}
	}
	return tmp;
}
long long k,ans;
int n;
struct matku bigmod(struct matku a, long long b, long long c){
	struct matku tmp;
	tmp.sz =n;
	for(int i =0;i<a.sz;i++){
		for(int j =0;j<a.sz;j++){
			if(i==j) tmp.arr[i][j] = 1LL;
			else tmp.arr[i][j] = 0LL;
		}
	}
	while(b){
		if(b&1) tmp = mul(tmp,a);
		a = mul(a,a);
		b>>=1;
	}
	return tmp;
}



int main(){
	scanf("%d%lld",&n,&k);
	struct matku tmp;
	tmp.sz = n;
	for(int i = 0;i<n;i++){
		for(int j =0;j<n;j++){
			scanf("%lld",&tmp.arr[i][j]);
		}
	}
	tmp = bigmod(tmp,k,MOD);
	for(int i = 0;i<n;i++){
		for(int j =0;j<n;j++){
			ans+= tmp.arr[i][j];
			ans%=MOD;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 384
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    b = [i for i in range(1,10)]
    for a in range(1,10):
        if n % a == 0 and n // a in b:
            print('Yes')
            return
    print('No')
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
using System;

namespace AtCoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] x = Console.ReadLine().Split(' ');
            int ab = int.Parse(x[0]);
            int bc = int.Parse(x[1]);
            int ca = int.Parse(x[2]);

            Console.WriteLine((ab * bc / 2));

        }
    }
}


Measured memory_bytes: 11092
a = input()
a2 = a.split()
a = int(a2[0])
b = int(a2[1])

if a>b:
    if b==1:
        print("Bob")
    else:
        print("Alice")
elif a<b:
    if a==1:
        print("Alice")
    else:
        print("Bob")
else:
    print("Draw")


Measured memory_bytes: 3060
import sys
import queue

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def is_kaibun(s):
	if len(s) <= 1:
		return True
	for c, cc in zip(s,s[::-1]):
		if c != cc:
			return False
	return True
	
	
def mk_sub(s, other, s_is_front):
	#pa((s,other,s[:len(other)],other[:len(s)]))
	if len(s) <= len(other) and s == other[:len(s)]:
		return True, other[len(s):], not s_is_front
	elif len(s)>len(other) and s[:len(other)] == other:
		return True, s[len(other):], s_is_front
	return False, '', False

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	dd_f = {}
	dd_b = {}
	for _ in range(n):
		s, v = input().split()
		v = int(v)
		if s in dd_f:
			v = min(v, dd_f[s])
		dd_f[s] = v
		dd_b[s[::-1]]=v
	front=True
	open_list=queue.PriorityQueue()
	close_list_f = set()
	close_list_b = set()
	for k in dd_f:
		open_list.put((dd_f[k], (k, front)))
		
	while not open_list.empty():
		#pa('rrrr')
		#return 
		cost, (s, is_front) = open_list.get()
		#pa((cost,s,is_front))
		#pa(s if is_front else s[::-1])
		if is_kaibun(s):
			return cost
		if (is_front and s in close_list_f) or (not is_front and s in close_list_b):
			continue
		if is_front:
			close_list_f.add(s)
		else:
			close_list_b.add(s)
			
		dic = dd_b if is_front else dd_f
		for k in dic:
			is_ok, next_s, r_is_front=mk_sub(s, k, is_front)
			#pa((is_ok,next_s,r_is_front,k))
			if not is_ok:
				continue
			elif r_is_front and next_s in close_list_f:
				continue
			elif not r_is_front and next_s in close_list_b:
				continue
			else:
				open_list.put((cost + dic[k], (next_s, r_is_front)))
		
	return -1
		
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

int main() {
	string S; cin >> S;
	int P=1;
	bool flag=false;
	for(int i=0; i<S.size(); ++i){
	    if(P && S[i]=='C') --P;
	    else if(!P && S[i]=='F'){
	        flag=true;
	        break;
	    }
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[100005];
int n,cnt=0;
int main(){
	scanf("%s",s+1),n=strlen(s+1);
	for(int i=2;i<=n;++i)if(s[i]!=s[i-1])++cnt;
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    set<ll> st;
    rep(i, n) {
        ll a;
        cin >> a;
        st.insert(a);
    }

    if(st.size() == n) {
        out("YES");
    }
    else {
        out("NO");
    }
    
    re0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int A[3];
	int ans = 0;
	rep(i, 3) cin >> A[i];
	sort(A, A + 3);
	rep(i, 2) ans += abs(A[i] - A[i + 1]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
int t[2019][2019], y[2019][2019];
signed main(){
	int h,w;
	cin>>h>>w;
	vector<string> st(h);
	for(int i=0;i<h;i++){
		cin>>st[i];
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if( st[i-1][j-1] == '.' ){
				t[i][j] = t[i-1][j] + 1;
				y[i][j] = y[i][j-1] + 1;
			}
		}
	}
	for(int i=h;i>=1;i--){
		for(int j=w;j>=1;j--){
			if( st[i-1][j-1] == '.' ){
				t[i][j] = max( t[i][j], t[i+1][j] );
				y[i][j] = max( y[i][j], y[i][j+1] );
			}
		}
	}
	int ans = 0;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			ans = max( ans, t[i][j] + y[i][j] - 1 );
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int n;
    cin >> n;
    vi d(n);
    REP(i, n) {
        cin >> d[i];
    }
    int ans = 0;
    REP(i, n) {
        FOR(j, i + 1, n) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << "\n";

    return 0;
}


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

int main()
{
	int n, tme;
	cin >> n >> tme;
	int idx =(int)1e9;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if (y <= tme)
			idx = min(idx, x);
	}
	if (idx == (int)1e9)
		cout << "TLE";
	else
		cout << idx;

}

Measured memory_bytes: 256
// {{{ include
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
// }}}

using namespace std;

typedef long long ll;
inline int in(){int x;scanf("%d",&x);return x;}

pair<string, string> split(string S, int n){
  return make_pair(S.substr(0, n), S.substr(n));
}

int main()
{
  int m = in();
  for (int i = 0; i < m; i++){
    string s;
    cin >> s;

    set<string> pat;
    for (int p = 1; p < s.size(); p++){
      string L, R;
      tie(L, R) = split(s, p);
      string rL = L, rR = R;
      reverse(begin(rL), end(rL));
      reverse(begin(rR), end(rR));
      pat.insert(L + R);
      pat.insert(L + rR);
      pat.insert(rL + R);
      pat.insert(rL + rR);
      pat.insert(R + L);
      pat.insert(R + rL);
      pat.insert(rR + L);
      pat.insert(rR + rL);
    }
    cout << pat.size() << endl;
  }

  return 0;
}

Measured memory_bytes: 1316
var reader = require('readline').createInterface ({
    input: process.stdin,
    output: process.stdout
});

var lines = [];
reader.on('line', (line) => {
    lines.push(line);
});

reader.on('close', () => {
    var line = lines[0];
    var elems = line.split(' ');
    var A = elems[1];
    var B = elems[2];
    var C = B - A - 1;
    if (C % 2 == 1) {
        console.log('Alice');
    } else if (C % 2 == 0) {
        console.log('Borys');
    }
});

Measured memory_bytes: 11596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

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

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
	
	char c[1200];
	int sum[26]={};
	int i;
	
	while(scanf("%s",c)!=EOF){
		for(i=0;c[i];i++){
			if('a'<=c[i]&&c[i]<='z')sum[c[i]-'a']++;
			if('A'<=c[i]&&c[i]<='Z')sum[c[i]-'A']++;
		}
	}
	
	for(i=0;i<26;i++){
		printf("%c : %d\n",'a'+i,sum[i]);
	}
	
	return 0;
}


Measured memory_bytes: 540
#include<stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a > b){
        printf("a > b\n");
    }
    else if(a == b){
        printf("a == b\n");
    }
    else{
        printf("a < b\n");
    }

    return 0;
    
}


Measured memory_bytes: 2060
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
t = [[-1] * w for _ in range(h)]
cnt = [0] * 2005
ans = 0
for i in range(h):
    x = 1
    cnt[1] = 0
    for j in range(w):
        if s[i][j] == ".":
            t[i][j] = x
            cnt[x] += 1
        else:
            x += 1
            cnt[x] = 0
    for j in range(w):
        if not t[i][j] == -1:
            t[i][j] = cnt[t[i][j]]
for j in range(w):
    x = 1
    cnt[1] = 0
    for i in range(h):
        if s[i][j] == ".":
            s[i][j] = x
            cnt[x] += 1
        else:
            x += 1
            cnt[x] = 0
    for i in range(h):
        if not s[i][j] == "#":
            ans = max(ans, t[i][j] + cnt[s[i][j]] - 1)
print(ans)

Measured memory_bytes: 460344
#include<stdio.h>
int main(){
	int n,a,b,sum=0;
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++){
		int t=i,tmp=0;
		while(t){
			tmp+=t%10;
			t/=10;
		}
		if(tmp>=a && tmp<=b) sum+=i;
	}
	printf("%d\n",sum);
	return 0;
}

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

#define int long long
#define ld long double

#define pb push_back
#define F first
#define S second
#define I insert
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()

#define debug1(a) cerr<<" "<<#a<<" : "<<a<<"\n"
#define debug2(a,b) cerr<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<"\n"
#define debug3(a,b,c) cerr<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<"\n"
#define debug4(a,b,c,d) cerr<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<"\n"
 
#define INF (int)100000000000000000
#define PI (double)3.14159265358979
#define MOD 1000000007

vector <set <pair <int, int>> > adj;
int n, m;
bool check(int i, int j)
{
    return i>=0 && j>=0 && i<n && j<m;
}

int dijkstra(int n, int dest)
{
    int d[adj.size()];
    fill(d,d+sz(adj),(int)INF);
    set <pair <int,int>> s;
    s.insert({0,n});
    d[n]=0;
    while(s.size())
    {
        auto it=s.begin();
        int vertex=(*it).S;
        s.erase(it);

        for (auto j: adj[vertex])
        {
            int weight = j.S;
            // debug2(weight,weight);
            if (d[j.F]>d[vertex]+weight)
            {
                if (d[j.F]!=(int)INF) s.erase(s.find({d[j.F],j.F}));

                d[j.F]=d[vertex]+weight;
                s.insert({d[j.F],j.F});
            }
        }

    }
    if (d[dest] == INF)
        return -1;

    return d[dest];
    // rep(i,sz(adj)) debug1(d[i]);
}


signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
    cin >> n >> m;

    int sx, sy, dx, dy;
    cin >> sx >> sy >> dx >> dy;
    sx--;
    sy--;
    dx--;
    dy--;
    adj.resize(n*m);

    char a[n][m];
    
    for (int i=0;i<n;++i)
    {
        for (int j=0;j<m;++j)
        {
            cin >> a[i][j];
        }
    }

    for (int i=0;i<n;++i)
    {
        for (int j=0;j<m;++j)
        {
            if (a[i][j] == '.')
            {
                for (int x = i-2; x <= i+2; ++x)
                {
                    for (int y = j-2; y <= j+2; ++y)
                    {
                        if (!check(x, y))
                            continue;
                        if (i==x && j==y)
                            continue;
                        if (a[x][y] == '#')
                            continue;
                        int u = i*m + j, v = x*m + y;
                        if (abs(i-x) + abs(j-y) == 1)
                        {
                            // debug3(u, v, 0);
                            adj[u].insert({v, 0});
                            adj[v].insert({u, 0});
                            continue;
                        }
                        // debug3(u, v, 1);
                        adj[v].insert({u, 1});
                        adj[u].insert({v, 1});
                    }
                }
            }
        }
    }

    int ans = dijkstra(sx*m + sy, dx*m + dy);

    cout << ans << "\n";


    

    return 0;
}

Measured memory_bytes: 432412
# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# a=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# a=[int(input()) for _ in range (n)]  #リスト入力  改行でa1 ... anのとき
# s=[list(map(str,list(input()))) for i in range(h)]  # 文字列の二次元配列入力
# s = [list(map(int, input().split())) for i in range(n)] # 数値の二次元配列入力
# a = b[:], a = [x[:] for x in b] # deepcopy
# chr(ord('a') + 1) # chrのインクリメント
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#

a = input()
b = input()
c = input()

print(a[0]+b[1]+c[2])


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef map<int,int> mapii;
typedef map<int,bool> mapib;
typedef map<char,int> mapci;

#define small 1e-9
#define big5 1000000005
#define big7 1000000007
#define big 10000000
#define pi 3.1415926

#define inp(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define cum(arr,n,cumm) cumm[0]=0;for(int i=0;i<n;i++)cumm[i+1]=cumm[i]+arr[i];
#define bsdk ios_base::sync_with_stdio(false);cin.tie(NULL);
#define disp(arr) for(auto i:arr)cout<<i<<" ";cout<<"\n"
#define yes cout<<"YES\n"
#define nooo cout<<"NO\n"
#define yess cout<<"Yes\n"
#define no cout<<"No\n"
#define m1 cout<<"-1\n"
#define nl <<endl
#define hs cout<<"#"

#define fori(a, b, c) for (a = (b); (a) <= (c); ++(a))
#define ford(a, b, c) for (a = (b); (a) >= (c); --(a))
#define rep(i,n) fori(i,0,n-1)
#define rep1(i,n) fori(i,1,n)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define ub upper_bound
#define lb lower_bound
#define allv(v) v.begin(), v.end()
#define sorti(v) sort(allv(v))
/*bool isprime[big+1];
vector<int> primes;
void makesieve()
{
    ll i,j;
    rep(i,10000001)
        isprime[i]=false;
    isprime[2]=true;
    for(i=3;i<=big;i+=2)
        isprime[i]=true;
    for(i=3;i<=big;i+=2)
    {
        if(isprime[i])
            for(j=i*i;j<=big;j+=i)
            isprime[j]=false;
    }
    rep(i,big+1)
    {
        if(isprime[i])
            primes.pb(i);
    }
}
ll poww(ll n,ll m){
    if(m==0)return 1;
    if(m==1)return n;
    ll ans = poww(n,m/2);
    if(m%2==1) return (ans*ans)*n;
    else return (ans*ans);
}*/
void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c >=22)
        cout<<"bust";
    else
        cout<<"win";
}
int main()
{
    bsdk
    int t;
    //cin>>t;
    t=1;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
#include <sstream>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i = 0; i < N; i++)


#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/assign/list_of.hpp>

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS ,
    boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
typedef std::pair<int, int>                             Edge;
typedef boost::graph_traits<Graph>::vertex_descriptor   Vertex;


struct Point {
    int x;
    int y;
    Point(int x, int y): x(x), y(y){}
};

int main(int argc, char *argv[])
{
    int H, W;
    cin >> H >> W;

    vector<deque<bool>> S(H, deque<bool>(W));
    vector<vector<int>> N(H, vector<int>(W));
    vector<Point> points;
    int k = 0;
    Rep(i, H) {
        string s;
        cin >> s;

        Rep(j, W) {
            S[i][j] = (s[j] == '.');
            if (S[i][j]) {
                points.push_back(Point(j, i));
                N[i][j] = k++;
            }
        }
    }


    std::vector<Edge> edges;
    Rep(i, H) {
        Rep(j, W) {
            if(S[i][j] && j < W-1 && S[i][j+1]) {
                edges.push_back(make_pair(N[i][j], N[i][j+1]));
            }
            if(S[i][j] && i < H-1 && S[i+1][j]) {
                edges.push_back(make_pair(N[i][j], N[i+1][j]));
            }
        }
    }

    vector<int> weights(edges.size(), 1);

    int nsize = points.size();
    Graph g = Graph(edges.begin(), edges.end(), weights.begin(), nsize);

    int L = 0;
    Rep(s, nsize)
    {

        Vertex from = s; // 開始地点

        std::vector<Vertex> parents(boost::num_vertices(g));
        std::vector<std::size_t> distance(boost::num_vertices(g));

        // 最短経路を計算
        boost::dijkstra_shortest_paths(g, from,
                                       boost::predecessor_map(&parents[0]).distance_map(&distance[0]));

        // 経路の長さを計算
        int l = *std::max_element(distance.begin(), distance.end());
        L = max(L, l);
    }

    cout << L << endl;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(){

int i,n;

long a, max=-1000000, min=1000000, sum=0;

scanf("%d",&n);

for(i=0;i<n;i++){

scanf("%ld",&a);

if(min>a)min=a;

if(max<a)max=a;

sum+=a;

}

printf("%ld %ld %ld\n",min,max,sum);

return 0;

}
 

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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 modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

typedef pair<ll, ll> P;

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

    int N;
    cin >> N;
    vector<vector<pair<ll, ll>>> G(N);

    ll a, b, c;
    for(int i = 0; i < N-1; i++){
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].push_back(make_pair(b, c));
        G[b].push_back(make_pair(a, c));
    }

    int Q, K;
    cin >> Q >> K;

    vector<pair<ll, ll>> xy;
    ll x, y;
    for(int i = 0; i < Q; i++){
        cin >> x >> y;
        x--;
        y--;
        xy.push_back(make_pair(x, y));
    }

    vector<ll> dist(N);
    for(int i = 0; i < N; i++){
        dist[i] = INF;
    }
    dist[K-1] = 0;

    vector<ll> prev(N);
    for(int i = 0; i < N; i++){
        prev[i] = -1;
    }

    priority_queue<P, vector<P>, greater<P>> que;

    que.push(P(0, K-1));
    while(!que.empty()){
        P p = que.top();
        que.pop();
        ll v = p.second;
        if(dist[v] < p.first){
            continue;
        }

        for(int i = 0; i < G[v].size(); i++){
            pair<ll, ll> e = G[v][i];
            if(dist[e.first] > dist[v] + e.second){
                dist[e.first] = dist[v] + e.second;
                prev[e.first] = v;
                que.push(P(dist[e.first], e.first));
            }
        }
    }

    for(int i = 0; i < Q; i++){
        cout << dist[xy[i].first] + dist[xy[i].second] << endl;
    }

    return 0;
}



Measured memory_bytes: 13552
#print(sum(range(10)))45
n,k=map(int,input().split())
lis=list(map(int,input().split()))
count=0
for i in range(len(lis)):
  for j in range(i+1,len(lis)):
    if lis[i]>lis[j]:
      count+=1     
lista=[]
for i in lis:
  counta=0
  for j in lis:
    #counta=0
    if i>j:
      counta+=1
  lista.append(counta)
print((count*k+sum(lista)*(k*(k-1)//2))%(10**9+7))

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

int main(){
    int n; cin >> n;
    vector <int> A(n);
    for (int i=0; i<n; i++) cin >> A[i];
    int m; cin >> m;
    vector <int> B(n);
    for (int i=0; i<m; i++) cin >> B[i];
    
    int cnt=0;

    
    for (int i=0; i<m; i++){
        int right=n-1;
        int left=0;
        while(left<=right){
            int middle=(left+right)/2;
            if (A[middle]==B[i]) {
                cnt++;
                break;
            } else if(A[middle]>B[i]){
                right=middle-1;
            } else{
                left=middle+1;
            }
        }
    }
    
    cout << cnt << endl;
}


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

const int N=int(2e5)+10;
int H,W,n,sr,sc,suf[N];
char s[N],t[N];
bool check(char a,char b,int dis,int lim) {
	suf[n+1]=0;
	int sum=0;
	for (int i=n;i>=1;--i) {
		suf[i]=suf[i+1];
		if (s[i]==b) {
			suf[i]=std::min(suf[i],sum-1);
			--sum;
		}
		if (t[i]==a) {
			if (sum<0) ++sum;
		}
	}
	int pos=dis;
	for (int i=1;i<=n;++i) {
		if (s[i]==a) ++pos;
		if (pos>lim) return 0;
		if (t[i]==b) {
			if (pos-1+suf[i+1]>=1) --pos;
		}
	}
	return 1;
}
int main() {
	scanf("%d%d%d%d%d",&H,&W,&n,&sr,&sc);
	scanf("%s",s+1);
	scanf("%s",t+1);
	if (!check('D','U',sr,H)||!check('U','D',H-sr+1,H)||!check('R','L',sc,W)||!check('L','R',W+1-sc,W))
		puts("NO");
	else puts("YES");
}


Measured memory_bytes: 4872
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 998244353;


int main(int argc, char const *argv[]) {
    int n;cin>>n;
    vector<pair<long long, int>> l(n),r(n);
    vector<long long>l2(n+1,0),r2(n+1,0);
    for(int i=0;i<n;++i){
        long long ll,rr;cin>>ll>>rr;
        l[i] = pair<long long, int>(ll,i);
        r[i] = pair<long long, int>(rr,i);
    }
    sort(l.begin(),l.end());
    sort(r.begin(),r.end());
    for(int i=0;i<n;++i){
        l2[i+1] = l2[i] + l[n-i-1].first;
        r2[i+1] = r2[i] + r[i].first;
    }
    long long res = 0;
    for(int i=0;i<n;++i){
        res = max(res,2*(l2[i+1]-r2[i+1]));
    }
    for(int i=1;i<n;++i){
        res = max(res,2*(l2[i]-r2[i+1]));
        res = max(res,2*(l2[i+1]-r2[i]));
    }
    cout<<res<<endl;
    // long long res1 = 0,res2 = 0;
    // long long k = 0;
    // for(int i=0;i<n;++i){
    //     res1 += abs(k - min(k,r[i].first));
    //     if(i!=0&&k<=r[i].first)break;
    //     k = min(k,r[i].first);
    //     res1 += abs(k - max(k,l[n-i-1].first));
    //     if(k>=l[n-i-1].first)break;
    //     k = max(k,l[n-i-1].first);
    // }
    // res1 += k;
    // k = 0;
    // for(int i=0;i<n;++i){
    //     res2 += abs(k - max(k,l[n-i-1].first));
    //     if(i!=0&&k>=l[n-i-1].first)break;
    //     k = max(k,l[n-i-1].first);
    //     res2 += abs(k - min(k,r[i].first));
    //     if(k<=r[i].first)break;
    //     k = min(k,r[i].first);
    // }
    // res2 += k;
    // cout<<max(res1,res2)<<endl;
    return 0;
}

Measured memory_bytes: 5120
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(dead_code)]
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::ops::*;
use std::rc::*;
use std::string::*;

fn main() {
    let K : usize = read();
    let AB : Vec<usize> = read_vec();

    // A <= k * x  <= B となるか？
    let u = (AB[1]/K) * K;

    let ans = if AB[0] <= u {"OK"} else {"NG"};
    println!{"{}",ans}




}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    if a < b {
        std::mem::swap(&mut a, &mut b)
    }
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn yn(val: bool) {
    if val {
        println! {"Yes"}
    } else {
        println! {"No"}
    }
}

Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
typedef vector<vector<int>> Graph;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const int INF = 1 << 30;
const LL LLINF = 1LL << 60;
using namespace std;


vector<LL> make_divisors_pair(LL n) {
    vector<LL> divisors;
    for(int i = 1; i <= sqrt(n); i++) {
        if(n % i == 0) {
            divisors.push_back(i);
            divisors.push_back(n / i);
        }
    }
    return divisors;
}

int main(void){
    LL N;
    cin >> N;

    vector<LL> divisors = make_divisors_pair(N);

    LL ans = LLINF;
    for(int i = 0; i < divisors.size(); i += 2) {
        chmin(ans, abs(divisors[i] - 1) + abs(divisors[i + 1] - 1));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll a, b;
    cin >> a >> b;
    int k;
    cin >> k;
    if(a+k <= b-k){
        for(int i=a;i<=b;i++){
            if(i<a+k) cout << i << endl;
            else if(b-k<i) cout << i << endl;
        }   
    }
    else if(a+k > b-k){
        for(int i=a;i<=b;i++) cout << i << endl;
    }
    return 0;
}

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

int main()
{
    int A,B;
    cin >> A >> B;
    if((A==1 && B==2) || (A==2 && B==1))
    {
        cout << "3" << endl;
    }
    else if((A==2 && B==3) || (A==3 && B==2))
    {
        cout << "1" << endl;
    }
    else
    {
        cout << "2" << endl;
    }
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    int A,B; cin >> A >> B;
    int ans = max({A + B,A - B,A*B});
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3648
S = input()
if S == "SUN":
    ans = 7
elif S == "MON":
    ans = 6
elif S == "TUE":
    ans = 5
elif S == "WED":
    ans = 4
elif S == "THU":
    ans = 3
elif S == "FRI":
    ans = 2
elif S == "SAT":
    ans = 1

print(ans)

Measured memory_bytes: 38384
#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    int i;
    cin >> n;
    int A[n];
    for (i=0; i<n; i++) {
        cin >> A[i];
    }
    for (i=n-1; 0<i+1; i--) {
        cout << A[i];
        if(i!=0){
            cout <<' ';
        }else{
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			for (int i = 0; i < n; i++) {
				int[] a = new int[4];
				int[] b = new int[4];
				for (int j = 0; j < 4; j++) {
					a[j] = scanner.nextInt();
				}
				for (int j = 0; j < 4; j++) {
					b[j] = scanner.nextInt();
				}
				int aa = a[0] * b[0] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3];
				int bb = a[0] * b[1] + a[1] * b[0] + a[2] * b[3] - a[3] * b[2];
				int cc = a[0] * b[2] - a[1] * b[3] + a[2] * b[0] + a[3] * b[1];
				int dd = a[0] * b[3] + a[1] * b[2] - a[2] * b[1] + a[3] * b[0];
				System.out.printf("%d %d %d %d\n", aa, bb, cc, dd);
			}

		}
	}
}

Measured memory_bytes: 24244
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

const int match[10] = {
	1000000,	// 0
	2,	// 1
	5,	// 2
	5,	// 3
	4,	// 4
	5,	// 5
	6,	// 6
	3,	// 7
	7,	// 8
	6	// 9
};


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

	vector<int> A(M);
	for(int i=0; i<M; i++)
		cin >> A[i];

	const int NONE = -1;
	vector<int> dp(N+1, NONE);
	dp[0] = 0;
	for(int i=0; i<=N; i++){
		if(dp[i] == -1)
			continue;

		int index;
		for(int j=0; j<M; j++){
			index = i + match[A[j]];
			if(index > N)
				continue;

			dp[index] = max(dp[index], dp[i]+1);
		}
	}
	
	vector<int> ans;
	int cnt = N;
	for(int i=0; i<dp[N]; i++){
		int select = NONE;
		for(int j=0; j<M; j++){
			int dst = cnt - match[A[j]];
			if(dst < 0 || dp[dst] == NONE)
				continue;

			if(dp[cnt]-dp[dst] == 1)
				select = max(select, A[j]);
		}

		ans.push_back(select);
		cnt -= match[select];
	}

	for(int i=0; i<ans.size(); i++)
		cout << ans[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

S = input()
s = sum(int(x) for x in S)
if s % 9 == 0:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 11028
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int n;
  scanf("%d",&n);
  vector<int > v;
  while(n!=0)
  {
    if(n%10==1) 
       v.push_back(9);
    
    else if(n%10==9)
        v.push_back(1);
    
    else
       v.push_back(n%10);
    
    n/=10;
  }
  
  int i,s=v.size();
  for(i=s-1;i>=0;--i)
       printf("%d",v[i]);
  
}

Measured memory_bytes: 256
n, b = map(int, input().split())
xlist = [list(map(int, input().split())) for _ in range(n)]

from itertools import combinations
import numpy as np
xnumpy = np.array(xlist)
ans = 0
for y, z in combinations(xnumpy, 2):
    distance = ((y -z)**2).sum()
    for i in range((40**2)*10):
        if distance == i*i:
            ans += 1
print(ans)        

Measured memory_bytes: 27112
import java.util.*;
import java.io.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int n = Integer.parseInt(sc.next());
                long yono = 0;
                long sum = 0;
                int[] a = new int[n];
                for(int i = 0 ; i < n ; i++){
                        a[i] = Integer.parseInt(sc.next());
                        if(a[i] < yono) sum += (yono - a[i]);
                        else yono = a[i];
                }
                ou.print(sum + "\n");
                ou.flush();
        }
}

Measured memory_bytes: 60868
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
//#define i_7 (long long)(1e9+7)
#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

vector<int> G[200'010];

long long dfs(int v){
  
  long long res = 1;
  for(int nv: G[v]){
    res *= dfs(nv);
    res = mod(res);
  }
  res = mod(res + 1);
  
  return res;
}
  
int main(){
  typedef pair<long long, long long> P;
  int n;
  cin>>n;
  long long x[n], d[n];
  vector<P> xd;
  REP(i, n){
    cin>>x[i]>>d[i];
    xd.push_back(P(x[i], d[i]));
  }
  sort(ALL(xd));
  set<pair<long long, int>> s;//現時点で根である頂点たちを格納。(x座標, 頂点のインデックスi)
  for(int i = n - 1; i >= 0; i--){
    long long tx = xd[i].first;
    long long td = xd[i].second;
    while(s.size() > 0 && s.begin() -> first < tx + td){
      G[i].push_back(s.begin() -> second);
      s.erase(s.begin());
    }
    s.insert(make_pair(tx, i));
  }
  
  long long ans = 1;
  for(auto xi: s){
    int i = xi.second;
    ans *= dfs(i);
    ans = mod(ans);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 22636