akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

//小数出力
double print_double(double d){printf("%.8f", d);}

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}











int main() {
  int N,W;
  cin >> N >> W;
  ll w,v;
  vector<Vl> dp(N+1, Vl(W+1,0));
  FOR(i,1,N+1) {
    cin >> w >> v;
    FOR(j,1,W+1){
      dp[i][j] = maxt(dp[i-1][j],dp[i][j-1]);
      if (j-w>=0) dp[i][j] = maxt(dp[i][j],dp[i-1][j-w]+v);
    }
  }
  cout << dp[N][W];
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  cout<<min(n,k)*x+max(0,n-k)*y<<endl;
}

Measured memory_bytes: 256
var s = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
var n = parseInt(s[0], 10);
var a = s[1].split(" ").map(e => parseInt(e, 10)).sort((x, y) => y - x);
var sum = 0;
var i = 1
var c = 0
while (c < n) {
  sum += a[i];
  i += 2;
  c++;
}
console.log(sum);

Measured memory_bytes: 37704
#include <iostream>

using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	
	int vx = x2 - x1, vy = y2 - y1, x3 = x2 - vy, y3 = y2 + vx;
	cout << x3 << " " << y3 << " " << (x3 - vx) << " " << (y3 - vy) <<endl;
}

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

#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
//#define mo 998244353
string str;
//map<int, int>::iterator itr; 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;cin>>a>>b>>c;
    if(b*c>=a){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3644
N = int(input())
A = list(map(int, input().split()))
import numpy as np
B = []
m = N//2
b = 0
for i in range(m):
  b = b + A[2*i] - A[2*i+1]
b += A[N-1]
B.append(b)
n = 0
for i in range(N-1):
  c = 2*A[i]-B[n]
  B.append(c)
  n += 1
B=[str(d) for d in B]
B=" ".join(B)
print(B)

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

int main() {
  int n, m; cin >> n >> m;
  map<int, int> cnt_m;
  
  for (int i = 0; i < n; ++i) {
    int k; cin >> k;
    for (int j = 0; j < k; ++j) {
      int a; cin >> a;
      ++cnt_m[a];
    }
  }
  
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    if (cnt_m[i] == n) ++ans;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

fun main(args :Array<String>){
    val cin = Scanner(System.`in`)
    val a = cin.nextInt()
    val b = cin.nextInt()
    val c = cin.nextInt()

    if(a < b){
	    if(b < c){
	        println("Yes")
	    }else{
	        println("No")
	}
    }else{
	println("No")
    }
}



Measured memory_bytes: 25636
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int[] c = new int[n];
        int[][] a = new int[n][m];

        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
            for(int j=0; j<m; j++) {
                a[i][j] = sc.nextInt();
            }
        }

        int min = Integer.MAX_VALUE;

        for(int i=0; i<1<<n; i++) {
            int sum = 0;
            int[] r = new int[m];
            for(int j=0; j<n; j++) {
                if((i>>j)%2 == 1) {
                    sum += c[j];
                    for(int k=0; k<m; k++) {
                        r[k] += a[j][k];
                    }
                }
            }
            boolean ok = true;
            for(int k=0; k<m; k++) {
                if(r[k] < x) {
                    ok = false;
                    break;
                }
            }
            if(ok) {
                min = Math.min(min, sum);
           }

        }

        System.out.println(min<Integer.MAX_VALUE ? min : -1);
    }
}

