akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	/*if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;*/
	return ((a.x + 1)*(a.y + 1)) < ((b.x + 1)*(b.y + 1));
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k, ll p) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
 //#define int long long
const long long Inf = 4523372036854775807;
const int inf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int a[3000000];
int b[3000000];
vector<int>c;
signed main() {
	int x = 1;
	for (int i = 1; i < 2500000; i++) {
		a[i] = i;
		b[i] = i;
	}
	while (x*(x+1)*(x+2)/6<=1000000) {
		c.push_back(x*(x + 1)*(x + 2) / 6);
		x++;
	}
	for (int i = c.size() - 1; i >= 0; i--) {
		for (int j = 0; j <= 1000000; j++) {
			if (j + c[i] > 1000000) break;
			a[j + c[i]] = min(a[j] + 1, a[j + c[i]]);
			if (c[i] % 2 == 1) b[j + c[i]] = min(b[j] + 1, b[j + c[i]]);
		}
	}
	int n;
	while (cin >> n&&n) {
		cout << a[n] << " " << b[n] << endl;
	}
	getchar(); getchar();
}


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

#define ll long long
#define debug(x) cerr << fixed << #x << " is " << x << endl;

const int MAX = 100005;
ll town[MAX];

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

	ll n, a, b;
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++)
		cin >> town[i];

	ll ans = 0;
	for(int i = 1; i < n; i++)
		ans += min((town[i]-town[i-1])*a, b);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ull B = 100000007;
int mod = 1000000007;

class Solution {
public:
    int a(int N) {
        return (1000 - N % 1000) % 1000;
    }
};

int main() {
    int n;
    cin >> n;
    Solution zhy;
    cout << zhy.a(n) << endl;
    return 0;
}

Measured memory_bytes: 3596
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        // long u = sc.nextLong();
        // long D = sc.nextLong();
        // long K = sc.nextLong();

        int N = sc.nextInt();
        // int X = sc.nextInt();

        int[] W = new int[N];
        int s2 = 0;
        for (int i = 0; i < N; i++) {
            W[i] = sc.nextInt();
            s2 += W[i];
        }

        int s1 = 0;
        int minimumDiff = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            s1 += W[i];
            s2 -= W[i];

            minimumDiff = Math.min(minimumDiff, Math.abs(s1 - s2));
        }

        System.out.println(minimumDiff);
    }
}

Measured memory_bytes: 23764
#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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const 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);
    string s, t;
    cin >> s >> t;
    cout << t + s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int isPrime(int);


int main(){
    int i,j,N,pnum=0;
    cin >> N;

    int a[N];
    for(i = 0;i < N; i++){
        cin >> a[i];
    }

    for(j=0;j < N;j++){
        pnum += isPrime(a[j]);
    }
    
    cout << pnum << "\n";


    return 0;
}

int isPrime(int a){
    int n,i,tf=0;
    double s;
    s = sqrt(a);
    n = s;

    i=2;
    if(a >= 2){
        while(i <= n){
            if(a % i ==0){
                tf = 1;
                break;
            }
            else{
            i++;
            }
        } 
    }else{
        tf = 0;
    }
    return (1-tf);
}


Measured memory_bytes: 3100
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        long a = Math.abs(sc.nextLong() - x);
        long b;
        n--;
        
        while (n-- > 0) {
            b = Math.abs(sc.nextLong() - x);
            // System.out.println(b);
            
            a = gcd(a, b);
        }
        
        System.out.println(a);
    }
    
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));
    }
    
    public static long gcd(long a, long b) {
        if (b == 0) return a;
        
        return gcd(b, a % b);
    }
}

Measured memory_bytes: 48236
#include <stdio.h>


