akhauriyash/Code-Regression huggingface dataset:
while True:
	d,w = map(int,input().split())
	if d+w == 0:break
	pond = [list(map(int,input().split())) for _ in range(d)]
	ans = 0
	for left in range(w-1):
		for right in range(w-1,left+1,-1):
			for top in range(d-1):
				for under in range(d-1,top+1,-1):
					outh = 10
					outh = min(outh,min(pond[top][left:right+1]))
					outh = min(outh,min(pond[under][left:right+1]))
					zpond = list(zip(*pond))
					outh = min(outh,min(zpond[left][top:under]))
					outh = min(outh,min(zpond[right][top:under]))
					pondh = 0
					for i in range(top+1, under):
						pondh = max(pondh,max(pond[i][left+1:right]))
					if pondh < outh:
						cap = outh*(under-top-1) * (right-left-1) - sum(sum(pond[i][left+1:right]) for i in range(top+1,under))
						ans = max(cap,ans)
	print(ans)


Measured memory_bytes: 5620
import java.util.*;
 
public class Main{
 
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int ans = 0;
int[] a = new int[2*n];
for(int i=0;i<2*n;i++) a[i] = s.nextInt();
Arrays.sort(a);
 
for(int i=0;i<2*n;i+=2) ans += Math.min(a[i],a[i+1]);
 
System.out.println(ans);
}
 
}

Measured memory_bytes: 9812
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] A = sc.next().toCharArray();
		char[] B = sc.next().toCharArray();
		
		if (A.length>B.length) System.out.println("GREATER");
		else if (A.length<B.length) System.out.println("LESS");
		else if (A.length==B.length) {
			for (int i=0; i<A.length; i++) {
				if (A[i] == B[i]) continue;
				else if (A[i]>B[i]) {
					System.out.println("GREATER");
					return;
				}else if (A[i]<B[i]) {
					System.out.println("LESS");
					return;
				}
			}
			System.out.println("EQUAL");
		}
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    ll a = 0, b=0;
    for (int i = 1; i <= n;i++){
        if (i% k == 0){
            a++;
        }
        if(i%k==k/2){
            b++;
        }
    }
    ll ans = 0;
    ans = a * a * a;
    if (k % 2 == 0){
        ans += (b*b*b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ld r; scanf("%Lf", &r);
	printf("%.30Lf\n", 2*r*M_PI);
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const ll INF=4223372036854775807,max_n=300005,mod=0x7f7f7f7f7f;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main()
{
	int k,a,b;cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			cout<<"OK";return 0;
		}
	}
	cout<<"NG";

	return 0;
}

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

using namespace std;

