akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
 {

        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            if (a >= 3200)
            {
                Console.WriteLine("{0}",s);
            }
            else
           {
                Console.WriteLine("red");
           }
        } 

 }

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef long long lint;

const lint mod = 998244353;

lint powmod(lint x, lint n){
    lint ret = 1;
    while(n){
        if(n&1) ret = (ret * x) % mod, n -= 1;
        else x = (x * x) % mod, n >>= 1;
    }
    return ret;
}

int main(){
    int n; cin >> n;
    lint sum = 0;
    lint a[n]; rep(i, n) cin >> a[i], sum += a[i];
    lint dp[2][90010]; rep(i, 2)rep(j, 90010) dp[i][j] = 0;
    dp[0][0] = 1;
    rep(i, n){
        rep(j, 90010)if(dp[0][j] > 0){
                dp[1][j] = (dp[1][j] + dp[0][j]*2) % mod;
                dp[1][j+a[i]] = (dp[1][j+a[i]] + dp[0][j]) % mod;
            }
        rep(j, 90010) swap(dp[0][j], dp[1][j]), dp[1][j] = 0;;
    }
    lint d = 0;
    rep(j, 90010)if(j*2 >= sum) d = (d + dp[0][j]) % mod;
    if(sum%2 == 0) {
        rep(i, 2)rep(j, 90010) dp[i][j] = 0;
        dp[0][0] = 1;
        rep(i, n){
            rep(j, 90010)if(dp[0][j] > 0){
                    dp[1][j] = (dp[1][j] + dp[0][j]) % mod;
                    dp[1][j+a[i]] = (dp[1][j+a[i]] + dp[0][j]) % mod;
                }
            rep(j, 90010) swap(dp[0][j], dp[1][j]), dp[1][j] = 0;
        }
        d = (d - dp[0][sum/2] + mod) % mod;
    }
    cout << (powmod(3, n) - 3*d%mod + mod) % mod << endl;
}

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

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

using namespace std;
int main() {

	int a, b, c;
	cin >> a >> b >> c;

	for (int i = a; i <= b; i++){
		if (abs(a - i) < c)
			cout << i << endl;
		else if (abs(b - i) < c)
			cout << i << endl;
	}


	return 0;
}


Measured memory_bytes: 256
while True:

    H , W = map(int, input().split())

    if H == 0 : break

    for i in range(H):

        for k in range(W):

            if (i+k) %2 == 0:

                print("#" , end = "") 

            else :

                print("." , end = "")

        print()
    print()








Measured memory_bytes: 7004
HW = input().split()
hw = input().split()
HW[0] = int(HW[0])
HW[1] = int(HW[1])
hw[0] = int(hw[0])
hw[1] = int(hw[1])
count = 0

HW_list = [[0] * HW[1] for i in range(HW[0])]

for i in range(0, hw[0]):
    for j in range(0, len(HW_list[0])):
        HW_list[i][j] = 1

for i in range(0, hw[1]):
    for j in range(0, len(HW_list)):
        HW_list[j][i] = 1

for i in range(0, HW[0]):
    for j in range(0, HW[1]):
        if HW_list[i][j] == 0:
            count += 1

print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define out() fflush(stdout)
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;