int main(void)
{
    int section[10];
    int length, v1, v2, met;
    int i, j, eofcheck;

    while(1){
        for (i = 0; i < 10; i++){
            eofcheck = scanf("%d,", &section[i]);
            if (eofcheck == EOF) return (0);
        }
        scanf("%d,%d", &v1, &v2);
        length = 0;
        for (i = 0; i < 10; i++) length += section[i] * 1000;
        met = (v1 * length) / (v1 + v2);
        length = 0;

        for (i = 0; i < 10; i++){
            length += section[i] * 1000;
            if (length > met){
                printf("%d\n", i + 1);
                break;
            }else if(length == met){
                printf("%d\n", i + 1);
                break;
            }
        }
        //printf("Met at %d\n", met);
    }

    return (0);
}


Measured memory_bytes: 2040
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
temp=[a1,a2,a3,b1,b2,b3]
t1=temp.count(1)
t2=temp.count(2)
t3=temp.count(3)
t4=temp.count(4)
if max(t1,t2,t3,t4)==2:
  print("YES")
else:
  print("NO")

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

int main()
{
    string S, T;
    cin >> S;
    cin >> T;
    S += S;
    if(S.find(T) != string::npos) cout << "Yes" <<endl;
    else                          cout << "No"  <<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	static void Main(){
		string k="keyence";
		string s=Console.ReadLine();
		string ans="NO";
		for(int i=0;i<=0;i++){
			if(s[i]=='k'){
				int q=0;
				for(int j=7;j>0;j--){
					if(s.Substring(i,j)==k.Substring(0,j)){
						q=j;
						break;
					}
				}
				for(int j=s.Length-(7-q);j<=s.Length-(7-q);j++){
					if(s.Substring(j,7-q)==k.Substring(q,7-q)){
						ans="YES";
						break;
					}
				}
			}
		}
		if(s.Substring(0,7)==k){ans="YES";}
		if(s.Substring(s.Length-7,7)==k){ans="YES";}
		Console.WriteLine("{0}",ans);
	}
}

Measured memory_bytes: 13140
n, m = map(int, input().split())
# 逆順にunionfind
from collections import defaultdict
class UnionFind:
    def __init__(self, n):
        class KeyDict(dict):
            # 辞書にないときの対応
            def __missing__(self,key):
                self[key] = key
                return key
        self.parent = KeyDict()
        self.rank = defaultdict(int)
        self.weight = defaultdict(lambda:1)

    # 根を探す
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            # 経路圧縮
            # 自分自身じゃない場合は、上にさかのぼって検索(再帰的に)
            y = self.find(self.parent[x])
            self.parent[x] = y      #親の置き換え(圧縮)
            return self.parent[x]

    # 結合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 低い方を高い方につなげる(親のランクによる)
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
            self.weight[y] += self.weight[x]
            self.weight[x] = 0
        else:
            self.parent[y] = x
            self.weight[x] += self.weight[y]
            self.weight[y] = 0
        
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1


    # 判定
    def judge(self, x, y):
        return self.find(x) == self.find(y)