int main(){
    int a,b,t; cin >> a >> b >> t;
    int count = 0;
    for(int i = 0; i< t/a; i++){
        count += b;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: u32,
        K: u32,
    }
    println!("{}", K*(K-1).pow(N-1));
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    int n;
    cin >> n;
    vector<int> x(n),y(n);
    for (int i = 0;i < n;i++){
        cin >> x[i];
        y[i] = x[i];
    }

    sort(x.begin(),x.end());

    for (int i = 0;i < n;i++){
        if (y[i] < x[n/2]){
            cout << x[n/2] << endl;
        }
        else{
            cout << x[n/2 - 1] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3712
def matching(a,b):
    count=0
    for i in range(len(a)):
        if a[i]==b[i]:
            count+=1
    return len(a)-count

s=input()
t=input()
k=len(s)
l=len(t)
minChange=None
for i in range(k-l+1):
    temp=s[i:i+l]
    change=matching(temp,t)
    if minChange==None or change<minChange:
        minChange=change
print(minChange)

Measured memory_bytes: 9136
#include <iostream>
#include <cmath>

using namespace std;

#define MAX 7368791

int main(){
  int m, n;
  bool flag[MAX];

  while(cin >> m >> n, m||n){
    for(int i = 0 ; i <= MAX ; i++) flag[i] = false;
    for(int i = m ;; i++){
      if(!flag[i]){
        if(n == 0){
          cout << i << endl;
          break;
        }else{
          n--;
          for(int j = i ; j <= MAX ; j+=i){
            flag[j] = true;
          }
        }
      }
    }
  }
}


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

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

  if (a > b) cout << "a > b";
  else if(a < b) cout << "a < b";
  else if(a == b) cout << "a == b";
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
const int MAXN=25010,MAXK=410,P=1e9+7;
int n,m,k,cnt[MAXN],a[MAXN],las[MAXN],sum[MAXN][MAXK],sufsum[MAXN][MAXK],dp[MAXN][MAXK],suf[MAXN][MAXK];
int qpow (int a,int b) {
    int res=1;
    while (b) {
        if (b&1) {res=(1ll*res*a)%P;}
        a=(1ll*a*a)%P,b>>=1;
    }
    return res;
}
int main () {
 //   freopen("f.in","r",stdin);
   // freopen("f.out","w",stdout);
    scanf("%d%d%d",&n,&k,&m);
    int kd=0;
    for (int i=1;i<=m;i++) {
        scanf("%d",&a[i]);
        if (cnt[a[i]]) {kd=1,las[i]=cnt[a[i]];}
        cnt[a[i]]=i;
    }
    int tmp=0,flg=0;
    for (int i=1;i<=m;i++) {
        tmp=max(tmp,las[i]);
        if (tmp<i-k+1) {flg=1;}
    }
    if (flg) {
        int ans1=(1ll*(n-m+1)*qpow(k,n-m))%P;
        printf("%d\n",ans1);
        return 0;
    }
    if (kd) {
        int cur=1;
        memset(cnt,0,sizeof(cnt));
        for (int i=1;i<=m;i++) {
            if (cnt[a[i]]) {cur=i-1;break;}
            cnt[a[i]]++;
        }
        sum[0][cur]=1;
        for (int i=0;i<=cur;i++) {sufsum[0][i]=1;}
        for (int i=1;i<=n;i++) {
            for (int j=k-1;j>=1;j--) {
                sum[i][j]=((1ll*sum[i-1][j-1]*(k-j+1))%P+sufsum[i-1][j])%P;
                sufsum[i][j]=(sufsum[i][j+1]+sum[i][j])%P;
            }
        }
        memset(cnt,0,sizeof(cnt));
        for (int i=m;i>=1;i--) {
            if (cnt[a[i]]) {cur=m-i;break;}
            cnt[a[i]]++;
        }
        dp[0][cur]=1;
        for (int i=0;i<=cur;i++) {suf[0][i]=1;}
        for (int i=1;i<=n;i++) {
            for (int j=k-1;j>=1;j--) {
                dp[i][j]=((1ll*dp[i-1][j-1]*(k-j+1))%P+suf[i-1][j])%P;
                suf[i][j]=(suf[i][j+1]+dp[i][j])%P;
            }
        }
        int ans1=(1ll*(n-m+1)*qpow(k,n-m))%P,ans2=0;
        for (int i=1;i<=n-m+1;i++) {
            ans2=(ans2+(1ll*sufsum[i-1][1]*suf[n-(m+i-1)][1])%P)%P;
        }
        printf("%d\n",(ans1-ans2+P)%P);
    } else {
        int ans1=(1ll*(n-m+1)*qpow(k,n-m))%P,ans2=0;
        if (m>=k) {printf("%d\n",ans1);return 0;}
        dp[0][0]=suf[0][0]=1;
        for (int i=1;i<=n;i++) {
            for (int j=k-1;j>=1;j--) {
                sum[i][j]=((1ll*sum[i-1][j-1]*(k-j+1))%P+sufsum[i-1][j])%P;
                dp[i][j]=((1ll*dp[i-1][j-1]*(k-j+1))%P+suf[i-1][j])%P;
                suf[i][j]=(suf[i][j+1]+dp[i][j])%P;
                if (j>=m) {sum[i][j]=(sum[i][j]+dp[i][j])%P;}
                sufsum[i][j]=(sufsum[i][j+1]+sum[i][j])%P;
                //cout << i << "  " << j << "  " << dp[i][j] << "  " << sum[i][j] << endl;
            }
        }
        ans2=sufsum[n][1];
        //cout << ans2 << endl;
        for (int i=k;i>=k-m+1;i--) {ans2=(1ll*ans2*qpow(i,P-2))%P;}
        //cout << ans1 << "  " << ans2 << endl;
        printf("%d\n",(ans1-ans2+P)%P);
    }
    return 0;
}

Measured memory_bytes: 160768
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;

int main()
{
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n), b(m), c(m);
    map<ll, ll> mp;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    for(int i = 0; i < m; i++){
        cin >> b[i] >> c[i];
        mp[c[i]] += b[i];
    }
    ll ans = 0;
    auto itr = mp.end();
    while(1){
        itr--;
        if(n > itr->second){
            n -= itr->second;
            ans += itr->second * itr->first;
        }else{
            ans += itr->first * n;
            break;
        }
    }
    cout << ans << endl;
}

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

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int H, W;
    cin >> H >> W;

    vector<string> A(H);
    rep(i, H) cin >> A[i];

    int y = 0, x = 0;
    bool ans = true;
    rep(i, H)rep(j, W) {
        if (A[i][j] == '#') {
            if (i < y || j < x) {
                ans = false;
                break;
            }
            y = i, x = j;
        }
    }

    cout << (ans ? "Possible" : "Impossible") << endl;
}

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

typedef long long int ll;

#define endl '\n'

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

    ll n;
    cin>>n;
    ll arr[n+1];
    map <ll,ll> mp;
    ll x = 0;
    for(ll i=0;i<n;i++){
        cin>>arr[i];
        x = x^arr[i];
    }

    if(x==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }


}


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