void solve(){
	ll a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	if(a<b){
		if(a+v*t>=b+w*t)cout<<"YES";
		else cout<<"NO";
	}
	else{
		if(a-v*t<=b-w*t)cout<<"YES";
		else cout<<"NO";
	} 
}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define debug1(a) cout<<" a : "<<a<<"\n"
#define debug2(a,b) cout<<" a : "<<a<<" b : "<<b<<"\n"
#define debug3(a,b,c) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<" d : "<<d<<"\n"
// #define M 421412341324321
#define MOD 998244353 


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

	int a[m+1][3];

	rep(i,m)
	{
		cin>>a[i+1][0]>>a[i+1][1]>>a[i+1][2];
		a[i+1][2] = p-a[i+1][2];
	}
	vector <int> d(n+1, INT_MAX);
	d[1] = 0;

	rep(i,n-1)
	{
		REP(j,1,m)
		{
			int x = a[j][0], y = a[j][1], w = a[j][2];
			if ( d[y]>d[x]+w)
			{
				d[y] = d[x]+w;
			}
		}
	}
	int temp = d[n];
	rep(i,n-1)
	{
		REP(j,1,m)
		{
			int x = a[j][0], y = a[j][1], w = a[j][2];
			if ( d[y]>d[x]+w)
			{
				d[y] = d[x]+w;
			}
		}
	}
	if (d[n]<temp) cout<<-1;
	else
	{
		int ans = max(0LL,-d[n]);
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 384
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string a = ReadLine();
        string b = ReadLine();
        string c = ReadLine();
        string st = a[0].ToString();
        a = a.Remove(0,1);
        int al = a.Length,bl = b.Length,cl = c.Length;
        if(al == 0){
            WriteLine("A");
        }else{
        while(al>=0 && bl>=0 && cl>=0){
            if(st == "a"){
                if(al>0){
                    st = a[0].ToString();
                    a = a.Remove(0,1);
                    al = a.Length;
                }else{
                    al--;
                    WriteLine("A");
                }

            }else if(st == "b"){
                if(bl>0){
                    st = b[0].ToString();
                    b = b.Remove(0,1);
                    bl = b.Length;
                }else{
                    bl--;
                    WriteLine("B");
                }

            }else if(st == "c"){
                if(cl>0){
                    st = c[0].ToString();
                    c = c.Remove(0,1);
                    cl = c.Length;
                }else{
                    cl--;
                    WriteLine("C");
                }
            }
        }
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

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

       String str = sc.nextLine();

       int q = Integer.parseInt(sc.nextLine());

       int a,b;
       String order,replace_str,reverse_str,print_str;
       StringBuffer sb,sb_reverse;
       for(int i = 0;i < q;i++){
           order = sc.next();
           sb = new StringBuffer(str);
           a = Integer.parseInt(sc.next());
           b = Integer.parseInt(sc.next());
           switch(order){
            case "replace":
                replace_str = sc.next();
                sb.replace(a,b + 1,replace_str);
                str = sb.toString();
                break;
            case "reverse":
                reverse_str = str.substring(a,b + 1);
                sb_reverse = new StringBuffer(reverse_str);
                sb_reverse.reverse();
                sb.delete(a,b + 1);
                sb.insert(a,sb_reverse);
                str = sb.toString();
                break;
            case "print":
                print_str = str.substring(a,b + 1);
                System.out.println(print_str);
                break;
            }
        }
    }
}


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

using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define PRIME 1000000007
#define ADD(a, b) (((a) % PRIME + (b) % PRIME) % PRIME)
#define MUL(a, b) ((((a) % PRIME) * ((b) % PRIME)) % PRIME)
#define SUB(a, b) (((a) % PRIME - (b) % PRIME + PRIME) % PRIME)
#define ll long long
#define FIND_VECTOR(v, i) find((v).begin(), (v).end(), i)
#define IS_UNIQUE(v, i) (FIND_VECTOR(v,i) == (v).end())
#define INDEX(v, i) (FIND_VECTOR(v, i) - (v).begin())

typedef struct {
	ll x1, x2, y;
} x_line;
typedef struct {
	ll x, y1, y2;
} y_line;

void append_unique(vector<ll>* v, ll val) {
	if (IS_UNIQUE(*v, val)) {
		v->push_back(val);
	}
}
int index(vector<ll>* v, ll val) {
	return INDEX(*v, val);
}
x_line xl[2000];
y_line yl[2000];
int grid[6001][6001] = {};

void solve() {
	int n, m; cin >> n >> m;
	vector<ll> x_axis, y_axis;
	append_unique(&x_axis, 0);
	append_unique(&y_axis, 0);

	REP(i, n) {
		cin >> xl[i].x1 >> xl[i].x2 >> xl[i].y;
		append_unique(&x_axis, xl[i].x1);
		append_unique(&x_axis, xl[i].x2);
		append_unique(&y_axis, xl[i].y);
	}
	REP(i, m) {
		cin >> yl[i].x >> yl[i].y1 >> yl[i].y2;
		append_unique(&x_axis, yl[i].x);
		append_unique(&y_axis, yl[i].y1);
		append_unique(&y_axis, yl[i].y2);
	}

	sort(x_axis.begin(), x_axis.end());
	sort(y_axis.begin(), y_axis.end());

	// grid[2x+1][2y+1]
	REP(i, n) {
		int y = index(&y_axis, xl[i].y) * 2;
		int x_begin = index(&x_axis, xl[i].x1) * 2;
		int x_end = index(&x_axis, xl[i].x2) * 2;
		for (int x = x_begin; x <= x_end; x++) {
			grid[x][y] = -1;
		}
	}
	REP(i, m) {
		int x = index(&x_axis, yl[i].x) * 2;
		int y_begin = index(&y_axis, yl[i].y1) * 2;
		int y_end = index(&y_axis, yl[i].y2) * 2;
		for (int y = y_begin; y <= y_end; y++) {
			grid[x][y] = -1;
		}
	}

	// search
	queue<pair<int, int>> q;
	pair<int, int> rs[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}};
	bool out_of_bound = false;
	q.push(make_pair(index(&x_axis, 0) * 2, index(&y_axis, 0) * 2));
	grid[index(&x_axis, 0) * 2][index(&y_axis, 0) * 2] = 1;
	while (!q.empty()) {
		auto p = q.front(); q.pop();
		for (auto r : rs) {
			int x = p.first + r.first;
			int y = p.second + r.second;
			if (x < 0 || y < 0 || x > 2 * x_axis.size() - 2 || y > 2 * y_axis.size() - 2) {
				out_of_bound = true;
				break;
			}
			if (grid[x][y] == 0) {
				grid[x][y] = 1;
				q.push(make_pair(x, y));
			}
		}
		if (out_of_bound)break;
	}


	if (out_of_bound) {
		cout << "INF" << endl;
	}
	else {
		ll area = 0;
		for (int x = 0; x <x_axis.size() - 1; x++) {
			for (int y = 0; y <y_axis.size() - 1; y++) {
				area += grid[2 * x + 1][2 * y + 1] * (x_axis[x + 1] - x_axis[x]) * (y_axis[y + 1] -y_axis[y]);
			}
		}
		cout << area << endl;
	}
}

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