ps = []
for i in range(m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    ps.append((a,b))

uf = UnionFind(n)
now = n*(n-1)//2
ans = [now]
for a, b in ps[::-1]:
    if not uf.judge(a,b):
        n1 = uf.weight[uf.find(a)]
        n2 = uf.weight[uf.find(b)]
        now += n1*(n1-1)//2 + n2*(n2-1)//2 - (n1+n2)*(n1+n2-1)//2
        uf.union(a,b)
    ans.append(now)

for a in ans[::-1][1:]:
    print(a)

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

using pii = pair<int, int>;

int main() {
    int n, t;
    while(cin >> n >> t, n) {
        vector<int> m(n), l(n), k(n);
        for(int i = 0; i < n; ++i) {
            cin >> m[i] >> l[i] >> k[i];
        }

        auto check = [&] (int num) {
            vector<int> restore(t + 1);
            list<int> ls;
            for(int i = 0; i < n; ++i) ls.push_back(i);
            int remain = num;
            for(int i = 0; i <= t; ++i) {
                remain += restore[i];
                auto it = ls.begin();
                while(remain > 0 && it != ls.end()) {
                    const int idx = *it;
                    if(i % (l[idx] + k[idx]) <= l[idx]) {
                        --remain;
                        if(i + m[idx] > t) return false;
                        restore[i + m[idx]] += 1;
                        it = ls.erase(it);
                    } else {
                        ++it;
                    }
                }
            }
            return ls.empty();
        };
        for(int i = 1; i <= n; ++i) {
            if(check(i)) {
                cout << i << endl;
                break;
            }
        }
    }
}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define PI 3.141592653589793238
int main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("/home/pushkar/cpp/input.txt", "r", stdin);
    // freopen("/home/pushkar/cpp/output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h, w, k, i, j, p, q, ans = 0, c;
    cin >> h >> w >> k;
    vector <string> mat(h);
    for (i=0;i<h;i++)
    {
        cin >> mat[i];
    }
    for (i=0;i<(1<<h);i++)
    {
        for (j=0;j<(1<<w);j++)
        {
            c = 0;
            for (p=0;p<h;p++)
            {
                for (q=0;q<w;q++)
                {
                    if ((1<<p)&i && (1<<q)&j && mat[p][q] == '#')
                    c++;
                }
            }
            if (c == k)
            ans++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3648
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
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();}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

string yes="Yes",no="No";


int main(){
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    if(s[a]!='-'){ cout<<no<<endl;exit(0);}
    for(int i=0;i<s.size();i++){
        if(i!=a&&isdigit(s[i])==false){
            cout<<no<<endl;
            return 0;
        }
        
    }
    cout<<yes<<endl;
    




}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>

int main(){
  std::string s;
  std::cin >> s;
  std::map<char, int> mapA;
  bool isOK = true;
  for(int i = 0; i < s.size(); i++){
    if(mapA.count(s.at(i)) == 0) mapA[s.at(i)] = 1;
    else{
      isOK = false;
      break;
    }
  }
  if(isOK) std::cout << "yes" << std::endl;
  else std::cout << "no" << std::endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>

int main() {
    ll n;cin>>n;vl a(n);
    string ans="Yes";
    rep(i,n)cin>>a[i];
    for(ll i=n;i>0;i--)if(a[i-1]-1==a[i])a[i-1]-=1;
    rep(i,n-1)if(a[i]>a[i+1])ans="No";
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    string s, t;
    read(s, t);

    char convS[128] {};
    char convT[128] {};

    const int N = s.length();
    bool able = true;

    rep(i, N) {
        if (convS[s[i]] > 0) {
            able &= convS[s[i]] == t[i];
        } else {
            convS[s[i]] = t[i];
        }

        if (convT[t[i]] > 0) {
            able &= convT[t[i]] == s[i];
        } else {
            convT[t[i]] = s[i];
        }
    }

    print(able ? "Yes" : "No");

    return 0;
}


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

using namespace std;

const int MAX = (int) 1e5+11;
long long k, n, t, d, ans, D, type;
vector<pair<long long, long long>> v;
vector<long long> same;
bool used[MAX];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> t >> d;
        v.push_back(make_pair(d, t));
    }
    sort(v.rbegin(), v.rend());
    for (int i = 0; i < k; ++i) {
        D += v[i].first;
        if (!used[v[i].second]) {
            used[v[i].second] = 1;
            ++type;
        } else {
            same.push_back(v[i].first);
        }
    }
    ans = D + type * type;
    for (int i = k; i < n && same.size(); ++i) {
        if (used[v[i].second]) continue;
        used[v[i].second] = 1;
        ++type;
        D -= same.back();
        same.pop_back();
        D += v[i].first;
        ans = max(ans, D + type * type);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2672
import java.util.*;
import java.lang.*;
public class Main{
    public static void main(String args[]){
        str ans=new str();
        ans.sp();
    }
}
class str{
    String s;
    void sp(){
        Scanner sc=new Scanner(System.in);
        s=sc.nextLine();
        if(s.contains("A")&&s.contains("B")){
            System.out.println("Yes");
        }
        else System.out.println("No");
    }
}


Measured memory_bytes: 22100
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

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

    cout << A*B-(A+B-1) << endl;


    return 0;
}

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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int h, w;
	cin >> h >> w;
	REP(i, h)
	{
		string s;
		cin >> s;
		REP(i, 2)
		{
			print(s);
		}
	}
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int n,x,y;
    cin>>n>>x>>y;
    x--;
    y--;
    int dist[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dist[i][j]=n+2;
        }
    }
    unordered_map<int,ll>up;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            dist[i][j]=min(abs(i-j),dist[i][j]);
        }

    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){

            dist[i][j]=min(abs(abs(i-x)+1+abs(y-j)),dist[i][j]);

        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){

            up[dist[i][j]]++;

        }
    }

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