#define debug(x) cout << #x" = " << x;

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

int main(){
	ll a, b;
	scanf("%lld%lld", &a, &b);

	ll r = 1ll << 60;
	for (; ~(a ^ b) & r; r >>= 1);
	if (r){
		a &= r - 1, b &= r - 1;
		b = r + (1ll << 64 - (b ? __builtin_clzll(b) : 64)) - 1;
		printf("%lld\n", b - a + 1 + (r - 1 - max(a - 1, b - r)));
	}
	else
		puts("1");
	return 0;
}


Measured memory_bytes: 256
/* ***************************************
Author        :Scau.ion
Created Time  :2017/03/13 23:59:30 UTC+8
File Name     :ion.cpp
*************************************** */

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

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

const int maxn=100010;

int a[maxn];

int main()
{
    IOS;
    int n,c,k;
    cin>>n>>c>>k;
    for (int j=1;j<=n;++j)
        cin>>a[j];
    sort(a+1,a+n+1);
    int num=1;
    int ans=0;
    int last=1;
    for (int j=2;j<=n;++j)
    {
        if (num==c||a[j]-a[last]>k)
        {
            num=1;
            ++ans;
            last=j;
        }
        else
        {
            ++num;
        }
    }
    ++ans;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;

namespace Atcoder
{
	class Program
	{
		/*
			string s = Console.ReadLine();
			string[] ST = Console.ReadLine().Split(' ').ToArray();
			string S = strArray[0];
			string T = strArray[1];

			int[] HWN = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			int H = intArray[0];
			int W = intArray[1];
			int N = int.Parse(Console.ReadLine());

			List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToList());
			
			double[] R = Console.ReadLine().Split(' ').Select(i => double.Parse(i)).ToArray();

			Boolean ok = false;
			
			List<int> dp = Enumerable.Repeat(値, 個数).ToList();
			
			Console.WriteLine(ans);
			Console.WriteLine("Yes");
			Console.WriteLine("No");
			Console.ReadKey();
			Console.WriteLine(cnt);

			for(int i= 0; i < N; i++)
		*/

		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
			double[] v = Console.ReadLine().Split(' ').Select(i => double.Parse(i)).ToArray();
			Array.Sort(v);
			double ans = v[0];
			for (int i = 1; i < N; i++)
            {
				ans = (ans + v[i]) / 2;
            }
			Console.WriteLine(ans);
		}

		class Item : IComparable
		{
			public string A;
			public int B;
			public Item(string a, int b)
			{
				this.A = a;
				this.B = b;
			}
			public int CompareTo(object obj)
			{
				return B - ((Item)obj).B;
			}
		}

		/// <summary>
		/// 回文
		/// </summary>
		/// <param name="Target"></param>
		/// <param name="len"></param>
		/// <returns></returns>
		static bool Palindrome(string Target , int len)
        {
			bool yes = true;

			for(int i = 0;i < len; i++)
            {
				if(Target[i] != Target[len - 1 - i])
                {
					yes = false;
					break;
                }
            }
			return yes;
        }

		/// <summary>
		/// アナグラム
		/// </summary>
		/// <param name="word1"></param>
		/// <param name="word2"></param>
		/// <returns></returns>
		static bool IsAnagramOf(string word1, string word2)
		{
			char[] val1 = word1.ToCharArray();
			char[] val2 = word2.ToCharArray();
			Array.Sort(val1);
			Array.Sort(val2);
			word1 = new string(val1);
			word2 = new string(val2);

			return word1 == word2;
			//return word1.OrderBy(x => x).SequenceEqual(word2.OrderBy(x => x));
		}

		/// <summary>
		/// 最小公倍数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Lcm(BigInteger a, BigInteger b)
		{
			return a * b / Gcd(a, b);
		}

		/// <summary>
		/// 最大公約数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Gcd(BigInteger a, BigInteger b)
		{
			if (a < b)
				// 引数を入替えて自分を呼び出す
				return Gcd(b, a);
			while (b != 0)
			{
				var remainder = a % b;
				a = b;
				b = remainder;
			}
			return a;
		}
	}
}

Measured memory_bytes: 28248
/*
Sharif Hasan - CSE, PUST
Apr 24, 2020 02: 14 PM
*/
#include<bits/stdc++.h>
#define br cout<<"\n"
#define what(x) cout<<"in here var= "<<x<<"\n";

/*STL definations*/
#define pb push_back