Measured memory_bytes: 144268
#include <stdio.h>

int main(void){
 
    int a,b,c,tem;
 
    scanf("%d %d %d",&a,&b,&c);
    
         if(b < a){
        tem = a;
        a = b;
        b = tem;
        
    }   if(c < b){
        tem = b;
        b = c;
        c = tem;

    }  if(b < a){
       tem = a;
       a = b;
       b = tem;
    }
    
    printf("%d %d %d\n",a,b,c);
    return 0;
}


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

int main() {
    int A;
    int B;
    cin >> A >> B;

    if(A >= 13){
        cout << B << endl;
    }else if(A >= 6 && A <=12){
        cout << B / 2 << endl;
    }
    else{
        cout << "0" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char a[105];
int main()
{
	int n,flag=1;
	cin>>n;
	for (int i=1;i<=n;i++)  cin>>a[i];
	if (n%2==1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	for (int i=1;i<=n/2;i++)
	{
		if (a[i]!=a[i+(n/2)])  flag=0;
	}
	if (flag==1)  cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <cstdio>

const int MaxN = 3000;
const int Mod = 998244353;

int N, M;
int A[MaxN + 5];
int F[MaxN + 5][3];

inline int add(int x, int y) { return (x += y) >= Mod ? x - Mod : x; }
inline void inc(int &x, int y = 1) { x = add(x, y); }

void init() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
}

void solve() {
  F[0][0] = 1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= M; ++j) inc(F[j][1], F[j][0]);
    for (int j = M; j >= A[i]; --j) inc(F[j][1], F[j - A[i]][1]);
    for (int j = 0; j <= M; ++j) inc(F[j][2], F[j][1]);
  }
  printf("%d\n", F[M][2]);
}

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

Measured memory_bytes: 256
import java.util.Scanner;

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

                int N = scan.nextInt();
                int M = scan.nextInt();
                long K = scan.nextLong();

                long[] A = new long[N+1];
                long[] B = new long[M+1];
                
                A[0] = 0;
                B[0] = 0;

                for (int n = 1; n <= N; n++) {
                	A[n] = A[n-1] + scan.nextLong();
                }

                for (int m = 1; m <= M; m++) {
                	B[m] = B[m-1] + scan.nextLong();
                }

                int Aposition = N;
                int Bposition = 0;

                int max = 0;

                while (Aposition >= 0) {
                	if (A[Aposition] <= K) {
                		long nokori = K - A[Aposition];
                		while (Bposition+1 <= M && nokori >= B[Bposition+1]) {
                			Bposition++;
                		}
                		if (max < Aposition + Bposition) {
                			max = Aposition + Bposition;
                		}
                	}
            		Aposition--;
                }

                System.out.println(max);

                scan.close();

        }

}

Measured memory_bytes: 65052
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  string s;
  int ans = 0;
  
  cin >> s;

  for(int i=0;i<s.size();i++){
    ans += s[i] != "CODEFESTIVAL2016"[i];
  }

  cout << ans << endl;
  
  return 0;
}


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

int main()
{
  int n;
  cin>>n;
  int a[n];
  for (int i = 0;i<n;i++){
    cin >> a[i];
  }
  sort(a, a + n);
  cout << a[n-1] - a[0] << endl;
} 


Measured memory_bytes: 256
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res
  
n = int(input())
x = power_func(10, n, (10**9 + 7))
y = power_func(8, n, (10**9 + 7))
z = power_func(9, n, (10**9 + 7))
print((x + y - 2 * z) % (10**9 + 7))

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