Measured memory_bytes: 16000
import sys
import math
from collections import deque
import heapq as hq

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    T = NI()
    for _ in range(T):
        N = NI()
        camels = [NLI() for _ in range(N)]
        base = 0
        camels_L = [[] for _ in range(N+1)]
        camels_R = [[] for _ in range(N+1)]
        # 左から詰めるラクダと右から詰めるラクダを仕分ける
        for camel in camels:
            if camel[1] >= camel[2]:
                camels_L[camel[0]].append(camel[1] - camel[2])
                base += camel[2] # LとRの低いほうを加算
            else:
                camels_R[N - camel[0]].append(camel[2] - camel[1])
                base += camel[1] # LとRの低いほうを加算
        ans = 0
        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_L[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop(heap_camels)
        ans += sum(heap_camels)

        heap_camels = []
        hq.heapify(heap_camels)
        for i in range(1, N+1):
            for camel in camels_R[i]:
                hq.heappush(heap_camels, camel)
            while len(heap_camels) > i:
                hq.heappop(heap_camels)
        ans += sum(heap_camels)
        print(ans + base)



if __name__ == "__main__":
    main()

Measured memory_bytes: 87540
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    S = input()
    if S == "Sunny":
        print("Cloudy")
    elif S == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")

if __name__ == '__main__':
    main()


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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int A,B;cin >> A >> B;
    int num = A;
    int n = 1;

    if(B == 1){
        cout << 0 << endl;
        return 0;
    }

    for (int i=1;num < B;i++){
        num += A-1;
        n++;
    }

    cout << n << endl;
}


Measured memory_bytes: 384
import std.stdio;

struct Team {
	string name;
	int score;
	int order;
	int opCmp(ref const Team t) const{
		return score != t.score ? (t.score - score) : (order - t.order); 
	}
}

void main(){
	string s;
	char[100] buf;
	int n, w, l, d;
	bool f = true;
	while (scanf("%d", &n), n) {
		if (f) f = false;
		else writeln();
		Team[] team;
		for (int i = 0; i < n; i++) {
			scanf("%s %d %d %d", &buf, &w, &l, &d);
			team ~= Team(buf.idup, w*3+d, i);
		}
		team.sort;
		foreach (t; team) printf("%s,%d\n", t.name.ptr,t.score);
	}
}

Measured memory_bytes: 1004
import java.util.Scanner;
 

public class Main {
	
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.nextLine());
        String s = sc.nextLine();
     
        char[] chars = s.toCharArray();
        StringBuilder bui = new StringBuilder(chars.length);
        for (char c: chars) {
        	c += n;
        	if (c > 'Z') {
        		c = (char)('A' + (c-'Z') -1);
        	}
        	bui.append(c);
        }
        
        System.out.println(bui.toString());
        sc.close();
	}
	
}


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