#define FOR(i,n) for(long long i=0;i<n;i++)
#define FROM(a,i,n) for(long long i=a;i<n;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
/*Main function*/
int main()
{
    long long a,b,x;
    cin>>a>>b>>x;
    long long n=min(b-1,x);
    cout<<((a*n)/b)-a*(n/b);
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 
    string s; cin >> s;
    int slen = s.length();

    // left[i] := 自分から左にみて初めてくるRまでの距離
    // right[i] := 自分から右に見て初めてくるLまでの距離
    vector<int> left(slen, 0), right(slen, 0);
    for(int i=0; i<slen; ++i){
        if(s[i] == 'R') left[i] = 0;
        else left[i] = left[i-1]+1;
    }

    for(int i=slen-1; i>=0; --i){
        if(s[i] == 'L') right[i] = 0;
        else right[i] = right[i+1]+1;
    }

    vector<int> ans(slen, 0);
    for(int i=0; i<slen; ++i){
        if(s[i] == 'R'){
            if(right[i]%2 == 0) ans[i+right[i]] += 1;
            else ans[i+right[i]-1] += 1;
        }
        else if(s[i] == 'L'){
            if(left[i]%2 == 0) ans[i-left[i]] += 1;
            else ans[i-left[i]+1] += 1;
        }
    }

    for(int i=0; i<slen; ++i){
        if(i) cout << ' ';
        cout << ans[i];
    }
    cout << endl;


    return 0;
}

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

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


def solve(N: int):
    print(YES if str(N).count('9') > 0 else NO)
    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()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n = int(input())
ai = [int(input()) for i in range(n)]

li = [False]*n

li[0]=1
now = 1
for i in range(n):
    now = ai[now-1] 
    if now ==2:
        print(i+1)
        exit()
    elif li[now-1] !=False:
        print(-1)
        exit()
else:
    print(-1)

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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N;
vector<int> h;

