akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define all(x) (x).begin(),(x).end()
ll MOD = ll(1e8) + 9;

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

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

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

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

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

    return mp;
}

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

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

vector<vector<int>> perm;

int searchindex(vector<int> x) {
    for (int i = 0; i < perm.size(); i++) {
        bool ok = true;
        for (int j = 0; j < perm[0].size(); j++) {
            if (perm[i][j] != x[j]) {
                ok = false;
            }
        }
        if (ok) return i;
    }

    return -1;
}

void solve(){
    int n;
    cin >> n;

    vector<int> P(n), Q(n), base(n);
    for (int i = 0; i < n; i++) cin >> P[i];
    for (int i = 0; i < n; i++) cin >> Q[i];
    for (int i = 0; i < n; i++) base[i] = i + 1;


    do {
        vector<int> v(n);
        for (int i = 0; i < n; i++) v[i] = base[i];
        perm.push_back(v);
    } while (next_permutation(base.begin(), base.end()));

    int a = searchindex(P);
    int b = searchindex(Q);

    cout << abs(a-b) << endl;

    return;
}

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



Measured memory_bytes: 3256
(function main() {
  const n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'));
  const cache = [1, 1];
  const fib = (n) => cache[n] || (cache[n] = fib(n - 1) + fib(n - 2));
  console.log(fib(n));
})();


Measured memory_bytes: 15136
#include<bits/stdc++.h>
using namespace std;
#define reset(X) memset(X, 0, sizeof(X))
#define int long long
typedef long long ll;
#define pb push_back
#define se second
#define fi first
#define endl '\n'
#define all(X) X.begin(),X.end()

const int INF=1e18;
const int mod=1e9+7;
const int mod2=998244353;



#define REDN(a) int a;cin>>a;
#define REDL(a,n) int a[n];for(int i=0;i<n;i++) cin>>a[i];
#define REDA(a,n,m) int a[n][m];for(int i=0;i<n;i++)for(int j=0;j<m;j++) cin>>a[i][j];