Measured memory_bytes: 37624
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int mx = 0;
    int ans = 1;
    for(int i = 1; i <= n; i++) {
        int cnt = 0;
        int tmp = i;
        while(tmp % 2 == 0) {
            cnt++;
            tmp /= 2;
        }
        if(chmax(mx, cnt)) {
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3668
import sys

h, w = map(int, raw_input().split())
img = []
for i in range(h):
    r = raw_input()
    img.append(r)

print ''.join(['#'] * (len(img[0])+2))
for r in img:
    sys.stdout.write('#')
    sys.stdout.write(r)
    sys.stdout.write('#')
    print
print ''.join(['#'] * (len(img[0])+2))



Measured memory_bytes: 2696
#include <stdio.h>
int main(){
  int d1[6],d2[6],i,j,blank;
  for(i = 0; i < 6; i++){
    scanf("%d",&d1[i]);
  }
  for(i = 0; i < 6; i++){
    scanf("%d",&d2[i]);
  }
  for(i = 0; d1[1] != d2[1] && i < 3; i++){
    //3S
    blank=d2[0];
    d2[0]=d2[4];
    d2[4]=d2[5];
    d2[5]=d2[1];
    d2[1]=blank;
  }
  if(d1[1] != d2[1]){
    //1E
    blank=d2[0];
    d2[0]=d2[3];
    d2[3]=d2[5];
    d2[5]=d2[2];
    d2[2]=blank;
    for(i = 0; d1[1] != d2[1] && i < 3; i++){
      //3S
      blank=d2[0];
      d2[0]=d2[4];
      d2[4]=d2[5];
      d2[5]=d2[1];
      d2[1]=blank;
    }
  }
  if(d1[1] != d2[1]){
    printf("No\n");
    return 0;
  }
  for(i = 0; d1[0] != d2[0]; i++){
    //3E
    blank=d2[0];
    d2[0]=d2[3];
    d2[3]=d2[5];
    d2[5]=d2[2];
    d2[2]=blank;
  }
  if(d1[0] != d2[0]){
    printf("No\n");
    return 0;
  }
  if(d1[2] == d2[2] && d1[3] == d2[3] && d1[4] == d2[4] && d1[5] == d2[5]){
    printf("Yes\n");
  } else {
    printf("No\n");
  
  }
  return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  string s;
  int a[100], n;
  ll ans = 0;
  cin >> s;
  n = s.size();
  
  for (ll i = 0; i < n; i++) {
    a[i] = s[i] - '0';
  }
  
  for (int bit = 0; bit < (1 << n); bit++) {
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {       
        ans += sum ;
        sum = 0;
      }else {
        sum *= 10;
        sum += a[i];
      }
    }   
    ans += sum;
  }
  cout << ans << "\n";
  return (0);

}

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

#define mp make_pair

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef pair<i64,int> pli;
typedef pair<int,i64> pil;
typedef pair<i64,i64> pll;
typedef vector<int> vi;
typedef vector<i64> vl;

template <typename T>
T id(T b) {return b;};
template <class It>
bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It>
bool any(It f,It l){return std::any_of(f,l,id<bool>);}

const int MAX_N = 100;
int n;
u32 f[MAX_N] = {};
int p[MAX_N][11];

int main()
{
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    f[i] = 0;
    for (int j = 0; j < 10; j++) {
      cin >> x;
      if (x == 1) f[i] |= (1 << j);
    }
  }

  for (int i = 0; i < n; i++)
    for (int j = 0; j <= 10; j++)
      cin >> p[i][j];

  int res = INT_MIN;
  for (u32 pat = 1; pat < (1 << 10); pat++) {
    int temp = 0;
    for (int i = 0; i < n; i++) {
      int c = __builtin_popcount(pat & f[i]);
      temp += p[i][c];
    }
    res = max(res, temp);
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	if(n%2){
		cout << n/2 << endl;
	}
	else{
		cout << (n-1)/2 << endl;
	}
}

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

#define MAX_N 100
#define MAX_W 100000
#define INF 1LL<<60
typedef long long int ll;

ll dp[MAX_N + 1][MAX_W + 1];

int main() {
  int n, W, w[MAX_N + 1];
  ll v[MAX_N + 1];

  std::cin >> n >> W;
  for(int i = 0; i < n; ++i) {
    std::cin >> w[i + 1] >> v[i + 1];
  }

  for(int i = 1; i <= n; ++i) {
    for(int j = 1; j <= W; ++j) {
      if(j - w[i] >= 0) {
        dp[i][j] = std::max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
      } else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }

  std::cout << dp[n][W] << std::endl;
}


Measured memory_bytes: 78336
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		Set<Integer> ch = new HashSet<>();
		
		for(int i=0;i<n;i++) {
			int d=sc.nextInt();
			ch.add(d);
		}

		if(n==ch.size()) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
		sc.close();
	}
}

Measured memory_bytes: 69732
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>