int main() {
  vector<int> v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(v.begin(), v.end());
  if(v[0]+v[1]==v[2]){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

int main(){
	using P = pair<ll,ll>;
	int n;
	ll d;
	ll a;
	scanf("%d%lld%lld",&n,&d,&a);
	d *= 2;
	P monsters[n];
	for(auto &i:monsters){
		scanf("%lld%lld",&i.first,&i.second);
	}
	sort(monsters,monsters+n);

	ll ans = 0;
	ll sum_damage = 0;
	int rp = 0;
	for(auto &i:monsters){
		while(rp<n&&monsters[rp].first<=i.first+d){
			monsters[rp].second += sum_damage;
			++rp;
		}
		ll hp = i.second - sum_damage;
		if(hp>0){
			ll time = (hp + a - 1) / a;
			ans += time;
			sum_damage += time * a;
		}
	}

	printf("%lld\n",ans);

}


Measured memory_bytes: 3328
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 3e5 + 123;
int n, a, b;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    cin >> n >> a >> b;
    if (n < b) {
        cout << -1;
        return 0;
    }
    vector <int> vec;
    vec.pb(b);
    int x = n - b, y = a - 1;
    while (y > 0) {
        if (x < y) {
            cout << -1;
            return 0;
        }
        int mx = min(b, x - y + 1);
        vec.pb(mx);
        x -= mx;
        y--;
    }
    if (x > 0) {
        cout << -1;
        return 0;
    }
    reverse(all(vec));
    int cur = 1;
    for (auto i : vec) {
        for (int j = cur + i - 1; j >= cur; j--) {
            cout << j << ' ';
        }
        cur += i;
    }
}



Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

bool prime[100001];

void pr(){
    int i,j;
    int sq_num = (int)sqrt((double)100000);
    prime[1]=false;
    for (i = 2; i < sq_num; i++) {
        if (prime[i] == true)
            for (j=2 ; i*j <= 100000; j++)
                prime[i*j] = false;
    }
}

int main(){
    memset(prime,true,sizeof(prime));
    int Q;
    cin >> Q;
    pr();
    int imos[100001];
    int sum=0;
    bool cimos[100001];
    memset(cimos,false,sizeof(cimos));
    for(int i=1;i<=100000;i+=2){
        if(prime[i]==true&&prime[(i+1)/2]==true){
            sum++;
            imos[i]=sum;
            cimos[i]=true;
        }
        else imos[i]=sum;
    }
    for(int i=0;i<Q;i++){
        int l,r;
        cin >> l >> r;
        if(cimos[r]==true&&cimos[l]==true) cout << imos[r]-imos[l]+1 << endl;
        else if(cimos[r]==false&&cimos[l]==true) cout << imos[r]-imos[l]+1 << endl;
        else cout << imos[r]-imos[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int x,a,b;
  cin >> x >> a >> b;

  x -= a;
  cout << x%b << endl;
}


Measured memory_bytes: 256
use proconio::{input, fastout};
#[fastout]
fn main() {
    input!{
        h: usize,
    }

    let mut r = h;
    let mut cnt = 0;
    while r != 1 {
        r /= 2;
        cnt += 1;
    }
    println!("{}", 2_u64.pow(cnt+1)-1);
}


Measured memory_bytes: 2172
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.TreeSet;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CKthSubstring solver = new CKthSubstring();
        solver.solve(1, in, out);
        out.close();
    }

    static class CKthSubstring {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
        /*
        明らかにk番目の文字列の長さはk以下であることが見えているのですくなさそう
        そのままやるだけでは…？
        mleに注意が必要そうってくらいか
         */
            String s = in.next();
            int k = in.nextInt();
            TreeSet<String> ts = new TreeSet<>();
            for (int i = 0; i < s.length(); i++) {
                for (int j = i + 1; j <= s.length(); j++) {
                    if (j - i <= k) {
                        ts.add(s.substring(i, j));
                    }
                }
            }

            for (String t : ts) {
                k--;
                if (k == 0) {
                    out.println(t);
                    break;
                }
            }


        }

    }
}



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

int main() {
	int N, K; cin >> N >> K;
	vector<int> tree(N);
	
	for( int i = 0; i < N; i++ ){
		cin >> tree[i];
	}
	
	sort( tree.begin(), tree.end() );
	
	vector<int> tree_rel;
	for( int i = 0; i < N - 1; i++ ){
		tree_rel.push_back(tree[ i + 1 ] - tree[ i ]);
	}
	
	int ans, X = 0;
	
	for( int i = 0 ; i < K - 1 ; i++ ){
		X += tree_rel[i];
	}
	ans = X;
	
	for( int i = 0 ; i < N - K ; i++ ){
		X -= tree_rel[i];
		X += tree_rel[i + K - 1];
		ans = min(ans, X);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
//*
int n, ans = 0;

bool check(long long x)
{
    string s = to_string(x);
    bool f3, f5, f7;
    f3 = f5 = f7 = false;
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i] == '3') f3 = true;
        else if (s[i] == '5') f5 = true;
        else if (s[i] == '7') f7 = true;

        if (f3 && f5 && f7)
        {
            return true;
        }
    }
    return false;
}

void dfs(long long x)
{
    if (x <= n)
    {
        if (check(x))
        {
            ++ans;
        }
        dfs(10 * x + 3);
        dfs(10 * x + 5);
        dfs(10 * x + 7);
    }
}

int main()
{
    cin >> n;
    dfs(0);
    cout << ans << endl;
}// */

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

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