int pow(int a, int b)
{
    int prod=1;
    int mult=a;
    while(b!=0)
    {
        if(b%2)
        {
            prod*=mult;
            prod%=mod2;
        }
        mult*=mult;
        mult%=mod2;
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int mod)
{
    return pow(q, mod-2);
}





const int MAXN=4e5+10;
signed main()
{
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r")) {
        freopen ("INPUT.txt" , "r" , stdin);
        // freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
//---------------------------------------------------------------------------------------------------
    int a, b, k;
    cin>>a>>b>>k;
    int off=min(a, k);
    a-=off;
    k-=off;
    b-=min(b,k);
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
bool rever(int a,int b) { return a>b; }
int fpow(int b,int p,int m)
{
	if(p==0) return 1;
	int t=fpow(b,p/2,m);
	if(p%2) return t*t%m*b%m;
	return t*t%m;
}
int fpow(int b,int p)
{
	if(p==0) return 1;
	int t=fpow(b,p/2);
	if(p%2) return t*t*b;
	return t*t;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b,c,n; cin>>a>>b>>c>>n;
	ll ans=0;
	For(i,0,n/a)
	{
		For(j,0,n/b)
		{
			if(n>=i*a+j*b && (n-i*a-j*b)%c==0)
			{
				ans++;
				//cout<<i<<" "<<j<<"\n";
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
}










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

typedef pair<int,int>   pii;
typedef vector< pii >  vii;
typedef long long int 	ll;

#define pb push_back
#define fe first
#define se second
#define all(a) (a).begin(),(a).end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scn(n) scanf("%d",&n)
#define prn(n) printf("%d\n",n)
#define scnl(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mset(A, val) memset(A, val, sizeof(A))

const ll mod = 1e9 + 7ll;
const int N = (int)1e5 + 7;

int main(){
	
	fast_io;
	int n;
	cin>>n;
	int ar[n];
	rep(i,0,n) cin>>ar[i];
	int ans=0;
	rep(i,0,n)
		rep(j,i+1,n)
			ans+=ar[i]*ar[j];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

    ios::sync_with_stdio(false);

    int a,b,c;

    cin>>a>>b>>c;

    if((a<=b&&b<=c)||(b<=a&&a<=c)){
        cout<<a+b<<endl;
    }
    else if((a<=c&&c<=b)||(c<=a&&a<=b)){
        cout<<a+c<<endl;
    }
    else{
        cout<<b+c<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a_s = set(a)
    cnt = 0
    order = 1
    if not 1 in a_s:
        print(-1)
        exit()
    else:
        for i in range(len(a)):
            if a[i] != order:
                cnt += 1
            if a[i] == order:
                order += 1
    print(cnt)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32304
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#include <iostream>
#define ll long long int
#define all(x) x.begin(),x.end()

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 100005LL
# define cout1(x) cout<<x<<"\n";
# define  deb(x) cout<<#x<<" "<<x<<"\n";
#define  vii vector<pa>;
using namespace std;

v visited(N);
vector<ll> ans={-1};
v level(N);
v ind(N);
ll sz[N];




// void dfs(ll node, ll par){
    
//     visited[node]=1;
//     if (node==1)level[1]=0;
//     else level[node] = level[par]+1;
//     ans.pb(node);
//     for(auto x:graph[node]){
//         if (!visited[x]){
//             dfs(x,node);
//             sz[node]+=sz[x];

//         }
       
//     }
//      ++sz[node];
    
// }
// map<ll,ll> cnt;
// ll answer(ll ans,ll x){
//     cout<<ans<<" "<<x<<endl;
//     if (cnt[ans%x]==0)return ans;
//     else if (cnt[ans%x==1] && ans>x)return ans;
//     else{
//         cnt[ans%x]-=1;
//         cnt[ans]+=1;
//         answer(ans+1,x);
//     }



// }

int main(){
ll n,k;
cin>>n>>k;
cout<<max(0LL,n-2*k)<<endl;

}
  
    
    

        


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

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> M(n);
    rep(i, n) {
        cin >> M[i];
    }
    int ans = n;
    int sum = accumulate(M.begin(), M.end(), 0);
    sort(M.begin(), M.end());
    int min = *M.begin();
    ans += (x - sum) / min;
    cout << ans << endl;
    return 0;
}

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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<30;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};

int cnt[3][1001][1001];

bool solve(){
    int N, M, K;
    cin >> N >> M >> K;
    vector<string> s(N);
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    char ch[3] = {'J','O','I'};
    for(int k=0;k<3;k++){
        for(int i=0;i<=N;i++){
            for(int j=0;j<M;j++){
                cnt[k][i+1][j+1] += cnt[k][i+1][j] + (i<N && s[i][j]==ch[k] ? 1 : 0);
            }
        }
    }
    for(int k=0;k<3;k++){
        for(int i=0;i<N;i++){
            for(int j=0;j<=M;j++){
                cnt[k][i+1][j+1] += cnt[k][i][j+1];
            }
        }
    }
    for(int i=0;i<K;i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--;
        for(int j=0;j<3;j++){
            cout << cnt[j][c][d] - cnt[j][c][b] - cnt[j][a][d] + cnt[j][a][b] << " \n"[j==2];
        }
    }
    return true;
}

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



Measured memory_bytes: 15568
a, b = map(int, input().split())
# = int(input())
# = input()
# = list(map(int, input().split()))

flag = False
for i in range(1, 12501):
	if (i*8)//100 == a and i//10 == b:
		flag = True
		ans = i
	if flag:
		print(ans)
		exit(0)
print(-1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a=0,b=0;
	cin>>n;
	while(n>b){
		a++;
		b+=a;
	}
	for(int i=1;i<=a;i++){
		if(i!=b-n){
			cout<<i<<endl;
		}
	}
    return(0);
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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;
}

using Graph = vector<vector<int>>;
vector<bool> seen;
vector<int> first_order;
vector<int> second_order;

void dfs(const Graph &G, int v, int &ptr) {
    first_order[v] = ptr++;
    seen[v]        = true;

    for(const auto &next_v : G[v]) {
        if(seen[next_v]) continue;
        dfs(G, next_v, ptr);
    }

    second_order[v] = ptr++;
}

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

    int n;
    cin >> n;
    Graph G(n + 1); // 1-indexed
    rep(i, n) {
        int v, k;
        cin >> v >> k;
        rep(i, k) {
            int to_v;
            cin >> to_v;
            G[v].push_back(to_v);
        }
    }
    // 頂点1スタート
    seen.assign(n + 1, false);
    first_order.resize(n + 1);
    second_order.resize(n + 1);
    int ptr = 1;
    REP(i, 1, n + 1) {
        if(!seen[i]) dfs(G, i, ptr);
    }

    REP(i, 1, n + 1) {
        cout << i << " " << first_order[i] << " " << second_order[i] << endl;
    }
}



Measured memory_bytes: 3172
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

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

const int mod = 1000000007;

struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if((x -= mod-a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
};

mint dp[100005][13];

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

  int k;
  cin >> k;

  vector<long> a(k);
  fillLong(a, k);

  long minX = 2;
  long maxX = 2;
  bool isOk = true;
  rep(i, k) {
    long next = a[k-i-1];
    if (next > maxX || (minX/next == maxX/next && (minX%next) && (maxX%next))) {
      isOk = false;
      break;
    }
    minX = ((minX + next - 1) / next) * next;
    maxX = (maxX / next) * next + next - 1;
  }

  if(isOk) {
    cout << minX << " " << maxX << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 998244353
#define f first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
typedef long long ll ;
typedef long double ld ;
typedef long long int lli;

using namespace std;
//reference: geeks
ll mult(ll a,ll b, ll p=mod){	return ((a%p)*(b%p))%p;	}
ll add(ll a, ll b, ll p=mod){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=mod){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = mod) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = mod) {return fpow(a, p - 2, p);}
#define INF 10000000000
#define MAXL 1000005
ll spf[MAXL];
vector<ll>prime;
void seive()
{
    for(int i=2;i<MAXL;i++)
        spf[i]=i;
    for(ll i=2;i<MAXL;i++)
    {
        if(spf[i]==i)
        {
            for(ll j=2*i;j<MAXL;j+=i)
                if(spf[j]==j)
                    spf[j]=i;
            prime.pb(i);
        }
    }
    //cout<<prime.size();
}
ll dp[3006][3006][2];
int main()
{
		ll n;
		cin>>n;
		ll a[n];
		for(int i=0;i<n;i++)	cin>>a[i];

		for(int i=0;i<n;i++)
		{
			dp[i][i][0]=a[i];
			dp[i][i][1]=-a[i];
		}
		for(int len=1;len<n;len++)
		{
			//cout<<"\n";
			for(int i=0;i<n-len;i++)
			{
				dp[i][i+len][0]=max(a[i]+dp[i+1][i+len][1],a[i+len]+dp[i][i+len-1][1]);
				//cout<<i<<" "<<i+len<<" "<<0<<" "<<dp[i][i+len][0]<<"\n";
				dp[i][i+len][1]=min(-a[i]+dp[i+1][i+len][0],-a[i+len]+dp[i][i+len-1][0]);
				//cout<<i<<" "<<i+len<<" "<<1<<" "<<dp[i][i+len][1]<<"\n";
			}
			//cout<<"\n";
		}
		/*cout<<"\n";
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				cout<<dp[i][j][0]<<" ";
			}
			cout<<"\n";
		}

		cout<<"\n";
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				cout<<dp[i][j][1]<<" ";
			}
			cout<<"\n";
		}*/
		cout<<dp[0][n-1][0];

}

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

int main() {
    //
    int num, limit;
    int Min = 9999;
    int sum = 0;

    cin >> num >> limit;

    for (int i = 0; i < num; i++) {
        int tmp, tmp2;
        cin >> tmp >> tmp2;
        if (tmp2 <= limit) Min = min(Min, tmp);
    }

    if (Min == 9999) cout << "TLE";
    else cout << Min;
    //
}


Measured memory_bytes: 3572
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

X = ri()

def f(X):
	r = math.ceil(math.sqrt(X))
	for i in range(2,r):
		if X % i == 0:
			return False
	return True

while True:
	if f(X):
		print(X)
		exit()
	X += 1



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

int main() {
    while (true) {
        int n, x;
        cin >> n >> x;
        if (n == 0 && x == 0) break;

        int sum = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                for (int k = j + 1; k <= n; k++) {
                    if (i + j + k == x) sum += 1;
                }
            }
        }

        cout << sum << endl;
    }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s;
    cin>>s;
    string t="KIHBR";
    if(s=="KIHBR"||s=="AKIHBR"||s=="KIHABR"||s=="KIHBAR"||s=="KIHBRA"||s=="AKIHABR"||s=="AKIHBAR"||s=="AKIHBRA"||s=="KIHABAR"||s=="KIHABRA"
    ||s=="KIHBARA"||s=="AKIHABAR"||s=="KIHABARA"||s=="AKIHABARA"){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;

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

    ll ans = INF;
    for (int bit = 0; bit < (1<<N); bit++) {
        int t = bitset<15>(bit).count();
        if (t < K) continue;
        int highest = a[0];
        ll cost = 0;
        for (int i = 1; i < N; i++) {
            if ((bit >> i) & 1 && a[i] <= highest) {
                cost += ++highest - a[i];
            } else {
                highest = max(highest, a[i]);
            }
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

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

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
vector<vector<int>> vec(2e5+5);
int dp[(int)2e5+5] = {};
vector<int> val(2e5+5);
vector<int> s;
int ptr = 1;
void dfs(int cur, int dont){
	for(auto &x: vec[cur]){
		if(x != dont){
			auto it = lower_bound(dp, dp+ptr, s[x-1]);
			if(it == dp+ptr){
				//cout<<s[0]<<" "<<s[1]<<endl;
				int tmp = *it;
				*it = s[x-1];
				ptr++;
				val[x-1] = ptr;
				dfs(x, cur);
				*it = tmp;
				ptr--;
			}else{
				int tmp = *it;
				*it = s[x-1];
				val[x-1] = ptr;
				dfs(x, cur);
				*it = tmp;
			}
		}
	}
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	s.resize(n);
	for(auto &x: s) cin>>x;
	for(int i = 0; i < n-1; i++){
		int a, b; cin>>a>>b;
		vec[a].pb(b);
		vec[b].pb(a);
	}
	dp[0] = s[0];
	val[0] = 1;
	dfs(1, 0);
	for(int i = 1; i <= n; i++) cout<<val[i-1]<<"\n";
}

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

int		main(void)
{
	string	a;	cin >> a;
	string	b;	cin >> b;
	int		j = 0;
	for (int i = 3 - 1; i >= 0; i--)
	{
		if (a.at(j) != b.at(i))
		{
			cout << "NO" << endl;
			goto OUT;
		}
		j++;
	}
	OUT:
	if (j == 3)
		cout << "YES" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String... args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    for(int i = 1; i <= N; i++){
      if((int)(i*1.08) == N){
        System.out.println(i); return;
      }
    }
    System.out.println(":(");
  }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,x,n,i;
  cin >> x >> n;
  map<int,int>m;
  for(i=0;i<n;i++)
  {
    cin >> k;
    m[k]++;
  }
  k=x;
  int ans;
  while(1)
  {
    if(m.find(k)==m.end())
    {ans=k;break;}
    else if(m.find(x)==m.end())
    {ans=x;break;}
    else
    {k--;x++;}
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main()
{
   int n;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)
   {
                cin>>a[i];
   }
   int ans[n];
   ans[0]=0;
   ans[1]=abs(a[1]-a[0]);
   for(int i=2;i<n;i++)
   {
       ans[i]=min(ans[i-1]+abs(a[i]-a[i-1]),ans[i-2]+abs(a[i]-a[i-2]));         
   }
      cout<<ans[n-1];
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
void solve(){
    double a, b, v;
    cin >> a >> b >> v;
    if(v/a <= b*a / 2.0){
        double x = 2.0*v/a/b;
        double k = b / x;
        double ans = atan(k);
        ans = ans * 180.0 / 3.14159265358979323846;
        cout << fixed << setprecision(6) << ans;
    }
    else{
        double s = v/a;
        double x = s*2.0/a - b;
        double h = b - x;
        double k = h/a;
        double ans = atan(k);
        ans = ans * 180.0 / 3.14159265358979323846;
        cout << fixed << setprecision(6) << ans;
    }
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    while(t--) solve();
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

const bool debug = true;

struct Edge { int dst,weight; };

struct Data {
  int cur, pre, weight;
  bool operator < ( const Data &data ) const {
    if( weight != data.weight) return weight > data.weight;
    if( pre != data.pre ) return pre > data.pre;
    return cur > data.cur;
  }
};

#define MAX_V 10100
int V,E,root;
vector<Edge> G[MAX_V];

bool used[MAX_V];
void compute() {
  vector<vector<Edge>> prim(V,vector<Edge>());

  memset(used,false,sizeof used);
  root = 0;
  priority_queue<Data> Q;
  Q.push((Data){root,-1,0});
  while( !Q.empty() ) {
    Data data = Q.top(); Q.pop();
    if( used[data.cur] ) continue;
    used[data.cur] = true;
    //ret += data.weight;
    if( data.pre != -1 ) {
      prim[data.cur].push_back((Edge){data.pre,data.weight});
      prim[data.pre].push_back((Edge){data.cur,data.weight});
    }
    
    rep(i,(int)G[data.cur].size()) {
      Edge &e = G[data.cur][i];
      if( used[e.dst] ) continue;
      Q.push((Data){e.dst,data.cur,e.weight});
    }
  }
  int ret = 0;
  /*
  rep(i,V) {
    cout << i << "-th:" << endl;
    rep(j,(int)prim[i].size()) {
      cout << "  " << prim[i][j].dst << "," << prim[i][j].weight << endl;
    }
  }
  */
  rep(i,V) rep(j,(int)prim[i].size()) ret += prim[i][j].weight;
  cout << (int)(ret/2) << endl;
}

int main() {
  cin >> V >> E;
  rep(i,E) {
    int s,t,w;
    cin >> s >> t >> w;
    G[s].push_back((Edge){t,w});
    G[t].push_back((Edge){s,w});
  }
  compute();
  return 0;
}



Measured memory_bytes: 7688
import bisect
L = [True] * 60000
L[0] = L[1] = False

for i in range(2,int(60000**0.5)+1):
    if not L[i]:
        continue
    for j in range(i*2,60000, i):
        L[j] = False
p = [x for x in range(60000) if L[x]]
#print(" ".join(map(str,p)))
while True:
    try:
        n = int(input())
    except EOFError:
        break
    k = bisect.bisect_left(p,n)
    a = p[k-1]

    if p[k] == n:
        b = p[k+1]
    else:
        b = p[k]
    print(a,b)



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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

ll modpow(ll a, ll n)
{
  ll ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret = (ret * a) % MOD;
    }
    a = (a * a) % MOD;
    n >>= 1;
  }
  return ret;
}

ll combi(ll n, ll r, vector<ll>& fact, vector<ll>& inv_fact)
{
  if (r > n) { return 0; }
  ll ret = (fact[n] * inv_fact[r]) % MOD;
  ret = (ret * inv_fact[n - r]) % MOD;
  return ret;
}

int main()
{
  int H, W, A, B; scanf("%d %d %d %d", &H, &W, &A, &B);
  int N = H + W;
  vector<ll> fact(N + 5, 1), inv_fact(N + 5, 1);
  for (int i = 1; i <= N; ++i) {
    fact[i] = (i * fact[i - 1]) % MOD;
  }

  inv_fact[N] = modpow(fact[N], MOD - 2);
  for (int i = N - 1; i >= 1; --i) {
    inv_fact[i] = ((i + 1) * inv_fact[i + 1]) % MOD;
  }

  // H - A - 1, [B, W - 1]
  ll ans = 0;
  for (int r = B; r <= W - 1; ++r) {
    int n = H - A - 1 + r;
    ll val = combi(n, r, fact, inv_fact) * combi(A - 1 + W - 1 - r, A - 1, fact, inv_fact);
    val %= MOD;
    ans = (ans + val) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> N >> M;
    vector<int> arr(M);
    for (int i = 0; i < M; i++) 
    {
        cin >> arr.at(i);
    }

    A = N - accumulate(all(arr),0);
    if(A < 0)
    {
        cout << -1;
    }
    else
    {
        cout << A;
    }
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
int main(void){
 	int apple;
  	int apple_pieces;
  	scanf("%d",&apple);
  	scanf("%d",&apple_pieces);
  	int apple_b = apple*3;
  	apple_pieces += apple_b;
  	
  	int pie;
        pie = apple_pieces / 2;

  	printf("%d",pie);
  	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"strings"
)

const abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	var result string
	for i := 0; i < len(s); i++ {
		str := s[i : i+1]
		index := strings.Index(abc, str)
		index += n
		result += abc[index : index+1]
	}

	fmt.Println(result)
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
const int N = 20 + 10;
int a[N], b[N], c[N];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	for (int i = 1; i <= n; ++i)
		cin >> b[i];
	for (int i = 1; i < n; ++i)
		cin >> c[i];
	int ans = 0;
	for (int i = 1; i <= n; ++i)
		ans += b[a[i]] + (a[i - 1] == a[i] - 1 ? c[a[i - 1]] : 0);
	cout << ans;
}

Measured memory_bytes: 256
using System;

class program
{
    static void Main(string[] args)
    {
        string[] inputs = Console.ReadLine().Split();
        long N = long.Parse(inputs[0]);
        long A = long.Parse(inputs[1]);
        long B = long.Parse(inputs[2]);

        long ans = ((N - 1) * B + A) - ((N - 1) * A + B) + 1;

        ans = Math.Max(ans, 0);

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:1048576")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef tuple <int, int, int> t3;

int IT_MAX = 1 << 12;
const ll MOD = 1000000009;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)

vector <int> conn[200050];
vector <int> rconn[200050];
vector <int> Vu;
int cnt[200050];
bool chk[200050];
int gr[200050];
int u[200050];

int in[200050];
pii getgr(int n) {
	for (auto it : conn[n]) if(gr[it] != -1) u[gr[it]] = -1;
	int v1 = -1, v2 = -1, i;
	for (i = 0;; i++) {
		if (u[i] == -1) continue;
		if (v1 == -1) v1 = i;
		else {
			v2 = i;
			break;
		}
	}
	for (auto it : conn[n]) u[gr[it]] = 0;
	return pii(v1, v2);
}
int main() {
	int N, i, j;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%d", &in[i]);
		conn[in[i]].push_back(i);
		rconn[i].push_back(in[i]);
	}
	for (i = 1; i <= N; i++) gr[i] = -1;
	for (i = 1; i <= N; i++) cnt[i] = conn[i].size();
	for (i = 1; i <= N; i++) if (!cnt[i]) Vu.push_back(i);
	for (i = 0; i < Vu.size(); i++) {
		for (auto it : conn[Vu[i]]) u[gr[it]] = Vu[i];
		for (j = 0;; j++) if (u[j] != Vu[i]) break;
		gr[Vu[i]] = j;
		chk[Vu[i]] = true;
		for (auto it : rconn[Vu[i]]) if (--cnt[it] == 0) Vu.push_back(it);
	}

	for (i = 1; i <= N; i++) if (!chk[i]) break;
	Vu.clear();
	Vu.push_back(i);
	do {
		Vu.push_back(in[Vu.back()]);
	} while (Vu[0] != Vu.back());
	Vu.pop_back();

	pii x = getgr(Vu[0]);
	gr[Vu[0]] = x.first;
	for (i = 1; i < Vu.size(); i++) gr[Vu[i]] = getgr(Vu[i]).first;
	if (gr[Vu.back()] != x.first) return !printf("POSSIBLE\n");

	gr[Vu[0]] = x.second;
	for (i = 1; i < Vu.size(); i++) gr[Vu[i]] = getgr(Vu[i]).first;
	if (gr[Vu.back()] == x.first) return !printf("POSSIBLE\n");
	return !printf("IMPOSSIBLE\n");
}

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

typedef unsigned long long int ull;
typedef long long ll;
#define pb push_back

int main()
{
//#ifndef ONLINE_JUDGE
  //  freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
//#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //your code starts here
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll ans = 0;
    if (n <= 2)
    {
        if (s == "WR")
            ans = 1;
        else
            ans = 0;
    }
    else if (n == 3)
    {
        if (s == "WRW" || s == "WRR" || s == "RWR")
            ans = 1;
        else
            ans = 0;
    }
    else
    {
        int c1 = 0, pos = 0;
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'W')
                ++c1;
            if (s[i] == 'R')
                pos++;
        }
        int c2 = 0;
        for (int i = 0; i < pos; i++)
        {
            if (s[i] == 'W')
                c2++;
        }
        ans = min(c1, c2);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3764
import java.util.Scanner;
import java.util.concurrent.*;

public class Main{
	public static void main(String[] args){
		long s,sec,min,hour;
		Scanner in = new Scanner(System.in);
		
		s = in.nextLong();
		
		hour = TimeUnit.SECONDS.toHours(s);
		min = TimeUnit.SECONDS.toMinutes(s) - hour*60;
		sec = TimeUnit.SECONDS.toSeconds(s) - hour*3600 - min*60;
		
		System.out.println(hour+":"+min+":"+sec);
	}
}

Measured memory_bytes: 17232
#include<iostream>
using namespace std;
int main(){
  int m1, d1, m2, d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;
  if (m1 + 1 == m2 && d2 == 1)
    cout << 1;
  else{
    if (m2 == 1 && d2 == 1)
      cout << 1;
    else
      cout << 0;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string.h>

using namespace std;


int main() {
	int a,b,c;
	cin >> a >> b >> c;
	int d = a * 100 + b * 10 + c;
	if (d % 4 == 0) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}


	return 0;
	
}

Measured memory_bytes: 3584
H, W = map(int, input().split())
S = [input() for _ in range(H)]
for h in range(H):
    for w in range(W):
        f = False
        if S[h][w] == '.':
            continue
        if h > 0 and S[h-1][w] == '#':
            f = True
        elif h < H-1 and S[h+1][w] == '#':
            f = True
        elif w > 0 and S[h][w-1] == '#':
            f = True
        elif w < W-1 and S[h][w+1] == '#':
            f = True
        if not f:
            break
    else:
        continue
    break
else:
    print('Yes')
    exit()
print('No')


Measured memory_bytes: 39152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
  string s;
  cin >> s;

  string ans = "Yes";

  if (s.size() != 6) ans = "No";
  if (s[2] != s[3]) ans = "No";
  if (s[4] != s[5]) ans = "No";

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#ABC108-B
x1,y1,x2,y2 = map(int,input().split())

x3 = x2 - (y2-y1)
y3 = y2 + (x2-x1)

x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)

print(x3,y3,x4,y4)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  bool can = false;
  for (int i = 1; (A * i) <= (A * B); i++) {
    if ((A * i) % B == C) {
      can = true;
      break;
    }
  }
  
  if (can) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3576
"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);

let S: string[] = [];
for(let i=0; i<input[0].length; i++) S.push(input[0].charAt(i));
S.sort();
const ans = (S[0] === 'a' && S[1] === 'b' && S[2] === 'c') ? 'Yes' : 'No';
console.log(ans);

Measured memory_bytes: 7372
a,b,k=map(int,input().split())
if 2*k >= b-a+1:
  print(*list(range(a,b+1)),sep='\n')
else:
  print(*list(range(a,a+k)),sep='\n')
  print(*list(range(b-k+1,b+1)),sep='\n')

Measured memory_bytes: 3060
import numpy as np

n,m,q = map(int,input().split())
li = [[0 for i in range(n+1)]for j in range(n+1)]

for i in range(m):
    l,r = map(int,input().split())
    li[l][r] += 1

li = np.array(li)
c = np.cumsum(li,axis=1).cumsum(axis=0).tolist()

for i in range(q):
    l,r = map(int,input().split())
    l -= 1
    point = c[r][r]
    point -= c[r][l]
    point -= c[l][r]
    point += c[l][l]
    print(point)

Measured memory_bytes: 25672
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

bool w[MAX];

int main() {
	int n,k,r,s,p;cin>>n>>k>>r>>s>>p;
	string t;cin>>t;
	int ans=0;
	rep(i,n){
		if(i>=k&&w[i-k]&&t[i]==t[i-k]) {
			w[i]=false;
			continue;
		}
		w[i]=true;
		if(t[i]=='r') ans+=p;
		else if(t[i]=='s') ans+=r;
		else if(t[i]=='p') ans+=s;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  print((N / 10 == 9 || N % 10 == 9) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

using std::cout;
using std::endl;
using std::cin;
using std::string;

int main(){
  int k,a,b;
  bool flg=false;
  cin >> k;
  cin >> a >> b;
  for(int i=a;i<=b;i++)
    if(i%k==0) flg=true;
  if(flg)
    cout << "OK" << endl;
  else
    cout << "NG" << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,m,x,y;
  cin>>n>>m>>x>>y;
  vector<Int> a(n),b(m);
  for(Int i=0;i<n;i++) cin>>a[i];
  for(Int i=0;i<m;i++) cin>>b[i];

  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  
  Int s=a.back()+1,t=b.front();
  chmax(s,x+1);
  chmin(t,y);
  if(s<=t) cout<<"No ";
  cout<<"War"<<endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, W: int, S: "List[str]"):
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                continue
            if i - 1 >= 0:
                if S[i - 1][j] == "#":
                    continue
            if i + 1 < H:
                if S[i + 1][j] == "#":
                    continue
            if j - 1 >= 0 and S[i][j - 1] == "#":
                continue
            if j + 1 < W and S[i][j + 1] == "#":
                continue
            print(NO)
            return
    print(YES)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [list(next(tokens)) for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)


if __name__ == "__main__":
    main()


Measured memory_bytes: 65436
package main

import (
	"fmt"
)

func main() {
	var n, y int
	fmt.Scan(&n, &y)

	for i := 0; i <= n; i++ {
		for j := 0; i+j <= n; j++ {
			k := n - i - j
			if i*10000+j*5000+k*1000 == y {
				fmt.Println(i, j, k)
				return
			}
		}
	}

	fmt.Println("-1 -1 -1")
}


Measured memory_bytes: 512
#include<stdio.h>

int main(){
long n,ncpy;int sum=0;
scanf("%ld",&n);ncpy=n;
while(ncpy>0){
long tmp=ncpy%10;
sum+=tmp;
ncpy=(ncpy-tmp)/10;
}
if(n%sum==0)puts("Yes");
else puts("No");
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 2020;
long fac[MAX], inv[MAX], finv[MAX];
void init()
{
    fac[0] = inv[0] = finv[0] = 1;
    fac[1] = inv[1] = finv[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;
    }
}
long C(int n, int k)
{
    if (n < 0 || k < 0 || n < k)
        return 0;
    return (fac[n] * finv[n - k] % MOD) * finv[k] % MOD;
}

ll n, b;

int main()
{
  cin >> n >> b;
  ll r = n - b;
  init();
  REP(i, b) {
    // 選ぶ場所 r+1Ci+1
    // 青の分け方 1こ以上、i+1このグループに分割 b-1Ci
    cout << C(r+1,i+1)*C(b-1,i) % MOD << '\n';
  }
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  
  int sub = A - B;
  int add = A + B;
  int mul = A * B;
  
  cout << max(sub, max(add,mul)) << endl;
}

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

int main(){
  string N;
  cin>> N;
  
  if(N[0]==N[1]&&N[1]==N[2])cout<< "Yes";
  else if(N[1]==N[2]&&N[2]==N[3])cout<< "Yes";
  else cout<< "No";
}


Measured memory_bytes: 3632
class segtree:
  #セグメント木
  def __init__(s, v, op, e):
    s._n = len(v)
    s.log = s.ceil_pow2(s._n)
    s.size = 1 << s.log
    s.d = [e()] * (2 * s.size)
    s.e = e
    s.op = op
    for i in range(s._n): s.d[s.size + i] = v[i]
    for i in range(s.size - 1, 0, -1): s.update(i)
  
  # 1点更新
  def set(s, p, x):
    p += s.size
    s.d[p] = x
    for i in range(1, s.log + 1): s.update(p >> i)
 
  # 1点取得
  def get(s, p):
    return s.d[p + s.size]
 
  # 区間演算
  def prod(s, l, r):
    sml, smr = s.e(), s.e()
    l += s.size
    r += s.size
    while (l < r):
      if l & 1: 
        sml = s.op(sml, s.d[l])
        l += 1
      if r & 1:
        r -= 1
        smr = s.op(s.d[r], smr)
      l >>= 1
      r >>= 1
    return s.op(sml, smr)
 
  # 全体演算
  def all_prod(s): return s.d[1]
 
  def update(s, k): s.d[k] = s.op(s.d[2 * k], s.d[2 * k + 1])
  def ceil_pow2(s, n):
    x = 0
    while (1 << x) < n: x += 1
    return x


N, K = list(map(int, input().split()))
LR = [list(map(int, input().split())) for _ in range(K)]
MOD = 998244353

def e():
  return 0
def op(a, b):
  return (a + b) % MOD

seg = segtree([0] * N, op, e)
seg.set(0, 1)

for i in range(1, N):
  ans = 0
  for l, r in LR:
    r, l = max(0, i - l + 1), max(0, i - r)
    ans = (ans + seg.prod(l, r)) % MOD
  seg.set(i, ans)

print(seg.get(N - 1))


Measured memory_bytes: 79568
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int a, b, c;
    readf("%s %s %s", &a, &b, &c);
    readln;
    
    auto ans = max(c - (a - b), 0);
    
    ans.writeln;
}

Measured memory_bytes: 256
package main

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

func main() {
	S, K := ReadString(), ReadInt()
	oneChars := true
	for _, si := range []byte(S) {
		if si != S[0] {
			oneChars = false
			break
		}
	}
	if oneChars {
		fmt.Println(len(S) * K / 2)
		return
	}

	if S[0] != S[len(S)-1] {
		fmt.Println(K * count(S))
	} else {
		c1 := count(S)
		c2 := count(S + S)
		fmt.Println((K-1)*(c2-c1) + c1)
	}
}

func count(s string) int {
	ans := 0
	seq := 1
	for i := 1; i < len(s); i++ {
		if s[i] == s[i-1] {
			seq++
		} else {
			ans += seq / 2
			seq = 1
		}
	}
	ans += seq / 2
	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
#include <iostream>
using namespace std;
int abs(int x1)
{
    if(x1<0)x1=-x1;
    return x1;
}

int main()
{
    int x,a,b;
    while(cin>>x>>a>>b)
    {
        int y=abs(a-x);
        int z=abs(b-x);
        if(y>z)cout<<"B"<<endl;
        else cout<<"A"<<endl;
    }
    return 0;
}


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

int main()
{
    int N, K;
    cin >> N;
    cin >> K;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int pos;
        cin >> pos;
        ans += min(pos, K - pos);
    }
    ans *= 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,t;
int map[200][200],fast[200][200];
int dx[6]={0,1,0,-1,1,-1},dy[6]={1,0,-1,0,1,-1};
void DFS(int y,int x,int len){
    map[y][x]=1;
    if(len<t&&len<fast[y][x]){
    fast[y][x]=len;
    for(int i=0;i<6;i++){
        if(map[y+dy[i]][x+dx[i]]!=-1)
            DFS(y+dy[i],x+dx[i],len+1);
    }
    }
}
int main(){
    while(true){
    cin>>t>>n;
    if(t==0&&n==0)
        break;
    for(int i=0;i<200;i++){
        for(int j=0;j<200;j++){
            map[i][j]=0;
            fast[i][j]=100;
        }
    }
    int x,y;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        map[100+y][100+x]=-1;
    }
    cin>>x>>y;
    DFS(y+100,x+100,0);
    int ans=0;
    for(int i=0;i<200;i++){
        for(int j=0;j<200;j++){
            if(map[i][j]==1)
                ans++;
        }
    }
    cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 1472
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int cnt[26];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    string S;
    cin>>N;
    cin>>S;
    rep(i,0,N){
        cnt[S[i]-'a']++;
    }
    ll ans=1;
    rep(i,0,26){
        ans*=cnt[i]+1;
        ans%=MOD;
    }
    cout <<(ans-1+MOD)%MOD<<"\n";
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mi map<int,int>
#define mii map<pii,int>
const int N=(1e2+1);//mod=(1e9)+7;
int n,W,d;//
ll a[N],dp[N][100000+1],w[N];
string s;
int flag=1;
ll rec(int id,int cw)
{
    if(id>=n)return 0;
    if(dp[id][cw]!=-1)return dp[id][cw];
    ll x=0,y=0;
    if(cw+w[id]<=W)
    {
        x=rec(id+1,cw+w[id])+a[id];
    }
    y=rec(id+1,cw);
    //printf("id=%d cw=%d x=%d y=%d\n",id,cw,x,y);
    dp[id][cw]=max(x,y);
    return dp[id][cw];
}
int main()
{
    cin>>n>>W;
    for(int i=0;i<n;i++)
    {
        cin>>w[i]>>a[i];
        for(int j=0;j<=W;j++)
        {
            dp[i][j]=-1;
        }
    }
    cout<<rec(0,0)<<endl;
}
/*
test cases:-
100000000000000012 1000000000032
*/

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

int gcd(int x, int y);

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

	cout << gcd(a, b) << endl;



	
}

int gcd(int x, int y) {
	if (y > x) {
		swap(x, y);
	}
	while (y>0) {
		int  r = x % y;
		x = y;
		y = r;
	}
	return x;

}


Measured memory_bytes: 3120