int main() {
  int m, f, r, i = 0;
  string R[50];

  for (i = 0; i < 50; i ++) {
  cin >> m  >> f >> r;

  if (m == -1 && f == -1 && r == -1)
    break;

  if (m == -1 || f == -1)
    R[i] = "F";

  else if  (m + f >= 80)
    R[i] = "A";

  else if (m + f >= 65 && m + f < 80)
    R[i] = "B";

  else if (m + f >= 50 && m + f < 65)
    R[i] = "C";

  else if (m + f >= 30 && m + f < 50) {
    if (r >= 50)
      R[i] = "C";
    else
      R[i] = "D";
  }

  else
    R[i] = "F";

  }

  for (int j = 0; j < i; j++)
    cout << R[j] << endl;

  return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){   
   int n,T;
   cin>>n>>T;
   int c,t;
   int flag=0;
   int cost=1000;
   rep(i,n){
      cin>>c>>t;
      if(t<=T){
         cost=min(cost,c);
         flag=1;
      }
   }
   if(flag==0) cout<<"TLE";
   else if(flag==1) cout<<cost;

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
long long gcd(long long x,long long y)
{
	if (y==0) return x;
	else return gcd(y,x%y);
}

int main()
{
	int n;
	scanf("%d",&n);
	while (n--)
	{
		long long a,b,c,d;
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if ((a<b) || (d<b)) {printf("No\n");continue;}
		if (b<=c) {printf("Yes\n");continue;}
		long long g=gcd(b,d);
		if ((a-c-1)/g-(a-b)/g>0) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}

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

#define ll long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define infl 1e18+9
#define sz(a) ((int)a.size())

ll mod=1e9+7;
const int nax=3e5+5; 

void self_mul(int &a, int b){
  a=(ll)a*b%mod; 
}
int add(int a, int b){
  return (a+b)%mod; 
}


void solve(){
  int n; cin>>n; 
  vector<double> p(n); 
  vector<double> dp(n+1); 
  dp[0]=1;
  for(int i=0;i<n;i++){
    cin>>p[i]; 
    vector<double> new_dp(n+1); 
    new_dp[0]=dp[0]*(1-p[i]); 
    for(int j=0;j<n;j++){
      new_dp[j+1]=dp[j]*p[i]+(1-p[i])*dp[j+1];  
    }
    dp=new_dp; 
  } 
  double ans=0; 
  for(int i=n/2+1;i<=n;i++){
    ans+=dp[i]; 
  }
  printf("%.10lf\n",ans); 
}

int main(){
	//fast_io;
	clock_t beg=clock();
  int t;
  t=1;
  while(t--){
	  solve();
  }
	clock_t end=clock();
	fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long int
#define MAX 1000007
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
	string s, t;
	cin >> s >> t;
	string temp = t+s;
	cout << temp;
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define maxn 2005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
using namespace std;
ll ksm(ll a, ll b) {
   if (!b) return 1;
   ll ns = ksm(a, b >> 1);
   ns = ns * ns % mod;
   if (b & 1) ns = ns * a % mod;
   return ns;
}
bitset<maxn * maxn / 2> r;
int a[maxn];
int s = 0; 
int main() {
	int n;
	cin >> n;
	r[0] = 1;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		r = (r | (r << a[i]));
		s += a[i];
	}
	if (s & 1) s++;
	s /= 2;
	while (!r[s]) s++;
	cout << s << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC120C()
{
	string S;
	cin >> S;
	int n0 = 0;
	int n1 = 0;
	for (auto& x : S)
	{
		if (x == '0')
			++n0;
		else
			++n1;
	}
	cout << min(n0, n1) * 2 << endl;
}

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


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

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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    vi cnt(M, 0);
    REP(i, N) {
        int K; cin >> K;
        REP(j, K) {
            int A; cin >> A; --A;
            cnt[A]++;
        }
    }

    int ans = 0;
    REP(i, M) if (cnt[i] == N) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] vs = new int[n];
        for (int i = 0; i < n; i++) {
            vs[i] = std.nextInt();
        }

        double ans = 0;

        PriorityQueue<Double> pq = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            pq.add((double) vs[i]);
        }

        while (!pq.isEmpty()) {
            double first = pq.poll();
            if (pq.isEmpty()) {
                ans = first;
                break;
            }
            double second = pq.poll();

            ans = (first + second) / 2.0;
            pq.add(ans);
        }

        System.out.println(ans);
    }
}


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