using namespace std;
typedef long long ll;

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

	pair<int, int> lr[100000];
	for (int i = 0; i < M; i++) {
		scanf("%d%d", &lr[i].first, &lr[i].second);
		lr[i].first--;
		lr[i].second--;
	}
	sort(lr, lr + M, [](pair<int, int> left, pair<int, int> right) -> bool { return left.second < right.second; });

	int  prev_bridge = -1, res = 0;
	for (int i = 0; i < M; i++) {
		if (prev_bridge < lr[i].first) {
			res++;
			prev_bridge = lr[i].second - 1;
		}
	}

	printf("%d\n", res);


	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n)cin >> s[i];
  map <string,int> mp;
  rep(i,n){
    mp[s[i]]++;
  }
  map<int,vector<string>> mp2;
  for(auto i=mp.begin(); i!=mp.end();i++){
    //cout << i->first << " " << i->second << endl;
    mp2[i->second].push_back(i->first);
  }
  vector <string> max=mp2.rbegin()->second;
  for(int i= 0; i<max.size();i++){
    cout << max[i] << endl;
  }
}


Measured memory_bytes: 30068
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
// #pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
 
#define fr first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forln(i, l, n) for (int i = l; i < n; ++i)

#define int ll

using namespace std;

#ifdef __LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n'
	const int maxn = 20;
#else 
	#define dbg(x)
	const int maxn = 2e5 + 20;
#endif

//tg: @galebickosikasa

const ll inf = (ll) 2e9;
const ld pi = 3.14159265358979323846264;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;

random_device rd;
mt19937 SuperRandom(rd());

int bit (int msk, int i) {
	return (msk>>i) & 1;
}

int kek (vector<vector<int>>& goo, int msk, int k) {
	int cnt = __builtin_popcount (msk);
	vector<int> it (cnt + 1);
	int j = 0;
	int n = sz (goo), m = sz (goo[0]);
	int f = 0;
	int ans = 0;
	int res = 0;
	dbg (cnt);
	while (j < m && res <= 2 * m) {
		f = 0;
		++res;
		int dop = 0;
		int c = 0;
		for (int i = 0; i < n; ++i) {
			// dbg (dop);
			if (goo[i][j]) ++dop;
			if (bit (msk, i)) {
				it[c] += dop;
				dop = 0;
				if (it[c] > k) f = 1;
				++c;
			}
		}
		it[c] += dop;
		// dbg (dop);
		// dbg (it[c]);
		if (it[c] > k) f = 1;
		if (f) {
			cerr << "kek";
			++ans;
			it.assign (cnt + 1, 0);
			--j;
		}
		++j;

	}
	dbg (ans);
	if (res > 2 * m) return inf;
	return ans + cnt;
}



signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, m, k;
	cin >> n >> m >> k;
	vector<vector<int>> goo (n, vector<int> (m));
	for (int i = 0; i < n; ++i) {
		char x;
		for (int j = 0; j < m; ++j) {
			cin >> x;
			goo[i][j] = x - '0';
			// goo[i][j] = 1 - goo[i][j];
		}
	}
	int M = (1<<(n - 1));
	int ans = inf;
	for (int msk = 0; msk < M; ++msk) {
		ans = min (ans, kek (goo, msk, k));
	}
	cout << ans;









}

Measured memory_bytes: 384
#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 ll = long long;
using P = pair<int, int>;