int main() {
	string s; cin >> s;
	bool ok = true;
	forn(i, s.size()) {
		if(i % 2 == 0)
			if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
				continue;
			else
				ok = false;
		else
			if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
				continue;
			else
				ok = false;
	}
	if(ok)
		printf("Yes");
	else
		printf("No");
	return 0;
}










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

using namespace std;

int main() {

    string s;
    cin >> s;

    stack<char> sc;
    sc.push(s[0]);

    int ans = 0;
    for (size_t i = 1; i < s.size(); ++i) {

        if (sc.empty())
            sc.push(s[i]);
        else {
            if (sc.top() == s[i]) {
                sc.push(s[i]);
            } else {
                sc.pop();
                ans += 2;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int array[] = new int[5];
        array[0] = sc.nextInt();
        array[1] = sc.nextInt();
        array[2] = sc.nextInt();
        array[3] = sc.nextInt();
        array[4] = sc.nextInt();
        for(int i=0; i<array.length; i++) {
            if(array[i] == 0){
                System.out.println(i + 1);

            }
        }
        }
    }

Measured memory_bytes: 35732
n,x=map(int,input().split())
m=[]
for i in range(n):
    m.append(int(input()))
m.sort()
for i in range(n):
    if x<m[i]:
        ans=i
        break
if x>=sum(m):
    ans=n+(x-sum(m))//m[0]
print(ans)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
s = 0

A = sorted(A)
B = sorted(B)
C = sorted(C)

ia = -1
ic = -1

for b in B:
  while True:
    if ia == N-1 or A[ia+1]>=b: 
      break
    ia += 1
  while True:
    if ic == N-1 or C[ic+1]>b:
      break
    ic += 1
  s += (ia+1)*(N-ic-1)
    
print(s)

Measured memory_bytes: 23328
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
	cin >> s;
	int pos1 = s.find('C'), pos2 = s.rfind('F');
	if (pos1 == -1 || pos2 == -1) puts("No");
	else if (pos2 > pos1) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc074
// status:
// tag:

#define SUBMIT
//#define DEBUG

#include <bits/stdc++.h>
using namespace std;

const int MAX_F = 3000;

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    stringstream stream(R"(17 19 22 26 55 2802
)");
#endif
    int A, B, C, D, E, F;
    stream >> A >> B >> C >> D >> E >> F;
    A *= 100; B *= 100;

    set<int> sum_waters;
    set<int> sum_sugars;
    for (int i = 0; i <= MAX_F / A; ++i) {
        for (int j = 0; j <= MAX_F / B; ++j) {
            if (i == 0 && j == 0) continue;
            auto sum = A * i + B * j;
            if (F < sum) continue;
            sum_waters.insert(sum);
        }
    }

    for (int i = 0; i <= MAX_F / C; ++i) {
        for (int j = 0; j <= MAX_F / D; ++j) {
            auto sum = C * i + D * j;
            if (F < sum) continue;
            sum_sugars.insert(sum);
        }
    }

    int best_w = 0;
    int best_s = 0;
    double max_c = -1.0;
    for (auto w : sum_waters) {
        for (auto s : sum_sugars) {
            if (F < w + s) continue;
            if (E * w / 100 < s) continue;
            double c = static_cast<double>(s) / (w + s);
            if (max_c < c) {
                max_c = c;
                best_w = w;
                best_s = s;
            }
        }
    }

    cout << (best_w + best_s) << " " << best_s << endl;
    return 0;
}

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

int main(){
  int H, W; cin >> H >> W;
  vector<vector<bool>> board(H + 1, vector<bool>(W + 1, true));
  rep(i, H) rep(j, W) {
    char s; cin >> s;
    if (s == '.') board[i + 1][j + 1] = true;
    else board[i + 1][j + 1] = false;
  }

  constexpr int INF = 1e9 + 10;
  vector<vector<int>> dp(H + 1, vector<int>(W + 1, INF));
  dp[1][1] = 0;
  rep(i, H) rep(j, W) {
    if (i + j == 0) continue;
    int a = dp[i + 1][j];
    if (!board[i + 1][j] && board[i + 1][j + 1]) a++;
    int b = dp[i][j + 1];
    if (!board[i][j + 1] && board[i + 1][j + 1]) b++;
    dp[i + 1][j + 1] = min(a, b);
  }
  int ans = dp[H][W];
  if (!board[H][W]) ans++;

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        if(((a % 2)*(b % 2)) == 1){
            System.out.println("Odd");
        }
        else{
            System.out.println("Even");
        }
    }
}

Measured memory_bytes: 23764
from math import sqrt
x1, y1, r1 = map(int, raw_input().split())
x2, y2, r2 = map(int, raw_input().split())