using namespace std;
using ll = long long;

int main() {
	ll n, ans = 0;
	cin >> n;
	vector<ll> num;
	rep(k, 2) {
		n -= (ll)k;
		if (n != 1) num.push_back(n);
		for (ll i = 2; i * i <= n; i++) {
			if (n % i == 0) {
				num.push_back(i);
				if (i * i != n) num.push_back(n / i);
			}
		}
		n += k;
	}
	for (ll i : num) {
		ll a = n;
		while(a % i == 0) a /= i;
		if (a % i == 1) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() 
{
    int N;
    cin>>N;
    vector<int>D;
    for (int i = 0; i < N; i++)
    {
        int d;
        cin>>d;
        D.push_back(d);
    }
    sort(D.begin(),D.end());

    int ans=D[N/2]-D[(N/2)-1];
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;

int main(){
  ll n_w = 0;
  ll sum_p = 0;
  
  char ch;
  
  ll i=1;
  
  while((ch = getchar()) != EOF){
    if(ch == 'W'){
      n_w++;
      sum_p += i;
    }
    i++;
  }
  
  cout << sum_p - n_w * (n_w + 1) /2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n,arr[100001];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (int i=0;i<n;i++) cin>>arr[i];
    for (int i=0;i<n;i++){
        if (arr[i]%2==1) continue;
        if (arr[i]%3!=0 && arr[i]%5!=0){
            cout<<"DENIED";
            return 0;
        }
    }
    cout<<"APPROVED";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a(n);
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  a.erase(unique(a.begin(),a.end()),a.end());
  cout << a.size() << endl;
}


Measured memory_bytes: 3164
from collections import Counter
def dis(i,j, x,y):
    return min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+(j-x))
n, x, y = map(int, input().split())
x,y = x-1,y-1
D = []
for i in range(n-1):
    for j in range(i+1, n):
        D.append(dis(i,j, x,y))
cD = Counter(D)
for i in range(1, n):
    print(cD[i])

Measured memory_bytes: 73224
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
int main()
{
	int64_t X;
	std::cin >> X;
	uint64_t money = 100;
	uint64_t year = 1;
	while (true) {
		money += money / 100;
		if (money >= X) {
			break;
		}
		else {
			++year;
		}
	}
	std::cout << year << std::endl;
	return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main(){
	int N, T;
	cin >> N >> T;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	vector<LL> M(N);
	int largest=0;
	for(int i=N-1; i>=0; i--){
		largest=max(largest,A[i]);
		M[i]=largest;
	}
	map<int,int> m;
	int max_dif=0;
	rep(i,N){
		int d=M[i]-A[i];
		m[d]++;
		max_dif=max(max_dif,d);
	}
	cout << m[max_dif] << endl;

	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ==========Union-Find============-
class UnionFind {
  // まとめる 親を調べる サイズを知る
 public:
  // Aから見た親の番号を格納する。rootだったら-1*その集合のサイズ。
  vector<int> Parent;

  // 初期化
  UnionFind(int N) { Parent = vector<int>(N, -1); }

  // Aのrootを調べる
  int root(int A) {
    if (Parent[A] < 0) return A;  // マイナスならそれはroot
    return Parent[A] = root(Parent[A]);
  }

  // rootの値をプラスに戻して返す(サイズ)
  int size(int A) { return -Parent[root(A)]; }

  // くっつける関数
  bool connect(int A, int B) {
    // AとBのroot同士をくっつける
    A = root(A);  // ここのAは、"rootの場所"の意味
    B = root(B);
    if (A == B) return false;  // 既にくっついている
    if (size(A) < size(B))
      swap(A, B);            // 大きい方にくっつけるために中身交換
    Parent[A] += Parent[B];  // 中身更新
    Parent[B] = A;
    return true;
  }
};

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}

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

int main() {
  ll n, m;
  cin >> n >> m;

  vector<int> lang[m];           // どの言語が誰を繋げるか
  for (int i = 0; i < n; i++) {  // i人目について
    int k, l;
    cin >> k;
    for (int j = 0; j < k; j++) {
      cin >> l, l--;
      lang[l].push_back(i);
    }
  }

  UnionFind uni(n);

  for (int i = 0; i < m; i++) {        // i番目の言語がそれぞれの人を繋げる
    if (lang[i].size() < 2) continue;  // 2人以上に話されていないのは意味がない
    for (int j = 0; j < lang[i].size() - 1; j++)
      uni.connect(lang[i][j], lang[i][j + 1]);
  }

  bool can = true;
  for (int i = 0; i < n; i++)
    if (uni.root(0) != uni.root(i)) can = false;

  cout << ((can) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 4608
/*
      author  : nishi5451
      created : 14.08.2020 18:06:54
*/

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


int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep(i,m) cin >> a[i];
    sort(a.begin(),a.end());
    int l = 0, r = 0;
    for(int i=0; i<m; i++){
        if(a[i]<x) l++;
        else r++;
    }
    cout << min(l,r) << endl;
    return 0;
}

Measured memory_bytes: 3600
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


def main():
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            if any(A[i][j] > A[i][k] + A[k][j] for k in range(N) if k != i and k != j):
                print(-1)
                return
            if all(A[i][j] < A[i][k] + A[k][j] for k in range(N) if k != i and k != j):
                ans += A[i][j]

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 47580
X, Y = map(int, input().split())
ans = 0
pay = [0, 300000, 200000, 100000]
if X == 1 and Y == 1:
    print(1000000)
    exit()
if X < 4:
    ans += pay[X]
if Y < 4:
    ans += pay[Y]

print(ans)

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

signed main() {
    int n, m; cin >> n >> m;
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        int l, r; cin >> l >> r;
        mp[l]++;
        mp[r + 1]--;
    }
    int ma = -1, bef = 0;
    for (auto& p : mp) {
        p.second += bef;
        bef = p.second;
        ma = max(ma, p.second);
    }
    int ans = 0;
    if (ma % 2) {
        int r = -1;
        for (auto it = mp.begin(); it != mp.end(); ++it) {
            if (ma == it->second) {
                r = next(it)->first - 1;
            }
        }
        ans = (ma - 1) * m + r;
    } else {
        int l = -1;
        for (auto& p : mp) {
            if (ma == p.second) {
                l = p.first;
                break;
            }
        }
        ans = (ma - 1) * m + m - l;
    }
    cout << ans << endl;
}



Measured memory_bytes: 28084
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv,  digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal ,RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag; vll D; vll path; vector<string> A; ll magic = 0; vpll list;
//***********//
int main() {
	cin >> X >> Y;
	if (abs(X - Y) <= 1) cout << "Brown";
	else cout << "Alice";
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T
{
    std::io::Read::bytes(std::io::stdin())
                    .map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>()
                    .parse().ok().unwrap()
}

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let ans: i32;

    if a <= b {
        ans = a;
    } else {
        ans = a - 1;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    c();
  }

  public static void c() {
    try (Scanner sc = new Scanner(System.in)) {
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Integer[] a = new Integer[y];
      for (int z = 0; z < y; z++) {
        a[z] = Integer.parseInt(sc.next());
      }
      Boolean flg = true;
      if (!Arrays.asList(a).contains(x)) {
        System.out.println(x);
        flg = false;
      }
      int ans = 0;
      if (flg) {
        for (int q = 1; q < y + 2; q++) {
          ans = x - q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
          ans = x + q;
          if (!Arrays.asList(a).contains(ans)) {
            System.out.println(ans);
            break;
          }
        }
      }
    } catch (Exception E) {
      System.out.println("エラー");
    }
  }
}

Measured memory_bytes: 35740
from math import sqrt

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

if N==1:
    print(P)
else:
    dic={}
    p=2
    while p<=sqrt(P):
        cnt=0
        while P%p==0:
            P=int(P/p)
            cnt+=1
        if cnt>0:
            dic[p]=cnt
        p+=1

    ans=1
    for p in dic.keys():
        ans *= p**int(dic[p]/N)
    print(ans)


Measured memory_bytes: 39536
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

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

typedef unsigned long ul;
using namespace std;

string s;
int times[5];

void solve() {
    int amari = 0;
    int res = 0;
    REP(i, 5) {
        if (times[i] % 10 == 0) {
            res += times[i];
        } else {
            res += ((times[i] / 10) + 1) * 10;
            amari = max(amari, 10 - times[i] % 10);
        }
    }
    res = res -amari;
    cout << res;
}

int main() {
    REP(i, 5) {
        cin >> times[i];
    }
    solve();
    return 0;
}


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

int main(){
  int n,m;

  for(;;){
    cin >> n >> m;
    if(!n && !m)break;

    string c;
    for(int i=0;i<n;i++)c += '#';

    for(int i=0;i<m;i++){
      char g;
      cin >> g;

      int pos;
      if(g == 'A'){
	pos = 0;
	while(c[pos]!='#')pos++;
      }else if(g == 'B'){
	pos = n-1;
	while(pos>=0){
	  if(c[pos]=='#'){
	    if( (pos==n-1 || c[pos+1]!='A') && (pos==0 || c[pos-1]!='A') )break;
	  }
	  pos--;
	}
	if(pos<0){
	  pos = 0;
	  while(c[pos]!='#')pos++;
	}
      }else if(g == 'C'){
	if(!i)pos = n/2;
	else{
	  pos = 0;
	  while(pos<n){
	    if(c[pos]!='#'){
	      if(pos<n-1 && c[pos+1]=='#'){
		pos++;
		break;
	      }
	      if(pos>0 && c[pos-1]=='#'){
		pos--;
	      break;
	      }
	    }
	    pos++;
	  }
	}
      }else{
	pos = 0;
	if(i){
	  int dis = 0;
	  int tmp = -1;
	  while(pos<n){
	    if(c[pos]=='#'){
	      int l = 1,r = 1;
	      while(pos-l>=0 && c[pos-l]=='#')l++;
	      while(pos+r<n && c[pos+r]=='#')r++;
	      if(pos-l<0){
		if(dis<r){
		  dis = r;
		  tmp = pos;
		}
	      }else if(pos+r>=n){
		if(dis<l){
		  dis = l;
		  tmp = pos;
		}
	      }else{
		if(dis<min(l,r)){
		  dis = min(l,r);
		  tmp = pos;
		}
	      }
	    }
	    pos++;
	  }
	  pos = tmp;
	}
      }
      c[pos] = g;
    }

    cout << c << endl;
  }
}

Measured memory_bytes: 0
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n=sc.nextLong();
		List<Long> yakusu = new ArrayList<>();
		List<Long> kotae  = new ArrayList<>();
		int count=0;
		for(long i=1;i<=Math.sqrt(n);i++) {
			if(n%i==0) {
				yakusu.add(i);
				kotae.add(n/i);
				count++;
			}
		}
long max= Long.MAX_VALUE;
		for(int i=0;i<count;i++) {
			long keta1=Long.toString(yakusu.get(i)).length();
			long keta2=Long.toString(kotae.get(i)).length();
			if(Math.max(keta1,keta2)<max) max=Math.max(keta1, keta2);
		}

		System.out.println(max);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


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

  char moji1[100], moji2[100], moji3[100];

  cin >> moji1 >> moji2 >> moji3;

  cout << "A" << moji2[0] << "C" << endl;

  return 0;
}


Measured memory_bytes: 764