ll X, Y, A, B, C;
vector<ll> p(100005), q(100005), r(100005);
int main(){
    cin >> X >> Y >> A >> B >> C;
    rep(i, A) cin >> p[i];
    rep(i, B) cin >> q[i];
    rep(i, C) cin >> r[i];
    sort(p.begin(), p.begin()+A, greater<>());
    sort(q.begin(), q.begin()+B, greater<>());
    sort(r.begin(), r.begin()+C, greater<>());
    vector<ll> s(X+Y);
    rep(i, X) s[i] = p[i];
    rep(i, Y) s[X+i] = q[i];
    sort(s.begin(), s.begin()+s.size(), greater<>());
    ll idx = 0, c=0;
    ll ans = 0;
    rep(i, X+Y) {
        if (s[idx] >= r[c] || c == C) {
            ans += s[idx];
            idx++;
        } else {
            ans += r[c];
            c++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll dp[100100][2];
vll G[100100];

void dfs(ll v, ll p){
  for(auto nv: G[v]){
    if(nv==p) continue;
    dfs(nv,v);
    dp[v][0]=dp[v][0]*(dp[nv][0]+dp[nv][1])%MOD;
    dp[v][1]=dp[v][1]*dp[nv][0]%MOD;
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  rep(i,n-1){
    ll a,b; cin>>a>>b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  rep(i,n) rep(j,2) dp[i][j]=1;
  dfs(0,-1);
  ll ans=(dp[0][1]+dp[0][0])%MOD;
  cout<<ans<<endl;
  
}

Measured memory_bytes: 17620
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int N,K;
  cin >> N >> K;
  int sum = 1;
  
  for(int i = 0 ; i < N ; i++){
    
    if(sum+K <= sum*2){
      sum += K;
    }else{
      sum *= 2;
    }
    if(i == N-1){
      cout << sum << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll mod=ll(1e9+7);

ll a[maxn];

ll L=2,R=2;

int main()
{
	//IOS;
   int n;
   cin>>n;
   REP(i,n) cin>>a[i];

   for(int i=n-1;i>=0;i--){
      ll l=((L-1)/a[i]+1)*a[i];
      ll r=R/a[i]*a[i];
      if(l>r){
         cout<<-1;
         return 0;
      }
      L=l;
      R=r+a[i]-1;
   }
   cout<<L<<' '<<R;
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>

int main(){
	int n,p,a[50];
	long long int cmb[51][51];
	long long kisu = 0, gusu = 0;
	for(int i=0;i<=50;i++){
		for(int j=0;j<=i;j++){
			if(i==0) cmb[i][j] = 1;
			else if(j==0) cmb[i][j] = cmb[i-1][j];
			else if(j==i) cmb[i][j] = cmb[i-1][j-1];
			else cmb[i][j] = cmb[i-1][j-1] + cmb[i-1][j];
		}
	}
	scanf("%d%d",&n,&p);
	for(int i=0;i<n;i++) scanf("%d",a+i);
	for(int i=0;i<n;i++){
		if(a[i]%2==0) gusu++;
		else kisu++;
	}
	long long int usi = 0;
	long long int uma = 1;
	for(int i=0;i<=kisu;i+=2){
		usi += cmb[kisu][i];
	}
	if(p!=0){
		usi = 0;
	for(int i=1;i<=kisu;i+=2){
		usi += cmb[kisu][i];
	}
	}
	for(int i=0;i<gusu;i++) usi *= 2;
	printf("%lld\n",usi);
}


Measured memory_bytes: 128
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int m; cin >> m;
    vector<ll> ds(m), cs(m);
    ll ans = -1, acc = 0;
    for(int i = 0; i < m; i++){
        cin >> ds[i] >> cs[i];
        ans += cs[i];
        acc += ds[i] * cs[i];
    }
    cout << ans + (acc - 1) / 9 << '\n';
}


Measured memory_bytes: 3328
#include <cstdio>
#include <cmath>

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

    double rad = deg * acos(-1) / 180;
    double h = b * sin(rad);
    double c = sqrt(a * a + b * b - 2 * a * b * cos(rad));

    printf("%lf\n", a * h / 2);
    printf("%lf\n", a + b + c);
    printf("%lf\n", h);

    return 0;
}

Measured memory_bytes: 1064
/**
 *    created by : PawPaw       
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  

using namespace __gnu_pbds;  
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 1000001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int solve(){
  string s;
  int C[26], n;
  fill(C, C+26, -4);
  cin >> s;
  n = (int)s.size();
  F(i, 0, n-1){
    if(C[int(s[i]-'a')] >= i-2){
      cout << C[int(s[i]-'a')]+1 << " " << i+1 << '\n';
      return 0; 
    }
    C[int(s[i]-'a')] = i;
  }
  cout << "-1 -1\n";
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++){
        S[i] = 'A' + (S[i] - 'A' + N) % 26;
    }
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  long long int n,m;
  cin >> n >> m;

  if(n == 1 || m == 1){
    if(n == m){
      cout << 1 << endl;
    } else {
      cout << n*m - 2 << endl;
    }
  } else {
    cout << n*m - 2*(m + n) + 4 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,q; cin >> n >> q;
		if(n*q==0)break;
		map<int,int> mp;
		for(int i=0;i<n;i++){
			int m; cin >> m;
			for(int j=0;j<m;j++){
				int a; cin >> a;
				mp[a]++;
			}
		}
		int ans=0;
		int ma=0;
		for(auto p:mp){
			if(p.second>=q&&p.second>ma){
				ma=p.second;
				ans=p.first;
			}
		}
		cout << ans << endl;
	}
}


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

int main(){
    string S; cin >> S;
    int N = S.size();

    rep(i, 1, N){
        if(S[i] == S[i-1]){
            cout << i << " " << i + 1 << endl;
            return 0;
        }else if(i > 1 && S[i-2] == S[i]){
            cout << i-1 << " " << i + 1 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <stack>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;

char s[20];

int main()
{
	scanf("%s", s);
	bool ok = 1;
	int len = strlen(s);
	if(len < 4) ok = 0;
	if(s[0] != 'Y') ok = 0;
	if(s[1] != 'A') ok = 0;
	if(s[2] != 'K') ok = 0;
	if(s[3] != 'I') ok = 0;
	if(ok) printf("Yes\n");
	else printf("No\n");
}

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

int main() {
 int N;
cin >> N;
vector<int> vec(N);
for(int i=0; i<N; i++){
cin >> vec.at(i);
}
int count=0; 
vec.push_back(0);
sort(vec.begin(), vec.end());
for(int i=1; i<N+1; i++){
if(vec.at(i) != vec.at(i-1) ){
count++;
}
}
cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
int main(){
    int n;
    cin>>n;
    vector<int> v(n,0);
    rep(i,n) cin>>v[i];
    sort(v.begin(),v.end());
    int sum=0;
    for(int i=0;i<n-1;i++){
        sum+=v[i];
    }
    sum+=v[n-1]/2;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535

	int main(void) {
		char s1, s2, s3;
		scanf("%c%c%c", &s1, &s2, &s3);
		int count = 0;
		if (s1 == '1') {
			count++;
		}
		
		if (s2 == '1') {
			count++;
		}
		
		if (s3 == '1') {
			count++;
		}
		printf("%d", count);


		return 0;
}
	

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

#define INF 100000000

int N,A,B,C;
vector<int> l(8);
int dfs(int now,int a,int b,int c,int a_counter,int b_counter,int c_counter){
  if(now == N){
    if(a_counter == 0 || b_counter == 0 || c_counter == 0)return INF;
    else{
      int mp = (a_counter - 1) * 10 + abs(A - a) + (b_counter - 1) * 10 + abs(B - b) + (c_counter - 1) * 10 + abs(C - c);
      return mp;
    }
  }

  return min({dfs(now+1,a+l[now],b,c,a_counter+1,b_counter,c_counter),dfs(now+1,a,b+l[now],c,a_counter,b_counter+1,c_counter),dfs(now+1,a,b,c+l[now],a_counter,b_counter,c_counter+1),dfs(now+1,a,b,c,a_counter,b_counter,c_counter)});
}

int main(){

  cin >> N >> A >> B >> C;
  for(int i = 0;i < N;i++){
    cin >> l[i];
  }

  int ans = dfs(0,0,0,0,0,0,0);

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
s = int(input())

setNum = set()
n = s
for i in range(1000000+1):
	if n in setNum:
		print(i+1)
		exit()
	
	#print(i,n)
	setNum.add(n)
	if n % 2 == 0:
		n = int(n/2)
	else:
		n =3*n+1

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  string S;
  cin >> N >> S;
  long cr = 0;
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'R')cr++;
  }
  long ans = 0;
  for(int i = 0; i < cr; i++){
    if(S.at(i) == 'W')ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
	int n, t;
	cin >> n >> t;

	int ret = 1001;
	for (int i = 0; i < n; ++i)
	{
		int ci, ti;
		cin >> ci >> ti;
		if (t < ti) {
			continue;
		}
		if (ci < ret) {
			ret = ci;
		}
	}

	if (ret == 1001) {
		cout << "TLE" << endl;
	}
	else {
		cout << ret << endl;
	}

	return 0;
}

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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 100010;

signed main() {
    IOS;

    int N, Q;
    V<> A;
    cin >> N;
    A.resize(N);
    map<int, int> cnt;
    int sum = 0;
    REP(i, N) {
        cin >> A[i];
        cnt[A[i]]++;
        sum += A[i];
    }
    cin >> Q;
    REP(i, Q) {
        int b, c;
        cin >> b >> c;
        int sub = c - b;
        sum += sub * cnt[b];
        print(sum);
        cnt[c] += cnt[b];
        cnt[b] = 0;
    }

    return 0;
}


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

vector<int> a(200005);
vector<int> b(200005);
vector<int> e[200005];

void dfs(int x){
    b[x] = 1;
    for(int &v : e[x]) {
			if(v == x)
				continue;
            if(b[v]==0){
                a[v] += a[x];
                dfs(v);
            }
		}
    return;
}

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

    for(int i=1; i<n; i++){
        int x,y;
        cin >> x >> y;
        e[x].push_back(y);
        e[y].push_back(x);
    }

    for(int i=0; i<q; i++){
        int p,x;
        cin >> p >> x;
        a[p] += x;
    }

    dfs(1);

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

    cout << endl;

}

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

#define int long long int
#define mp make_pair
using namespace std;

int dp[100002];
vector<int> v(100002);
int n;

int fun(int pos)
{
    if(pos > n-1){
        return 0;
    }
    if(dp[pos] != -1){
        return dp[pos];
    }
    dp[pos] = 0;
    dp[pos] = min(abs(v[pos] - v[pos + 1]) + fun(pos + 1) , abs(v[pos] - v[pos + 2]) + fun(pos + 2));
    return dp[pos];
}

int32_t main() {
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &v[i]);
    }
    for (int i = 0; i < n; ++i) {
        dp[i] = -1;
    }
    dp[n-1] = 0;
    dp[n-2] = abs(v[n-1] - v[n-2]);
    int ans = fun(0);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 4096
import math

input()
xl = [int(s) for s in input().split()]
yl = [int(s) for s in input().split()]

m1 = 0
m2 = 0
m3 = 0
m4 = 0
for x, y in zip(xl, yl):
    fabs = math.fabs(x - y) 
    m1 += fabs
    m2 += fabs ** 2
    m3 += fabs ** 3
    m4 = max(fabs, m4)
    
print(m1)
print(math.pow(m2, 1/2))
print(math.pow(m3, 1/3))
print(m4)

Measured memory_bytes: 7904
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
       Scanner sc = new Scanner(System.in);
        String W = sc.next();
        W = W.toLowerCase();
        String T[] = new String[10000];
        int count = 0;
        for(int i=0; i<10000; i++){
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")) break;
            T[i] = T[i].toLowerCase();
            if(T[i].equals(W)) count++;
        } 
        System.out.println(count);
    }
}


Measured memory_bytes: 26212
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	//DP[i][j]=i文字目まででj番目の状態がいくつあるか？
	ll DP[SIZE][4]={};
	DP[0][0]=1;
	for(int i=0;i<S.length();i++){
		if(S[i]=='A' || S[i]=='?'){
			DP[i+1][0]+=DP[i][0];
			DP[i+1][1]+=DP[i][1];
			DP[i+1][2]+=DP[i][2];
			DP[i+1][3]+=DP[i][3];
			DP[i+1][1]+=DP[i][0];
		}
		if(S[i]=='B' || S[i]=='?'){
			DP[i+1][0]+=DP[i][0];
			DP[i+1][1]+=DP[i][1];
			DP[i+1][2]+=DP[i][2];
			DP[i+1][3]+=DP[i][3];
			DP[i+1][2]+=DP[i][1];
		}
		if(S[i]=='C' || S[i]=='?'){
			DP[i+1][0]+=DP[i][0];
			DP[i+1][1]+=DP[i][1];
			DP[i+1][2]+=DP[i][2];
			DP[i+1][3]+=DP[i][3];
			DP[i+1][3]+=DP[i][2];
		}
		for(int j=0;j<4;j++)
			DP[i+1][j]%=MOD;
	}
	cout<<DP[S.length()][3]<<endl;
	return 0;
}

Measured memory_bytes: 3584
if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]

    ans = 0
    count_e, count_o = 0, 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            count_o += 1
            break
        # else:
        #     count_e += 1
    # if count_o % 2 == 1 and count_e % 2 == 0:
    #     print('first')
    # elif count_o % 2 == 1 and count_e % 2 == 1:
    #     print('first')
    # elif count_o % 2 == 0 and count_e % 2 == 1:
    #     print('second')
    # elif count_o % 2 == 0 and count_e % 2 == 0:
    #     print('second')
    #
    if count_o % 2 == 0:
        print('second')
    else:
        print('first')

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

// これ以降の行は変更しなくてよい


int main() {
  string s;
  cin >> s;
  vector<string> div = {"dream", "dreamer", "erase", "eraser" };
  reverse(s.begin(), s.end());
  for (int i = 0; i < 4; i++) reverse(div.at(i).begin(), div.at(i).end());

  for (int i = 0; i < s.size();) {
    for (int j = 0; j < 4; j++) {
      if(s.substr(i, div.at(j).size()) == div.at(j)){
        i += div.at(j).size();
        break;
      }
      if(j == 3){
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 3668
package main

import "fmt"

func main() {
	n := 0
	r := map[string]int{}
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		r[s]++
	}

	anss := [...]string{"AC", "WA", "TLE", "RE"}
	for _, ans := range anss {
		fmt.Println(ans, "x", r[ans])
	}
}


Measured memory_bytes: 6332
N, K = map(int, input().split())
W = [0] * (N + 1)
W[1] = 1

R = []
for i in range(K):
    l, r = map(int, input().split())
    R.append((l, r))

MOD = 998244353
for i in range(1, N):
    for l, r in R:
        a = max(i - r, 0)
        b = i - l
        if b < 0:
            continue
        W[i + 1] += (W[b + 1] - W[a])
        W[i + 1] %= MOD
    W[i + 1] += W[i]
    
print(W[N] - W[N - 1])





Measured memory_bytes: 69752
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int x, y; cin >> x >> y;
  if(abs(x-y) <= 1) cout << "Brown" << endl;
  else cout << "Alice" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for(int i=1; i<40000; i++){
            if(i*i>N){
                System.out.println((i-1)*(i-1));
                return;
            }
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define nl '\n'

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

void solve()
{
	int n;
	cin>>n;
	ll a[n];
	for(int i=0; i<n; i++)
		cin>>a[i];
	ll answer = 0;
	sort(a, a+n, greater<ll>());
	for(int i=0; i<n-1; i++)
	{
		answer += a[(i+1)/2];
	}
	cout<<answer<<nl;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	//cin>>t;
	t = 1;
	while(t--)
	{
		solve();
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define present(i, c) ((c).find(i) != (c).end())

#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define fora(i, a, b) for(int i = (a); i < (b); i++)
#define ford(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)
	
#define INF 0x3F3F3F3F

//=========================

// ============================
// Codigo Original
// ============================
/*int N, _W;
int W[101], V[101];
ll dp[101][100001];

void run_test() {
	cin >> N >> _W;
    for1(i, N) cin >> W[i] >> V[i];

    ini(dp, 0);
    for1(i, N) 
        for(int w = 1; w <= _W; w++)
			if(W[i] > w) dp[i][w] = dp[i-1][w];
			else dp[i][w] = max(dp[i-1][w], dp[i-1][w - W[i]] + V[i]);

    cout << dp[N][_W] << endl;
}*/

// ============================
// Otimizando Memoria
// Removendo uma dimensao da DP
// ============================
int N, _W;
int W[101], V[101];
ll dp[100001];

void run_test() {
	cin >> N >> _W;
    for1(i, N) cin >> W[i] >> V[i];

    ini(dp, 0);
    for1(i, N) 
        for(int w = _W; w >= W[i]; w--) 
            dp[w] = max(dp[w], dp[w - W[i]] + V[i]);

    cout << dp[_W] << endl;
}

//=========================

ifstream infile;
clock_t start__;
void open_func();
void close_func();

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	open_func();
	//int t; cin >> t; while(t--) run_test();
	run_test();
	close_func();
	return 0;	
}

void open_func() {
	//infile = ifstream("input.in"); if(infile.good()) cin.rdbuf(infile.rdbuf());
	start__ = clock();
	cerr << "---" << endl;
}

void close_func() {
	clock_t elapsed = clock()-start__;
	cerr << "---" << endl << "(time " << fixed << setprecision(2) << elapsed * (1.0/CLOCKS_PER_SEC) << "s)" << endl;	
	//if(infile.good()) infile.close();
}


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

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

const ll INF = 1LL << 60;

int main(){
  int n,m; cin >> n >> m;
  int path[n][n] = {};
  rep(i, m){
    int a,b; cin >> a >> b;
    path[a-1][b-1]++;
    path[b-1][a-1]++;
  }

  vi v; rep(i, n) v.push_back(i);
  int ans = 0;
  do{
    if(v[0] != 0) continue;
    rep(i, n-1){
      if(path[v[i]][v[i+1]] == 0) break;
      if(i == n-2) ans++;
    }
  }while(next_permutation(all(v)));

  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a;i < b; i++)

int main() {

	int n;
	cin >> n;

	string s = "Yes";
	int maxi = 0;

	vector<int> h(n);
	rep(i, 0, n) {
		cin >> h[i];
		maxi = max(h[i], maxi);
		if (maxi - h[i] > 1) {
			s = "No";
		}
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
int main() {
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
N, A, B, C, D = map(int, input().split())
S = input()
if "##" in S[A - 1: max(C, D)]:
	print("No")
	exit()
for i in range(B - 1, D):
	if S[i] == "." and S[i - 1] == ".":
		if D == N or C < D:
			print("Yes")
			exit()
		else:
			if S[i + 1] == ".":
				print("Yes")
				exit()
print("No")


Measured memory_bytes: 3572
#include <stdio.h>
#define N 100
int selectionSort(int*,int);

int main(){
  int i,n,c;
  int A[N];

  scanf("%d",&n);
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);
 
  c = selectionSort(A,n);

  for(i = 0; i < n; i++) {
    if(i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",c);  
  return 0;
}

int selectionSort(int A[],int n) {
  
  int c = 0,tmp,i,j,minj;

  for(i = 0; i <= n-1; i++){
    minj =i;
    for(j = i; j <= n-1; j++){
      if (A[j] < A[minj])
	minj = j;
    }
    if(i!=minj) {
      tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
      c++;
    }
    
  }
  return c;
}

Measured memory_bytes: 604
#include <iostream>

using namespace std;

int main(){
    int a, b, k, dist;

    cin >> k >> a >> b;
    dist = a / k * k;

    if((a <= dist && dist <= b) || (a <= dist+k && dist+k <= b)){
        cout << "OK" << endl;
    }
    else{
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _088
{
    class Program
    {
        static void Main(string[] args)
        {
            ProblemB.Solve();
        }
    }


    class ProblemB
    {
        public static void Solve()
        {
            string N = Console.ReadLine();

            List<int> inputList = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).OrderByDescending(x=>x).ToList();

            long ans = 0;
            bool addFlg = true;
            for(int i = 0; i < inputList.Count; i++)
            {
                if (addFlg)
                {
                    ans += inputList[i];
                }
                else
                {
                    ans -= inputList[i];
                }

                addFlg = addFlg ? false : true;

            }

            Console.WriteLine(ans);

            return ;

        }

    }
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[200005];
ll B[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M, K;
    cin >> N >> M >> K;

    REP(i, N) {
        cin >> A[i];
    }
    REP(i, M) {
        cin >> B[i];
    }

    ll ai = 0, bi = 0;
    ll s = 0;
    while (ai < N && s <= K) {
        if (s + A[ai] > K)
            break;
        s += A[ai++];
    }
    ll ans = ai;
    ai--;
    REP(i, M) {
        while (s + B[i] > K && ai >= 0) {
            s -= A[ai--];
        }
        s += B[i];
        if (s <= K) {
            ans = std::max(ans, i + 1 + ai + 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6772
s=int(input())
def f(x):
  if x%2==0:
    return x//2
  else:
    return 3*x+1
alist=[s]
for i in range(2,1000001):
  s=f(s)
  if s in alist:
    print(i)
    break
  else:
    alist.append(s)

Measured memory_bytes: 9176
import sys
input = sys.stdin.readline

n,m=list(map(int,input().split()))
stp = []
chp = []
for i in range(n):
    stp.append(list(map(int,input().split())))
for i in range(m):
    chp.append(list(map(int,input().split())))
for i in range(n):
    mdis =[]
    for j in range(m):
        mdis.append(abs(stp[i][0]-chp[j][0])+abs(stp[i][1]-chp[j][1]))
    print(mdis.index(min(mdis))+1)


Measured memory_bytes: 9008