def solve(x1, y1, r1, x2, y2, r2):
    rr0 = (x2 - x1)**2 + (y2 - y1)**2
    xd = x2 - x1
    yd = y2 - y1
    rr1 = r1**2; rr2 = r2**2
    cv = (rr0 + rr1 - rr2)
    sv = sqrt(4*rr0*rr1 - cv**2)
    return (
        (x1 + (cv*xd - sv*yd)/(2.*rr0), y1 + (cv*yd + sv*xd)/(2.*rr0)),
        (x1 + (cv*xd + sv*yd)/(2.*rr0), y1 + (cv*yd - sv*xd)/(2.*rr0)),
    )

p0, p1 = sorted(solve(x1, y1, r1, x2, y2, r2))
print "%.08f %.08f %.08f %.08f" % (p0 + p1)

Measured memory_bytes: 6512
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

ll dfs(vector<vector<int>> path, vector<bool> visited, int at, int visit_num) {

    if (visited[at])
        return 0;
    if (visit_num == visited.size())
        return 1;

    visited[at] = true;

    ll ret = 0;
    for (auto next : path[at])
        ret += dfs(path, visited, next, visit_num + 1);

    visited[at] = false;
    return ret;
}

void solve() {
    ini(N, M);
    vector<vector<int>> path(N);
    rep(i, M) {
        ini(a, b);
        a--, b--;
        path[a].push_back(b);
        path[b].push_back(a);
    }

    vector<bool> visited(N, false);
    out(dfs(path, visited, 0, 1)); 
}


Measured memory_bytes: 3604
N, A, B = gets.split(" ").first(3).map(&:to_i)
Prices = gets.split(" ").first(N).map(&:to_i).sort_by{|n| -n}

tmp_pairs = (A..B).map{|n|
  [n, Prices.first(n).inject(0, :+).quo(n)]
}
ave = tmp_pairs.max_by{|n, price| price}[1]
pairs = tmp_pairs.select{|n, _ave| ave == _ave}

n = pairs.map{|n, ave|
  prices = Prices.select{|price| price >= Prices[n-1] }
  min_prices = prices.select{|p| p == prices.min}
  min_prices.combination(n - (prices.size - min_prices.size)).size
}.inject(0, :+)
puts "%.6f" % ave
puts n


Measured memory_bytes: 1788
///-BISMILLAHIR RAHMANIR RAHIM-///
/*Author : Naheen Mohammad Kadir (A LOOSER)*/
/***********************************************/
/*Dear online judge:
* I've read the problem, and tried to solve it.
* Even if you don't accept my solution, you should respect my effort.
* I hope my code compiles and gets accepted. {IN SHAA ALLAH<3}
*      |\          |
*      | \         |
*      |  \        |
*      |   \       |
*      |    \      |
*      |     \     |AHEEN
*      |      \    |
*      |       \   |
*      |        \  |
*      |         \ |
*      |          \|
*/
#include <bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define pb push_back
#define scn(n) scanf("%lld",&n)
#define pi acos(-1)
#define ll long long
#define llu unsigned long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
int main()
{
    fast;
    ll t;
    cin>>t;
    vector<ll>x(t),y(t);
    ll i,j,k;
    double d1=0,d2=0,d3=0,d_in=0;
    for(i=0; i<t; i++)
    {
        cin>>x[i];
    }
    for(i=0; i<t; i++)
    {
        cin>>y[i];
    }
    for(i=0; i<t; i++)
    {
        d1+=fabs(x[i]-y[i]);
        d2+=fabs(x[i]-y[i])*fabs(x[i]-y[i]);
        d3+=fabs(x[i]-y[i])*fabs(x[i]-y[i])*fabs(x[i]-y[i]);
        d_in=max(d_in,fabs(x[i]-y[i]));
    }
    cout<<setprecision(13)<<d1<<endl;
    cout<<setprecision(13)<<sqrt(d2)<<endl;
    cout<<setprecision(13)<<cbrt(d3)<<endl;
    cout<<setprecision(13)<<d_in<<endl;
    return 0;
}



Measured memory_bytes: 3452
package main

import "fmt"