signed main()
{

    cin >> N;
    h.resize(N);

    rep(i, N)
    {
        cin >> h[i];
    }

    int ans = 0;

    int flag = 1;

    while (1)
    {
        rep(i, N)
        {

            if (h[i] > 0)
            {
                h[i] -= 1;
                flag = 0;
            }
            else
            {
                if (flag == 0)
                {
                    ans++;
                }
                flag = 1;
            }

            if (i == N - 1)
            {
                if (flag == 0)
                {
                    ans++;
                }
                flag = 1;
            }
        }

        vector<int> temp;
        temp = h;

    
        sort(all(temp), greater<>());
        if (temp[0] == 0)
        {
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(void){
	char str[81];
	char str2[81];
	int key;
	int len;
	int i, j;

	while(1){
		if(scanf("%[^\n]%*c", str) == EOF) break;
		len = strlen(str);
		for(i=0; i < len; i++){
			strcpy(str2, str);
			if(str2[i] >= 't'){
				key = 't' - str2[i];
			}else{
				key ='t'  - ('z' + 1 + (str2[i] - 'a'));
			}
			for(j=0; j < len; j++){
				if(str2[j] == ' ' || str2[j] == '.') continue;
				str2[j]  += key;
				if(str2[j] < 'a'){
					str2[j] = 'z' + 1 - ('a' - str2[j]);
				}

				if(str2[j] > 'z') str2[j] = 'a' - 1 + (str2[j] - 'z');
			}
			if(!(strstr(str2, "that") == NULL && strstr(str2, "this") == NULL && strstr(str2, "the") == NULL)) goto OK;
		}
		OK :;

		printf("%s\n", str2);
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>

int main(){
	int N;
	int *p;
	p = (int *)malloc(sizeof(int) * N);
	scanf("%d" , &N);
	int max , max_ind , sum;
	max = max_ind = sum = 0;
	for( int i = 0; i < N; i++ ){
		scanf("%d" , &p[i]);
		if( max < p[i] ){
			max = p[i];
			max_ind = i;
		}
		sum += p[i];
	}
	sum -= p[max_ind];
	sum += max/2;
	printf("%d\n",sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 1e5 + 5;
int a[MAXN], sum[MAXN];
map <int, int> can;

signed main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif
  
  int n, m, v, p;
  read(n), read(m), read(v), read(p);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  sort(a + 1, a + 1 + n);
  for (RI i = 1; i <= n; ++i) sum[i] = sum[i - 1] + a[i];
  for (RI i = n; i >= 1; --i) {
    if (a[i] + m < a[n - p + 1]) break;
    if (i + (p - 1) >= v) { can[a[i]] = 1; continue; }
    if (can[a[i]]) continue;
    LL res = (v - i - (p - 1)) * m;
    LL s = sum[n - (p - 1)] - sum[i];
    LL cnt = n - (p - 1) - i;
    if ((a[i] + m) * cnt >= s + res)
      can[a[i]] = 1;
    else break;
  }
  int ans = 0;
  for (RI i = 1; i <= n; ++i)
    if (can[a[i]]) ++ans;
  printf("%lld\n", ans);

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 9088
#include <iostream>
#include<vector>

using namespace std;
int main() {
	int n;
	int now = 1;
	int tmp;
	int brick = 0;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (now == tmp) {
			now++;
		}
		else {
			brick++;
		}
	}
	if (brick == n) {
		brick = -1;
	}
	cout << brick;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.TreeMap;




public class Main {
	  static int MOD=1000000007;
	  static long p[][]=new long[405][405];
	  static long sum[][]=new long[405][405];
	  static long dp[][]=new long[405][405];
	  static long a[]=new long[405];
	  static long b[]=new long[405];
      public static void main(String[] args) {
    	  Scanner in=new Scanner( new BufferedReader(new InputStreamReader(System.in)))	;
    
    	  
    	  for(int i=1;i<=404;i++)//p[i][j]=i^j
    	  {
    		  p[i]= new long[405];
    		  p[i][0]=1;
    		  for(int j=1;j<=404;j++)
    		  {
    			  p[i][j]=(p[i][j-1]*i)%MOD;
    		  }
    	  }
    	 
    	  for(int i=1;i<=404;i++)//sum[i][j] 1^j+...+i^j
    	  {
    		  sum[i]=new long[405];
    		 
    		  for(int j=0;j<=404;j++)
    		  {
    			  sum[0][j]=0;
    			  sum[i][j]=(sum[i-1][j]%MOD+p[i][j]%MOD)%MOD;
    		  }
    	  }
    	  int n=in.nextInt();
    	  int m=in.nextInt();
    	  
    	  for(int i=1;i<=n;i++)
    	  {
    		  a[i]=in.nextLong();
    	  }
    	  for(int i=1;i<=n;i++)
    	  {
    		  b[i]=in.nextLong();
    	  }
    	  
    	  dp[0][0]=1;
    	  for(int i=1;i<=n;i++)
    	  {
    		  for(int j=0;j<=m;j++)
    		  {
    			  for(int k=0;k<=j;k++)
    			  {
    				  long temp=(sum[(int) b[i]][k]%MOD-sum[(int) (a[i]-1)][k]%MOD+MOD)%MOD;
    				  dp[i][j]=(dp[i][j]%MOD+dp[i-1][j-k]*temp%MOD)%MOD;
    			  }
    		  }
    	  }
    	  System.out.println(dp[n][m]);
    	  return;
      }
}


Measured memory_bytes: 32124
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
const ll inf = 1e18;
int m , n , K , a[N];
ll f[N] , g[N];
pair<ll,int> dp[N];

int main(){
  scanf("%d%d%d",&n,&m,&K);
  rep(i,1,n+1) scanf("%d",a+i);
  rep(i,1,n+1) f[i] = a[i];
  rep(t,2,K+1) {
    int l = 0 , r = 0;
    rep(i,1,n+1) {
      while(l < r && i - dp[l].se > m)
        ++l;
      g[i] = l != r ? dp[l].fi + ll(t) * a[i] : -inf;
      if(f[i] != -inf) {
        while(l < r && f[i] >= dp[r - 1].fi)
          --r;
        dp[r++] = mp(f[i] , i);
      }
    }
    rep(i,1,n+1) f[i] = g[i];
  }
  printf("%lld\n",*max_element(f+1,f+1+n));
  return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> vta(n);
    for (int i = 0; i < n; ++i) {
        cin >> vta[i];

    }

    int m;
    cin >> m;
    vector<int> vtb(m);
    for (int i = 0; i < m; ++i) {
        cin >> vtb[i];
    }

    vector<int> res;
    set_difference(vta.begin(), vta.end(), vtb.begin(), vtb.end(),
                     back_inserter(res));

    for (auto x:res) cout << x << endl;
    return 0;
}


Measured memory_bytes: 5372
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int K = Integer.parseInt(sc.next());
    int T = Integer.parseInt(sc.next());
    int max = 0;
    for(int i = 0; i < T; i++){
      int n = Integer.parseInt(sc.next());
      max = max < n ? n : max;
    }
    
    System.out.println(Math.max(0,max*2-K-1));
  }
}

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

int n, m, a[300005];
int main()
{
	int i, j;
	cin >> n >> m;
	if (n % 2 == 0) {
		printf("%d ", n / 2);
		for (i =1; i < m; i++) printf("%d ", n);
		return 0;
	}
	for (i = 0; i < m; i++) a[i] = (n + 1) / 2;
	i = m - 1;
	for (j = 0; j < m / 2; j++) {
		a[i]--;
		if (a[i] == 0) a[i] = n, i--;
		else i = m - 1;
	}
	for (j = 0; j <= i; j++) printf("%d ", a[j]);
    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int _, n;
  cin >> _ >> n;
  vll v(101010);
  for (int i = 0; i < n; i++) {
    ll l, r;
    cin >> l >> r;
    l--;
    v[l]++;
    v[r]--;
  }
  ll ans = 0, sum = 0;
  for (int i = 0; i < 101010; i++) {
    sum += v[i];
    if (sum == n) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include "iostream"
#include "string"

using namespace std;

int main() {
	int n;
	bool flag[101] = {false};
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a = 0;
		cin >> a;
		flag[a] = 1;
	}
	int ans = 0;
	for (int i = 0; i < 101; i++) {
		if(flag[i]) ans++;
	}
	cout << ans << endl;
}

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

inline int num (const std::string& S, int idx){ return S.at(idx) - '0'; }
inline unsigned int bitMask(int i){ return (1 << i); }
inline bool isTrue(unsigned int bit, int i){ return bit & bitMask(i); }

int main(){
	string S, T;
	cin >> S >> T;
	int a, b;
	cin >> a >> b;
	string U;
	cin >> U;
	if(U == S){
		cout << (a-1) << " " << b << endl;
	}else{
		cout << a << " " << (b-1) << endl;
		}
	return 0;
}


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

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


template <typename T=long long>
class BIT  
{
    private:
        int sz;  // BIT の大きさ
        vector<T> bit;  // BIT を保存する vector; 区間の右端で番号付け

    public:
        BIT(int N): sz(N), bit(N+1, 0) {};

        // v[idx] に w を足す
        void add(int idx, T w){
            // x&(-x) で x の最も下の立っているbitが取り出せる
            for(int x = idx; x <= sz; x += x&(-x)) bit[x] += w;  // 1-index
            // for(int x = idx; x < sz; x |= x+1) bit[x] += w;  // 0-index
        }

        // v[1]+...+v[idx] を返す
        T sum(int idx){
            T ret = 0;
            for(int x = idx; x > 0; x -= x&(-x)) ret += bit[x];  // 1-index
            // for(int x = idx-1; x >= 0; x = (x&(x+1))-1) ret += bit[x];  // 0-index
            return ret;
        }
        
        // v[left+1]+...+v[right] を返す
        T sum(T left, T right){ return sum(right)-sum(left); }
};

// 座標圧縮 O(NlogN)
template <typename T>
vector<T> coordComp(vector<T>& a)
{
    int n = a.size();
    vector<T> ret(n), tmp(a);

    sort(tmp.begin(), tmp.end());  // sort
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());  // unique な値のみ残す

    for(int i = 0; i < n; ++i){
        ret[i] = lower_bound(tmp.begin(), tmp.end(), a[i]) - tmp.begin();
    }

    return ret;
}


int main()
{
    int N, K;
    cin >> N >> K;
    vector<long long> a(N+1);  // 1-index
    REP(i, N) cin >> a[i+1];

    REP(i, N){
        a[i+1] -= K;
        a[i+1] += a[i];
    }

    // 座標圧縮; a[1], ... , a[N] -> [0, N) に圧縮
    auto comp_a = coordComp<long long>(a);

    BIT<> bit(N+1); // BIT で 0~N-1 の出現回数を管理
    long long ans = 0;
    REP(i, N+1){
        ans += bit.sum(comp_a[i]+1);
        bit.add(comp_a[i]+1, 1);
        // cout << i << " " << ans << endl;
    }
    cout << ans << endl; 

    return 0;
}

Measured memory_bytes: 4992
use std::io;
use std::str::FromStr;

fn input_tuple() -> (usize, usize) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<usize> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_char_vec() -> Vec<char> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().chars().collect()
}



fn main() {
    let (n, q) = input_tuple();
    let s = input_char_vec();
    let mut indices: Vec<usize> = Vec::new();
    let mut flag = false;
    for i in 0..s.len() {
        if s[i] == 'A' {
            flag = true;
        } else {
            if s[i] == 'C' && flag {
                indices.push(i - 1);
            }
            flag = false;
        }
    }

    let mut cummulation: Vec<usize> = Vec::new();
    let mut j = 0usize;
    let mut sum = 0;
    for i in 0..n {
        if j < indices.len() && i == indices[j] + 1 {
            j += 1;
            sum += 1;
        }
        cummulation.push(sum);
    }

    // println!("{:?}", cummulation); 

    for i in 0..q {
        let (l, r) = input_tuple();
        println!("{}", cummulation[r - 1] - cummulation[l - 1]);
    }
       
}


Measured memory_bytes: 6908
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll mod = 1e9+7;
ll table[100010];

ll fct(ll x){
    return table[x];
}

int main(){
    ll n,m;
    cin >> n >> m;
    table[0] = 1;
    for (int i=1;i < 100001;i++){
        table[i]=((table[i-1])*i)%mod;
        table[i]%=mod;
    }
    if (max(n,m) - 1 == min(n,m)){
        ll ans=0;
        ans=fct(n)*fct(m);
        ans%=mod;
        cout << ans << endl;
    }
    else if (n==m){
        ll ans=0;
        ans=2*fct(n)*fct(m);
        ans%=mod;
        cout << ans << endl;
    }
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> num = new ArrayList<>();
        for (int i=1;i<10;i++){
            for (int j=1;j<10;j++){
                num.add(i*j);
            }
        }
        if (num.contains(scanner.nextInt())){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 25044
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int A,B,K;
    cin >> A >> B >> K;
    if (A >= K)
        cout << A - K << " " << B;
    else {
        if (A+B >K)
            cout << 0 << " " << B-(K-A);
        else
            cout << 0 << " " << 0;
    }
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
e = [0]*(N+1)
w = [0]*(N+1)
for i in range(len(S)):
  e[i+1] = e[i] + (1 if S[i]=="E" else 0)
  w[i+1] = w[i] + (1 if S[i]=="W" else 0)
ans = 10**6
for i in range(N):
  ans = min(ans,w[i]+e[-1]-e[i+1])
print(ans)

Measured memory_bytes: 29348
S = input()

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)

Measured memory_bytes: 9100
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input().split())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    else:
      if cnt > 0:
        ansOne += 1
        cnt = 0
      i+=1
    
  else:
    ansAny += 1

if ansAny <= 0:
  ansOne += 1
print("{} {}".format(max(ansOne, 1), ansOne + ansAny))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
vector<vector<int> > v( 4 , vector<int> (4, 0));
map<int,int>mp;
int n;

for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
cin>>v[i][j];
}}
cin>>n;
for(int i=0;i<n;i++){
int x;cin>>x;
mp[x]=1;
}
if(mp[v[1][1]]==1&&mp[v[1][2]]==1&&mp[v[1][3]]==1)cout<<"Yes"<<endl;
else if(mp[v[2][1]]==1&&mp[v[2][2]]==1&&mp[v[2][3]]==1)cout<<"Yes"<<endl;
else if(mp[v[3][1]]==1&&mp[v[3][2]]==1&&mp[v[3][3]]==1)cout<<"Yes"<<endl;
else if(mp[v[1][1]]==1&&mp[v[2][1]]==1&&mp[v[3][1]]==1)cout<<"Yes"<<endl;
else if(mp[v[1][2]]==1&&mp[v[2][2]]==1&&mp[v[3][2]]==1)cout<<"Yes"<<endl;
else if(mp[v[1][3]]==1&&mp[v[2][3]]==1&&mp[v[3][3]]==1)cout<<"Yes"<<endl;
else if(mp[v[1][3]]==1&&mp[v[2][2]]==1&&mp[v[3][1]]==1)cout<<"Yes"<<endl;
else if(mp[v[1][1]]==1&&mp[v[2][2]]==1&&mp[v[3][3]]==1)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int N,C[100][100];
signed main(void) {
  cin >> N;
  rep(i,N)rep(j,N)cin >> C[i][j];
  int ans = 0;
  rep(i,N) {
    for (int j = i + 1; j < N; j++) {
      ans += min(C[i][j], C[j][i]); 
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    ll x, a, b, A, B;
    cin >> x;
    for (a = -300; a <= 300; a++) {
        for (b = -300; b <= 300; b++) {
            A = a * a * a * a * a;
            B = b * b * b * b * b;
            if (A - B == x) {
                cout << a << " " << b << endl;
                return;
            }
        }
    }
}

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#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++)
 
int main() {
    int x,y;
    cin>>x>>y;
    rep(i,y/2+1){
        rep(j,y/4+1){
            if (i+j==x && 2*i+4*j==y){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    scanf("%d %d",&A,&B);
    if(A==B){cout<<"Draw"<<endl;}
    else if(A==1){cout<<"Alice"<<endl;}
    else if(B==1){cout<<"Bob"<<endl;}
    else if(A>B){cout<<"Alice"<<endl;}
    else{cout<<"Bob"<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b); i++)
#define sz(v)  (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pi>
#define fs first
#define sd second
#define pb push_back

void solve(){
      string s, t;
      cin >> s >> t;
      for(int i=0; i<(int)s.size(); i++){
            if(s[i]!=t[i]){
                  cout << "No\n";
                  return;
            }
      }
      cout << "Yes\n";
} 

int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      solve();
      return 0;
}
      





Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n,sum=0;
	cin>>n;
	std::vector<ll> a(n);
	std::vector<ll> v;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	ll z=n/2;
	cout<<a[z]-a[z-1]<<"\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define LOGN 42
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < ll , ll > ii;

ll n, m, k, bas = 1, h[N], a[N], x[N], ilk[N], git[LOGN + 5][N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld %lld",&n ,&m);
	for(ll i = 1; i <= n; i++){
		scanf("%lld",a + i);
		if(!ilk[a[i]])
			ilk[a[i]] = i;
	}
	for(ll i = n; i >= 1; i--){
		if(h[a[i]]){
			git[0][i] = h[a[i]] == n ? 1:git[0][h[a[i]] + 1];
		} else{
			git[0][i] = ilk[a[i]] + 1;
		}
		h[a[i]] = i;
		// cout << i << " " << git[0][i] << endl;
	}
	git[0][n + 1] = 1;
	for(ll i = 1; i <= LOGN; i++)
		for(ll j = 1; j <= n + 1; j++)
			git[i][j] = git[i - 1][git[i - 1][j]];
	// m--;
	for(ll i = LOGN; i >= 0; i--){
		// cout << (1ll<<i) << endl;
		if( (1ll<<i) < m){
			m -= (1ll<<i);
			bas = git[i][bas];
		}
	}
	// cout << m << " " << bas << endl;
	memset(h, 0, sizeof h);
	for(ll i = bas; i <= n; i++){
		if(h[a[i]]){
			while(1){
				h[x[k]] = 0;
				k--;
				if(x[k + 1] == a[i])
					break;
			}
		} else{
			x[++k] = a[i];
			h[a[i]] = 1;
		}
	}
	for(ll i = 1; i <= k; i++)
		printf("%lld ", x[i]);
	return 0;
}

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


int gcd(long long a, long long b) {
  if(a < b) return gcd(b, a);
  long long r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main(){
  long long A,B,C,D;
  cin >>A>>B>>C>>D;
  long long E=C*D/gcd(C,D);
 
  cout<<setprecision(18)<<(B-A+1)-((B-(B%C))-((A-1)-((A-1)%C)))/C-((B-(B%D))-((A-1)-((A-1)%D)))/D+((B-(B%E))-((A-1)-((A-1)%E)))/E<<endl;
  return 0;
}

      
      

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

int main(){
    int A, B;
    cin >> A >> B;
    if(A>=1 && A<=13 && B>=1 && B<=13){
        if(A==B){
            cout << "Draw";
        }
        else if(A==1 && B>=2 && B<=13){
            cout << "Alice";
        }
        else if(B==1 && A>=2 && A<=13){
            cout << "Bob";
        }
        else if(A>B){
            cout << "Alice";
        }
        else if(B>A){
            cout << "Bob";
        }
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

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

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

    vector<int> city(N, 0);

    rep(i, M)
    {
        cin >> a >> b;
        city.at(a-1)++;
        city.at(b-1)++;
    }
    rep(i, N){
        cout << city.at(i) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int main()
{
	int a,b,c,x;
	int ans=0;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
				if(i*500+j*100+k*50==x)
					ans++;
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int X[][]=new int[N][2];
		int A[]=new int[N];
		int z=0,y=N/2;
		while(z<N){
			X[z][0]=stdIn.nextInt();
			X[z][1]=z;
			z++;
		}z=0;
		Arrays.sort(X, (a, b) -> Long.compare(a[0], b[0]));
		while(z<N){
			if(z<y)
				A[X[z][1]]=X[y][0];
			if(z==y)
				A[X[z][1]]=X[y-1][0];
			if(z>y)
				A[X[z][1]]=X[y-1][0];
			z++;
		}z=0;
		while(z<N){
			System.out.println(A[z]);
			z++;
		}
	}
}

Measured memory_bytes: 107164
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;


int  main(){
  int a,b,k;
  cin>>a>>b>>k;
  int count=1,ans;
  for(int i=min(a,b);i>=1;i--){
    if(a%i==0 && b%i==0){
      if(count==k) ans=i;
      count++; 
    }
  }
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,j,k,l,m,ans=0,n3,n5,n7;
  cin>>n;
  vector<vector<int>> a(10);
  a.at(0).push_back(0);
  for(i=1;i<10;i++){
    for(j=0;j<a.at(i-1).size();j++){
      for(k=0;k<3;k++){
        l=10*a.at(i-1).at(j)+2*k+3;
        if(l<=n){
          n3=0;n5=0;n7=0;
          m=l;
          while(m>0){
            if(m%10==3) n3++;
            else if(m%10==5) n5++;
            else if(m%10==7) n7++;
            m/=10;
          }
          if(n3>0&&n5>0&&n7>0) ans++;
          a.at(i).push_back(l);
        }
        else{
          j=a.at(i-1).size();
          k=3;
          i=10;
        }
      }
    }
  }
  cout<<ans<<endl;
}

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;

int main(){
    int a,b;
    cin >> a >> b;
    cout << a-b+1 << endl;
    return 0;
}


Measured memory_bytes: 768
#include<stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N], color[N];
int d[N], f[N], t;

void idfs(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++t;
  for(v = 0; v < n; v++){
    if(M[u][v] == 0) continue;
    if(color[v] == WHITE){
      idfs(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++t;
}

void dfs_init(){
  int i;
  for(i = 0; i < n; i++){
    color[i] = WHITE;
  }

  t = 0;
  for(i = 0; i < n; i++){
    if(color[i] == WHITE ){
      idfs(i);
    }
  }

  for(i = 0; i < n; i++){
    printf("%d %d %d\n", i+1, d[i], f[i]);
  }

}


int main(){
  int i, j, u, k, v;
  
  scanf("%d", &n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      M[i][j] = 0;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d%d", &u, &k);
    for(j = 0; j < k; j++){
      scanf("%d", &v);
      M[u-1][v-1] = 1;
    }
  }

  dfs_init();

  return 0;
}



Measured memory_bytes: 2052