func main() {
	// Code for A - Don't be late
	var D, T, S int
	fmt.Scanf("%d %d %d", &D, &T, &S)

	if D <= S*T {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1832
#include <cstdio>
#include <algorithm>
#include <cstring>

const char *S[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

int main() {
	char s[4];
	int i;
	
	scanf("%s", s);
	for(i=0; i<7; i++) 
		if(!strcmp(s, S[i])) 
			printf("%d\n", 7 - i);
	return 0;
} 

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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<ll> a(n); {
		rep(i, n) cin >> a[i];
	}

	ll ans = 0;
	while(1) {
		sort(a.begin(), a.end());
		if (a.back() < n) break;
		ll k = a.back() / n;
		a.back() %= n;
		rep(i, n - 1) a[i] += k;
		ans += k;
	}
	printf("%lld\n", ans);
	return 0;
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


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

    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];
    rep(i, n) numbers[i]--;

    int ans = 0;
    rep(i, n - 1) {
        if (numbers[i] == i) {
            swap(numbers[i], numbers[i + 1]);
            ans++;
        }
    }
    if (numbers[n - 1] == n - 1) ans++;
    cout << ans << endl;
}



Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
namespace AtCoder_Beginner_Contest_127
{
    class Program
    {
        public class Combination
        {
            readonly long mod;
            readonly long[] fac, finv, inv;
            public Combination(long n, long mod = 1000000007)
            {
                long max = n + 1;
                this.mod = mod;
                fac = new long[max];
                finv = new long[max];
                inv = new long[max];
                fac[0] = fac[1] = 1;
                finv[0] = finv[1] = 1;
                inv[1] = 1;
                for (int i = 2; i < max; ++i)
                {
                    fac[i] = fac[i - 1] * i % mod;
                    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                    finv[i] = finv[i - 1] * inv[i] % mod;
                }
            }
            public long com(int n, int k)
            {
                if (n < k) return 0;
                if (n < 0 | k < 0) return 0;
                return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
            }
        }
        static public List<int> SIn() { return ReadLine().Split().Select(int.Parse).ToList(); }
        static void Main(string[] args)
        {
            var NMK = SIn();
            var N = NMK[0];//N行
            var M = NMK[1];//M列
            var K = NMK[2];//K個

            long mod = 1000000000 + 7;
            long nsum = 0;
            for (int i = 1; i <= N - 1; ++i)
            {
                nsum = nsum + (long) i * (N - i) % mod;
                nsum %= mod;
            }
            long msum = 0;
            for (int i = 1; i <= M - 1; ++i)
            {
                msum = msum + (long)i * (M - i) % mod;
                msum %= mod;
            }
            long sum = (nsum * (M * M % mod)) % mod + (msum * (N * N % mod)) % mod;
            sum %= mod;
            var cmb = new Combination(N * M - 2, mod);
            sum = sum * cmb.com(N * M - 2, K - 2) % mod;
            WriteLine(sum);
        }
    }
}

Measured memory_bytes: 15456
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    int n, x, y;
    cin>>n>>x>>y;
    x--; y--;
    vector<int> ans(n);
    for (int i = 0; i<n; i++)
        for (int j = i+1; j<n; j++)
        {
            int temp = j-i;
            temp = min(temp, abs(i - x) + 1 + abs(j - y));
            temp = min(temp, abs(i - y) + 1 + abs(j - x));
            ans[temp]++;
        }
    for (int i = 1; i<n; i++) cout<<ans[i]<<'\n';
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

const vector<int> di = {-1,0,1,0};
const vector<int> dj = {0,-1,0,1};

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> m (h, vector<char>(w));
    rep(i,h)rep(j,w) cin >> m.at(i).at(j);
    
    int ans = 0;
    rep(i,h)rep(j,w){
        queue<int> q;
        q.push(i); q.push(j);
        if(m.at(i).at(j) == '#') continue;
        vector<vector<int>> dist (h, vector<int>(w,-1));
        dist.at(i).at(j) = 0;
        while(!q.empty()){
            int ci = q.front(); q.pop();
            int cj = q.front(); q.pop();
            rep(k,4){
                int ni = ci+di.at(k);
                int nj = cj+dj.at(k);
                if(ni < 0 || ni > h-1 || nj < 0 || nj > w-1) continue;
                if(m.at(ni).at(nj) =='.' && dist.at(ni).at(nj) == -1) {q.push(ni); q.push(nj); dist.at(ni).at(nj) = dist.at(ci).at(cj)+1;}
            }
        }
        rep(I,h)rep(J,w) {{
            ans = max(ans, dist.at(I).at(J));
            //cout << dist.at(I).at(J);
            //if(J == w-1) cout << endl;
        }}
    }
    cout << ans << endl;
}

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

const int N=1e5+5;

int n, m, q;
int a[N], b[N];

int cost(int x, int p, int q)
{
    return abs(x-p) + abs(p-q);
}

int32_t main()
{
    IOS;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=m;i++)
        cin>>b[i];
    while(q--)
    {
        int ans=1e18;
        int x;
        cin>>x;
        int idx1=lower_bound(a+1, a+n+1, x) - a;
        int idx2=lower_bound(b+1, b+m+1, x) - b;
        for(int i=max(1LL, idx1-2);i<=min(n, idx1+2);i++)
        {
            for(int j=max(1LL, idx2-2);j<=min(m, idx2+2);j++)
            {
                ans=min(ans, cost(x, a[i], b[j]));
                ans=min(ans, cost(x, b[j], a[i]));
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#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> results = {"AC", "WA", "TLE", "RE"};
  map<string,int> count;
  for (string res: results) {
    count[res] = 0;
  }
  rep(_, N) {
    string S;
    cin >> S;
    count[S]++;
  }
  for (string res: results) {
    cout << res << " x " << count[res] << endl;
  }
  return 0;
}

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

int main(void){
    int N, M, X;
    cin >> N >> M >> X;
    int fee[M];

    int right = 0;
    int left = 0;

    for(int i = 0; i < M; i++){
        cin >> fee[i];
        if(X > fee[i])
            left++;
        if(X < fee[i])
            right++;
    }

        if(left <= right)
            cout << left << endl;
        else if(left > right)
            cout << right << endl;

        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

const int M = 30;

signed main() {
    int n;
    while(cin >> n, n) {
        int ans = INF;
        rep(i,0,M) rep(j,0,M) rep(k,0,M) {
            if(200*i + 300*j + 500*k != n) continue;
            double temp = 0;
            temp += (i/5*5)*380*0.8 + (i%5)*380;
            temp += (j/4*4)*550*0.85 + (j%4)*550;
            temp += (k/3*3)*850*0.88 + (k%3)*850;
            ans = min(ans, (int)temp);
        }
        cout << ans << endl;
    }    
    return 0;
}

Measured memory_bytes: 3080
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, ll> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}


int main(void){
	ll n,x,p,i,c,j,ans=1ll;
	cin >> n >> p;
	x = p;
	for(i=2ll; i*i<=p; ++i){
		c = 0ll;
		while(true){
			if(x%i){
				break;
			}
			++c;
			x /= i;
		}
		c /= n;
		for(j=0ll; j<c; ++j){
			ans *= i;
		}
	}
	if(x>1ll){
		c = 1ll/n;
		for(j=0ll; j<c; ++j){
			ans *= x;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define INF 0x7fffffff
#define M 15

typedef long long int LLI;

int n;
int m;
map<int, LLI> es[114514];

int main() {
  scanf("%d%d", &n, &m);
  for (int i=0; i<m; i++) {
    int a, b;
    LLI c;
    scanf("%d%d%lld", &a, &b, &c);
    es[a][b] = c;
    es[b][a] = c;
  }

  LLI ans = 0;
  for (int i=1; i<=n; i++) {
    if (es[i].size() > M) continue;

    int g = es[i].size();
    int lim = 1 << g;
    for (int k=0; k<lim; k++) {
      int idx = 0;
      LLI sum = 0;
      vector<int> vs;
      vs.emplace_back(i);
      for (auto e : es[i]) {
        if (k>>idx&1) {
          vs.emplace_back(e.first);
        }
        idx++;
      }

      for (int v : vs) {
        LLI mini = INF;
        for (int u : vs) {
          if (v == u) continue;
          if (!es[v].count(u)) {
            mini = INF;
            break;
          }
          mini = min(mini, es[v][u]);
        }
        sum += mini;
      }
      if (sum >= INF) sum = 0;
      ans = max(ans, sum);
    }
  }

  printf("%lld\n", ans);
}

Measured memory_bytes: 8672
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	X, Y := ReadInt(), ReadInt()
	if X > Y {
		X, Y = Y, X
	}
	if X == Y || X+1 == Y {
		fmt.Println("Brown")
	} else {
		fmt.Println("Alice")
	}
}

// func main() {
// 	for x := 0; x < 20; x++ {
// 		for y := x; y < 50; y++ {
// 			fmt.Printf("X:%d Y:%d, %v\n", x, y, solve(0, x, y))
// 		}
// 	}
// }
//
// var dp [2][1000][1000]*bool
//
// func solve(turn, X, Y int) bool {
// 	if Y < X {
// 		X, Y = Y, X
// 	}
// 	if Y <= 1 {
// 		return turn%2 == 1
// 	}
//
// 	if dp[turn%2][X][Y] != nil {
// 		return *dp[turn%2][X][Y]
// 	}
//
// 	for i := 1; 2*i <= X; i++ {
// 		next := solve(turn+1, X-2*i, Y+i)
// 		if turn%2 == 0 && next {
// 			dp[turn%2][X][Y] = &next
// 			return next
// 		}
// 		if turn%2 == 1 && !next {
// 			dp[turn%2][X][Y] = &next
// 			return next
// 		}
// 	}
//
// 	for i := 1; 2*i <= Y; i++ {
// 		next := solve(turn+1, X+i, Y-2*i)
// 		if turn%2 == 0 && next {
// 			dp[turn%2][X][Y] = &next
// 			return next
// 		}
// 		if turn%2 == 1 && !next {
// 			dp[turn%2][X][Y] = &next
// 			return next
// 		}
// 	}
//
// 	ans := turn%2 == 1
// 	dp[turn%2][X][Y] = &ans
// 	return ans
// }

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
import sys

def resolve():
    readline=sys.stdin.readline
    k=int(readline())
    to=10**6
    svn=[0]*to
    svn[0]=7%k
    if svn[0]==0:
      print(1)
      return
    for i in range(1,to):
      svn[i]=(svn[i-1]*10)%k
    for i in range(1,to):
      svn[i]+=svn[i-1]
      if svn[i]%k==0:
        print(i+1)
        return
      
    print(-1)
    return
resolve()

Measured memory_bytes: 64308