akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    int N, count=0;
    cin >> N;
    vector<int> V(N);
    for(int i=0; i<N;i++) cin >> V[i];
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            for(int k=j+1; k<N; k++) {
                if(V[i] == V[j] || V[i] == V[k] || V[j] == V[k]) continue;
                if(V[k] < V[i] + V[j] && V[i] < V[j]+V[k] && V[j] < V[i] + V[k]) {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3624
n,m=map(int,input().split())
t=100*(n-m)+1900*m
p=0.5**m
ex=0
i=1
while(1):
  pl=t*i*(1.0-p)**(i-1)*p
  if(pl<0.001):break
  else:ex+=pl
  i+=1
print(int(1+ex))

Measured memory_bytes: 3060
#B
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
for x in range(n-m+1):
    for y in range(n-m+1):
        for i in range(m):
            if b[i] != a[y+i][x:x+m]:
                break
        else:
            print('Yes')
            exit()
print('No')

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

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

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define UNIQ(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }


void func(long long N, std::vector<long long> A){
    ll i;
    ll sum = 0;
    ll max = A[0];

    rep(i, N){
        if (max > A[i]) {
            sum += (max - A[i]);
            // cout << max << endl;
        } else {
            max = A[i];
            // cout << A[i] << endl;
        }
    }
    cout << sum << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4848
N = int(input())
p = tuple(map(int, input().split()))
 
cont = 0
ans = 0
for idx, pi in enumerate(p):
    i = idx + 1
 
    if i == pi:
        cont += 1
    else:
        ans += (cont + 1) // 2
        cont = 0
 
ans += (cont + 1) // 2
print(ans)

Measured memory_bytes: 53868
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
 
#define inf 1e18
#define sqr(x) ((x)*(x))
using namespace std;
char s[300005];
ll ans=0;
int main(){
	scanf("%s",s+1);
	int len=strlen(s+1),cnt=0;
	For(i,1,len)
		if (s[i]=='B') cnt++;
		else ans+=cnt;
	printf("%lld\n",ans);
} 

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


def main():

    INF = 10 ** 7
    n, m = map(int, input().split())
    state_num = 1 << n
    key = []
    for i in range(m):
        a, b = map(int, input().split())
        c = list(map(int, input().split()))
        bt = 0
        for e in c:
            bt |= 1 << (e - 1)
        key.append((bt, a))

    dp = [INF for _ in range(state_num)]
    dp[0] = 0

    for i in range(state_num):
        for j in range(m):
            ks, kc = key[j]
            state = i | ks
            cost = dp[i] + kc
            dp[state] = min(dp[state], cost)

    ans = dp[-1]
    if ans == INF:
        ans = -1
    print(ans)


if __name__ == "__main__":
    main()



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,x,y;
  cin >> N;
  vector<int> cake(N);
  x = 0;
  y = 0;
 
  for (int i = 0; i < N; i++) cin >> cake[i];
  sort(cake.begin(), cake.end());
  for (int i = 0; i < N - 1; i++) {
      if (cake[i] == cake[i + 1]) y++;
  }
  cout << N - y << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int cnt = 1;
		String s = sc.next();
		char prev = s.charAt(0);
		for(int i=1; i<s.length(); i++) {
			if(s.charAt(i)==prev) {
				cnt++;
			} else {
				prev = s.charAt(i);
				cnt = 1;
			}
			if(cnt==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	
	static int binarySearch(int[] A, int x) {
		int l = 0;
		int r = A.length;
		while(l<r) {
			int mid = (l+r)/2;
			if(A[mid] == x) return mid;
			else if(x<A[mid]) r = mid;
			else l = mid+1;
		}
		return -1;
	}
	
	static long upper_bound(int[] A, int b) {
		// bよりおおきい値がはじめて出てくるindexを返す
		return lower_bound(A, b+1);
	}

	static long lower_bound(int[] A, int b) {
		// b以上の値がはじめて出てくるindexを返す
		int lb=0;
		int ub=A.length;
		while(ub>lb) {
			int mid = (lb+ub)/2;
			if(A[mid]>=b) ub = mid;
			else lb = mid+1;
		}
		return lb;
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int N = S.size();
  string firhalf = S.substr(0, (N-1)/2);
  string sechalf = S.substr((N+1)/2);
  string revfirhalf = S.substr((N-3)/2, 1);
  string revsechalf = S.substr(N-1, 1);
  for (int i=0; i<(N-3)/2; i++) {
    revfirhalf += S.at((N-5)/2 - i);
  }
  for (int i=0; i<(N-3)/2; i++) {
    revsechalf += S.at(N-2 - i);
  }
  if ((revfirhalf == firhalf) && (revsechalf == sechalf) && (firhalf == revsechalf) && (sechalf == revfirhalf)) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

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

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

	string s;
	cin >> s;
	REP(i, s.size()){
		if(i%2==0){
			cout << s[i];
		}
	}
	cout << endl;
}


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

int main() {
	int a, b, c;
	cin >> a >> b >>c;
	if (a > b)swap(a, b);
	if (a < c && c < b)cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)1e9 + 5)
#define MAXL ((ll)1e15 + 5)
#define MAX_X ((int)1e5 + 2)
#define pi (2.0*acos(0))
#define M ((int)1e6 + 7)
#define MOD ((int)998244353 + 0)
#define NN ((int)1e5 + 7)
#define N ((int)3e5 + 5)
#define eps (0)
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
#define logn 29
#define endl "\n"
#define mp make_pair
//#define int ll


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;

/*fast io
ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/




typedef tree < pair < int, pair < int, int > >,  null_type,  less < pair < int, pair < int, int > > >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;
/// o_set s;
/// s.order_of_key(k) : Number of items strictly smaller than k .
/// *(s.find_by_order(k)) : K-th element in a set (counting from zero).

int main()
{
    ll n , a , b;
    cin>>n>>a>>b;
    ll ans = (1 + b - a)/2;
    if((b-a)&1){
        ans += min(a-1,n-b);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;
int main(){
	ios::sync_with_stdio(0);
	cin>>k;
	cout<<a[k-1];
	re 0;
}

Measured memory_bytes: 256
// finish date: 2018/2/14

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;

//最大公約数
int gcd(int a, int b) {
    if (a < 0) a = -a;
    if (b < 0) b = -b;
    if (a < b) {
        swap(a, b);
    }
    int r = 1; //0以外であれば何でも
    while (r != 0) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    int ans = A[0];
    FOR(i, 1, N) {
        int g = gcd(A[i], A[0]);
        if (g == 1) {
            cout << 1 << endl;
            return 0;
        }
        ans = min(ans, g);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int x = scanner.nextInt();
			int y = scanner.nextInt();
			int z = scanner.nextInt();
			System.out.println((x - z) / (y + z));
		}
	}
}


Measured memory_bytes: 23764
#include<cstdio>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#define MAX_V 100001
#define INF 1000000000000000
using namespace std;
struct edge{int to;long cost;};
typedef pair<long,int> P;

int V;
vector<edge> G[MAX_V][2];
long d[MAX_V][2];

void dijkstra(int s,int b){
    priority_queue<P,vector<P>,greater<P> > que;
    for(int i=0;i<=V;i++){
        d[i][b]=INF;
    }
    d[s][b]=0;
    que.push(P(0,s));

    while(!que.empty()){
        P p=que.top(); que.pop();
        int v=p.second;
        if(d[v][b]<p.first) continue;
        for(int i=0;i<G[v][b].size();i++){
            edge e=G[v][b][i];
            if(d[e.to][b]>d[v][b]+e.cost){
                d[e.to][b]=d[v][b]+e.cost;
                que.push(P(d[e.to][b],e.to));
            }
        }
    }
}

int main(){
    int m,s,t,v,u;
    long a,b,ans[100000]={};
    scanf("%d%d%d%d",&V,&m,&s,&t);
    for(int i=0;i<m;i++){
        scanf("%d%d%ld%ld",&v,&u,&a,&b);
        G[u][0].push_back({v,a});
        G[u][1].push_back({v,b});
        G[v][0].push_back({u,a});
        G[v][1].push_back({u,b});
    }
    dijkstra(s,0);
    dijkstra(t,1);
    ans[V]=INF-(d[V][0]+d[V][1]);
    for(int i=V-1;i>=0;i--){
        ans[i]=INF-(d[i][0]+d[i][1]);
        ans[i]=max(ans[i],ans[i+1]);
    }
    for(int i=1;i<=V;i++){
        printf("%ld\n",ans[i]);
    }
}


Measured memory_bytes: 19072
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){

  string S;
  cin >> S;
  int ans = 700;

  for (int i = 0; i < 3; i++) {
    if(S[i]=='o') ans += 100;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;

void dump(vector<int> v) {
    rep(i, v.size()) cout << v[i] << " ";
    cout << endl;
}

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

    vector<int> l(n);
    rep(i, n) cin >> l[i];
    
    int n_pat = 1;
    rep(i, n) n_pat *= 4;

    int best = 1e8;
    rep(pat, n_pat) {
        vector<int> A, B, C;

        int t_pat = pat;
        rep(i, n) {
            if (t_pat % 4 == 1) {
                A.push_back(i);
            }
            else if (t_pat % 4 == 2) {
                B.push_back(i);
            }
            else if (t_pat % 4 == 3) {
                C.push_back(i);
            }
            t_pat /= 4;
        }

        int lA = 0;
        rep(i, A.size()) lA += l[A[i]];
        int lB = 0;
        rep(i, B.size()) lB += l[B[i]];
        int lC = 0;
        rep(i, C.size()) lC += l[C[i]];

        if (A.size() <= 0 || B.size() <= 0 || C.size() <= 0) {
            continue;
        }

        int mp = 10 * (A.size() + B.size() + C.size() - 3);
        mp += abs(a - lA);
        mp += abs(b - lB);
        mp += abs(c - lC);

        // if (best > mp) {
        //     put(mp);
        //     cout << lA << "/" << lB << "/" << lC << endl;
        //     dump(A);
        //     dump(B);
        //     dump(C);
        // }
        best = min(best, mp);
    }

    put(best)
    return 0;
}

Measured memory_bytes: 3628
use proconio::input;
use proconio::marker::Usize1;
use std::collections::HashMap;

fn main() {
  input! {
    n: usize,
    m: usize,
  }
  
  let mut map: HashMap<usize, Vec<usize>> = HashMap::new();
  for i in 0..m {
    input! {
      nn: usize,
      switches: [Usize1;nn]
    }
    map.insert(i, switches.into_iter().collect::<Vec<usize>>());
  }
  
  input! {
    needs: [usize;m]
  }
  
  let mut total = 0;
  for mut i in 0..2usize.pow(n as u32) {
    let mut ons: Vec<usize> = vec![0;n];
    let mut index = 0;
    while 0 <  i {
      ons[index] = i & 1;
      index += 1;
      i >>= 1;
    }
    
    let mut flag = true;
    for key in map.keys() {
      let mut sum = 0;
      for ii in map.get(key).unwrap() {
        sum += ons[*ii];
      }
      if sum % 2 != needs[*key] {
        flag = false;
        break
      }
    }
    
    if flag {
      total += 1;
    }
  }
  println!("{}", total);  
}

Measured memory_bytes: 2184
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define mod 1000000007
#define N 2000010
using namespace std;

struct data{int x, y, f;}a[5], b[5];
int x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6, jc[N], inv[N], ans;

inline int C(int n, int m){
	if(m<0||m>n)return 0;
	return (ll)jc[n]*inv[m]%mod*inv[n-m]%mod;
}

inline int c1(int a, int b, int n, int m){
	if(a<0||b<0)return 0;
	int ans=0;
	for(int i=0; i<=a; i++)ans=(ans+(ll)(b+1+i)*C(b+i, b)%mod*C(n+m-b-1-i, m-b-1)%mod)%mod;
	for(int i=0; i<=b; i++)ans=(ans+(ll)(a+1+i)*C(a+i, a)%mod*C(n+m-a-1-i, n-a-1)%mod)%mod;
	return ans;
}

inline int check(int i, int j){
	int f=a[i].f*b[j].f, ans=0;
	int n=b[j].x-a[i].x, m=b[j].y-a[i].y;
	ans+=c1(x4-a[i].x, y4-a[i].y, n, m); if(ans>=mod)ans-=mod;
	ans-=c1(x4-a[i].x, y3-1-a[i].y, n, m); if(ans<0)ans+=mod;
	ans-=c1(x3-1-a[i].x, y4-a[i].y, n, m); if(ans<0)ans+=mod;
	ans+=c1(x3-1-a[i].x, y3-1-a[i].y, n, m); if(ans>=mod)ans-=mod;
	if(f==-1)ans=(mod-ans)%mod; return ans;
}

int main(){
	scanf("%d%d%d%d%d%d", &x1, &x2, &x3, &x4, &x5, &x6);
	scanf("%d%d%d%d%d%d", &y1, &y2, &y3, &y4, &y5, &y6);
	jc[0]=1; for(int i=1; i<=2000000; i++)jc[i]=(ll)jc[i-1]*i%mod;
	inv[0]=inv[1]=1; for(int i=2; i<=2000000; i++)inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1; i<=2000000; i++)inv[i]=(ll)inv[i-1]*inv[i]%mod;
	a[1].x=x1-1; a[1].y=y1-1; a[1].f=1;
	a[2].x=x1-1; a[2].y=y2; a[2].f=-1;
	a[3].x=x2; a[3].y=y1-1; a[3].f=-1;
	a[4].x=x2; a[4].y=y2; a[4].f=1;
	b[1].x=x6+1; b[1].y=y6+1; b[1].f=1;
	b[2].x=x6+1; b[2].y=y5; b[2].f=-1;
	b[3].x=x5; b[3].y=y6+1; b[3].f=-1;
	b[4].x=x5; b[4].y=y5; b[4].f=1;
	ans=0;
	for(int i=1; i<=4; i++)
		for(int j=1; j<=4; j++)ans=(ans+check(i, j))%mod;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    int n = s.size();
    map<int, int> m = {{'b', 'd'}, {'d', 'b'}, {'p', 'q'}, {'q', 'p'}};
    for (int i = 0; i < n; i++) {
        if (s[i] != m[s[n-i-1]]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	a--;
	b--;
	c--;
	d--;
	string s;
	cin >> s;

	bool canRace = true;
	for (int i = a;i < c;i++) {
		if (s[i] == '#' && s[i + 1] == '#') {
			canRace = false;
		}
	}

	for (int i = b; i < d;i++) {
		if (s[i] == '#' && s[i + 1] == '#') {
			canRace = false;
		}
	}

	if (d < c) {
		bool canBeyond = false;
		for (int i = b ; i <=d ;i++) {
			if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
				canBeyond = true;
			}
		}

		if (!canBeyond) {
			canRace = false;
		}
	}
	cout << (canRace ? "Yes" : "No") << endl;

}



Measured memory_bytes: 640
import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.string;
import std.conv;

void main(){
    readln;
    string[] inputs = readln.chomp.split;
    writeln(solve(inputs));
}

string solve(in string[] inputs){
    foreach(color; inputs) {
        if(color == "Y"){
            return "Four";
        }
    }
    return "Three";
}

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

int main()
{
    int num;
    std::cin >> num;
    long A[num];
    std::vector<long long> B(num + 1, 0);
    for (int i = 0; i < num; i++)
    {
        std::cin >> A[i];
        B[i + 1] = B[i] + A[i];
    }

    int mod = 1000000007;
    long ans = 0;
    for (int i = 0; i < num; i++)
    {
        long long sum = (B[num] - B[i + 1]) % mod;
        //std::cout << sum_all << std::endl;
        ans += sum * A[i];
        ans %= mod;
    }

    //std::cout << (long)141421356*17320508 << std::endl;
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 6324
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define brep(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define orep(i, n) for (int i =  1; i <= (int)n; i++)
#define vec vector
#define pb push_back
#define mp make_pair
#define pii pair<int, int>

int main(void)
{
	int n, m;
	cin >> n >> m;
	vec<int> x(n);
	rep(i, n) cin >> x[i];
	sort(x.begin(), x.end());
	vec<int> y(m, 0);
	vec<int> same(m, 0);
	int prev = - 1;
	rep(i, n) {
		y[x[i] % m]++;
		if (i && x[i] == x[i - 1]) {
			if (prev != x[i]) {
				prev = x[i];
				same[x[i] % m]++;
			} else prev = - 1;
		} 
	}
	int ans;
	ans = y[0] / 2;
	if (m % 2 == 0) ans += y[m / 2] / 2;
	for (int i = 1; i <= (m - 1) / 2; i++) {
		int a = i;
		int b = m - i;
		if (y[a] <= y[b]) {
			ans += y[a];
			ans += min((y[b] - y[a]) / 2, same[b]);
		} else {
			ans += y[b];
			ans += min((y[a] - y[b]) / 2, same[a]);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef unsigned long ulint;
const int mod = 2019;

int main() {
    int n,d;
    cin >> n >> d;
    int ans = 0;
    int range = d*2+1;
    while (n > 0)
    {
        n -= range;
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

class UneveNumbers{
    public static void Main(String[] args){
        int N = int.Parse(Console.ReadLine());
        int count = 0;

        
        for(int i = 0; i<=N; i++){
             if(i.ToString().Length%2 != 0){
                count += 1;
            }
        }
        Console.WriteLine(count-1);
    }
}

Measured memory_bytes: 13140
/* ex3_3
   kohei_suzuki */

#include <stdio.h>
#include <math.h>

int main(void){
    int n, k; //整数n,進数k
    int m = 0; //桁数m

    scanf("%d %d",&n, &k); //n.kの入力

    while(n >= pow(k,m)){ //nとk^mを比較して桁数を求める
        m  += 1; //mを1ずつ増やして繰り返し比較する
    }

    printf("%d\n",m); //桁数mを出力

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int a,b;cin>>a>>b;
  if(0<a){
    print("Positive");
    re 0;
  }
  if(a<=0&&0<=b){
    print("Zero");
    re 0;
  }
  if((b-a)%2==0){
    print("Negative");
  }
  if((b-a)%2==1){
    print("Positive");
  }


}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c) {
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";
	}
}


Measured memory_bytes: 3200
n, m = map(int, input().split())

aclist = [0] * n
walist = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if aclist[int(p)] == 1:
        continue
    if s == 'AC':
        aclist[int(p)] = 1
    if s == 'WA':
        walist[int(p)]+=1
print(sum(aclist), sum(j for idx, j in enumerate(walist) if aclist[idx] == 1))

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

#define ALL(a) (a).begin(), (a).end()
#define PB push_back

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(1100);
    int sum = 0;
    rep(i,N){
        cin >> A.at(i);
        sum += A.at(i);
    }
    int count = 0;
    rep(i,N){
        if((1.0/(M*4.0))*sum <= A.at(i)){
            count++;
        }
    }
    if(count >= M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int a, b;
    cin >> a >> b;
    cout << ((a * b) % 2 ? "Odd" : "Even") << endl;
}

Measured memory_bytes: 256
fun main(arr: Array<String>) {
    val (n,x) = readLine()!!.split(" ").map { it.toInt() }
    val l = readLine()!!.split(" ").map { it.toInt() }
    val jump = mutableListOf(0)
    l.forEach { jump.add(jump.last() + it) }
    println(jump.count { it <= x })
}


Measured memory_bytes: 36328
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double a, b, x;
    cin >> a >> b >> x;
    double y = 2 * x / (a * a) - b;
    double z = 2*x/(a*b);
    double sol;
    if (y < 0)
        sol = atan2(b, z) * 180. / M_PI;
    else
    {
        double r = b - y;
        sol = atan2(r, a) * 180. / M_PI;
    }
    cout << setprecision(15) << fixed << sol;
}


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

int main(){
    int n;
    vector<int> seg{0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
    while(1){
        cin>>n;
        if(n==-1){
            return 0;
        }
        vector<int> d(n);
        int x = 0;
        for(int i=0;i<n;i++){
            cin>>d.at(i);
        }
        for(int i=0;i<n;i++){
            int y=x^seg.at(d.at(i));
            cout<<(bitset<7>(y))<<endl;
            x = seg.at(d.at(i));
        }
    }
}


Measured memory_bytes: 3128
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll,ll,ll> tl3;
// https://atcoder.jp/contests/abc174/tasks/abc174_e
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n,k;
    cin >> n >> k;
    vector<ll> v(n);
    for(int i = 0;i<n;i++){
        cin >> v[i];
    }
    ll l = 0;
    ll h = 1e9+1;
    ll ans = 0;
    while(l <= h){
        ll mid = (l+h)/2;
        if(mid < 1){
            ans = 1;
            break;
        }
        ll temp = 0;
        for(auto k : v)
            temp += ((k+mid-1)/mid) - 1;
        if(temp <= k){
            ans = mid;
            h = mid - 1;
        }
        else
            l = mid+1;
    }
    cout << ans;

    return 0; 
}

Measured memory_bytes: 4700
#include <iostream>
#include <map>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int w, q;
  while (cin >> w >> q && w + q) {
    VI dat(w, 0);
    map<int, PI> tbl;
    REP(i, 0, q) {
      string t;
      cin >> t;
      if (t == "s") {
        int a, b; cin >> a >> b;
        int idx = -1;
        REP(i, 0, w - b + 1) {
          bool ok = 1;
          REP(j, 0, b) if (dat[i+j]!=0)ok=0;
          if (ok) { idx = i; break; }
        }
        if (idx == -1) {
          cout << "impossible" << endl;
        } else {
          cout << idx << endl;
          REP(i, idx, idx + b) dat[i] = 1;
          tbl[a] = PI(idx, idx + b);
        }
      } else {
        int a; cin >> a;
        PI b = tbl[a];
        REP(i, b.first, b.second) dat[i] = 0;
        tbl.erase(a);
      }
    }
    cout << "END\n";
  }
}



Measured memory_bytes: 3076
//PDF解説
#include<iostream>
#include<string>
using namespace std;

int main() {
  string A, B;
  cin >> A >> B;
  int len_A = A.length(), len_B = B.length();
  
  if (len_A > len_B) cout << "GREATER";
  else if (len_A < len_B) cout << "LESS";
  else {
    if (A > B) cout << "GREATER";
    else if (A < B) cout << "LESS";
    else cout << "EQUAL";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N; cin>>N;
  int ans=1;
  while(1){
    if(ans>N){
      ans/=2;
      break;
      }
    ans*=2;
    }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100010
using namespace std;
int a[N][3];
int dp[N][3];
int n;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= 2; j++)
		{
			cin >> a[i][j];
			dp[i][j] = max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + a[i][j];
		}
	}
	cout << max(dp[n][0],max(dp[n][1], dp[n][2]));
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>

using namespace std;


int main()
{
    long double n = 0, d = 0, a = 0, b = 0, counter = 0;
    cin >> n >> d;
    while (n--) {
        cin >> a >> b;
        if (round(sqrt(pow(a, 2) + pow(b, 2)) <= d)) {
            counter++;
        }
    }
    cout << counter;
    return 0;
}

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

int N;
vector<ll> a,s;

void dfs(ll p, ll x) {
	if(x != 0)
		s.push_back(x);
	if(p == N)
		return;

	dfs(p+1, x+a.at(p));
	if(x == 0)
		dfs(p+1, 0);
}

int main() {
	ll K,r=0;
	cin >> N >> K;
	a.resize(N);

	rep(i,N)
		cin >> a.at(i);
	dfs(0,0);
	
	rep(i,40) {
		ll t=(1ll<<(39-i))+r, c=0;

		rep(j,s.size())
			if(t == (t&s.at(j)))
				++c;

		if(c >= K)
			r = t;
	}
	
	cout << r << endl;
}

Measured memory_bytes: 6516
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}
ll gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll calc(ll b,ll n){
	if (n < b) return n;
	return calc(b, n / b) + n % b;
}

void Solve() {

	int n;
	cin >> n;
	double res = 0;
	for (size_t i = 0; i < n; i++)
	{
		double b;
		string j;
		cin >> b >> j;
		if (j == "JPY") {
			res += b;
		}
		else {
			res += b * 380000.0;
		}
	}
	cout << std::setprecision(8) << res << endl;
}


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



Measured memory_bytes: 6016
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int A=in.nextInt();
		int B=in.nextInt();
		int C=in.nextInt();
		int D=in.nextInt();
		if(A*B>C*D)System.out.println(A*B);
		else if(A*B<C*D)System.out.println(C*D);
		else System.out.println(A*B);
		in.close();
		
	}

}


Measured memory_bytes: 10068
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
use std::str::FromStr;
use std::cmp::PartialEq;

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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// N M
// input! {
//     N: i32,
//     M: i32,
// }

// N
// a1, ..., aN
// input! {
//     N: i32,
//     A: [i32, N],
// }

// H W
// a11 ... a1W
// ...
// aH1 ... aHW
// input! {
//     H: i32,
//     W: i32,
//     A: [[i32, W], H],
// }

// S
// input! {
//     S: chars,
// }

fn main() {
    input! {
        N: usize,
        S: chars,
    };

    let mut black = Vec::new();
    black.push(0);

    for (i, s) in S.iter().enumerate() {
        black.push(0);
        black[i + 1] = black[i];
        if *s == '#' {
            black[i + 1] += 1;
        }
    }

    let mut ans = N;
    for i in 0..N + 1 {
        let white = (N - i) - (black[N] - black[i]);
        ans = std::cmp::min(ans, black[i] + white);
    }

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


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

using namespace std;

int main() {
    vector<int>v(4);
    for(int i=0;i<3;i++){
        int a,b;cin>>a>>b; a--;b--;
        v[a]++; v[b]++;
    }
    int count  =0;
    for(int i=0;i<4;i++)
        count+=v[i]%2;
    cout << (count<=2?"YES":"NO")<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int S;
    int s, m, h;
    
    scanf("%d", &S);
    
    h = S/ 3600;
    m = (S%3600) / 60;
    s = S % 60;

    printf("%d:%d:%d\n", h,m,s);
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	ll A, B; cin >> A;
	string op; cin >> op;
	cin >> B;
	if(op == "+") cout << A + B << endl;
	else cout << A - B << endl;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;

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

  for (int i = K; i < N; i++) {
    int current = A.at(i);
    int before  = A.at(i - K);

    if (current > before) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3992
import java.lang.reflect.Array;
import java.util.*;
public class Main {
	static Queue<Integer> queue_x = new ArrayDeque<>();
	static Queue<Integer> queue_y = new ArrayDeque<>();
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int W = Integer.parseInt(sc.next());
		int cnt[][] = new int[H][W];
		for(int i = 0; i < H; i++) {
			Arrays.fill(cnt[i], -1);
			String temp = sc.next();
			for(int j = 0; j < W; j++) {
				if(temp.charAt(j) == '#') {
					queue_x.add(j);
					queue_y.add(i);
					cnt[i][j] = 0;
				}
			}
		}
		
		int ans = 0;
		while(queue_x.size() != 0 && queue_y.size() != 0) {
			int y = queue_y.poll();
			int x = queue_x.poll();
			
			int dx[] = {0, 1, 0, -1};
			int dy[] = {1, 0, -1, 0};
			
			in : for(int i = 0; i < 4; i++) {
				if(x + dx[i] < 0) continue in;
				if(x + dx[i] >= W) continue in;
				if(y + dy[i] < 0) continue in;
				if(y + dy[i] >= H) continue in;
				
				if(cnt[y + dy[i]][x + dx[i]] == -1) {
					queue_x.add(x + dx[i]);
					queue_y.add(y + dy[i]);
					cnt[y + dy[i]][x + dx[i]] = cnt[y][x] + 1;
					ans = Math.max(ans, cnt[y + dy[i]][x + dx[i]]);
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 109620
MOD = 10**9+7
n, m = map(int, input().split())


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append((i, cnt))
    if tmp != 1:
        retval.append((tmp, 1))
    return retval


def com(n, r):
    X = Y = 1
    if n-r < r:
        r = n-r
    for i in range(1, r+1):
        Y = Y*i % MOD
        X = X*(n-i+1) % MOD
    Y = pow(Y, MOD-2, MOD)
    return X*Y


fact = factorization(m)
ans = 1
for x, p in fact:
    ans *= com(n+p-1, n-1)
print(ans % MOD)


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <queue>

using namespace std;

int main(){
  int N;
  int tmpa, tmpb;
  int sum = 0;
  vector<int> a;
  vector<int> b;
  vector<int> c;
  int itr=0;
  cin >> N;
  vector<vector<int>> to(N);
  vector<int> answer(N,-1);
  for(int i=0; i<N-1;i++){
    cin >> tmpa >> tmpb;
    tmpa--;
    tmpb--;
    to[tmpa].push_back(tmpb);
    to[tmpb].push_back(tmpa);
  }
  for(int i=0; i<N;i++){
    cin >> tmpa;
    c.push_back(tmpa);
    sum += tmpa;
  }
  sort(c.begin(), c.end(), greater<int>());
  sum -= c[itr];
  int root;
  for(int i=0; i<N; i++){
    if(to[i].size() == 1){
      root = i;
      answer[i] = c[itr]; itr++;
      break;
    }
  }
  queue<int> q;
  q.push(root);
  while(!q.empty()){
    int f = q.front();
    q.pop();
    for(int i=0; i < (int)to[f].size(); i++){
      if(answer[to[f][i]] != -1) continue;
      answer[to[f][i]] = c[itr]; itr++;
      q.push(to[f][i]);
    }
  }

  //output
  cout << sum << endl;
  for(int i=0; i<N-1; i++){
    cout << answer[i] << " ";
  }
  cout << answer[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <string.h>
#include <cassert>

#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (count); i++)
#define V_CIN(v) do{for(int i = 0; i < sz(v); i++) cin >> (v)[i];}while(0)
#define all(c) (c).begin(),(c).end()

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 1000000007;

typedef pair<int,int> Pii;

bool t[123456*2+10];

int main()
{
	memset(t,1,sizeof(t));
	t[1] = false; 
	int mx = (int)sqrt(123456.0 * 2) + 1;
	for(int i = 2; i < mx; i++){
		if(t[i]){
			for(int j = i*2; j < sizeof(t); j += i){
				t[j] = false;
			}
		}
	}

	int a;
	while(cin >> a,a){
		int count = 0;
		for(int i = a + 1; i <= a * 2; i++) 
			count += t[i];
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 0
N,K=map(int,input().split())
A=list(map(int,input().split()))
lk=len(bin(K))-2
C=[0]*lk
for j in range(N):
  a=A[j]
  for i in range(lk):
    if a%2==1:
      C[i]+=1
    a=(a-a%2)//2

X="0b"
for i in reversed(range(lk)):
  if C[i]>=N-C[i]:
    X+="0"
  else:
    X+="1"
    
if int(X,0)<=K:
  X=int(X,0)
  ans=0
  for i in range(N):
    ans+=X^A[i]
  print(ans)
else:
  ans=-1
  for i in range(2,lk+2):
    x=int(bin(K)[:i]+"0"+X[i+1:],0)
    if x<=K:
      a=0
      for i in range(N):
        a+=x^A[i]
      ans=max(ans,a)
  print(ans)


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

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

  int counter=0 ;
  
  for (int i=0; i < s.size() ; i++){
  if (s.at(i)=='1'){
  counter++;
  }
  }
  
  cout << counter << endl;
  }




  

Measured memory_bytes: 256
N = int(input())
x = 0
 
for i in range(1,N+1):
 
    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()


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

int main(){
	string s;
	cin>>s;
	
	int n=0;
	for(int i=0;i<4;i++){
		if(s[i]=='-') n--;
		else n++;
	}
	
	cout<<n<<endl;
	
	
	return 0;
}		

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main app = new Main();
		String string;
		int x, y, tmp, count;
		
		while(!(string = reader.readLine()).equals("0 0")){
			x = Integer.valueOf(string.split(" ")[0]);
			y = Integer.valueOf(string.split(" ")[1]);
			count = 0;
			
			if(x > y){
				tmp = y;
				y = x;
				x = tmp;
			}
			while(y != 0){
				tmp = x;
				x = y;
				y = tmp;
				x = app.CommonDivisor(x, y);
				count++;
			}
			System.out.println(x + " " + (count - 1));
		}
	}
	
	public int CommonDivisor(int x, int y){
		if(y == 0) return x;
		return x % y;
	}
}

Measured memory_bytes: 26836
def mtoi(l):
    r=0
    c=1
    for i in l:
        if i=="m":
            r+=c*1000
            c=1
        elif i=="c":
            r+=c*100
            c=1
        elif i=="x":
            r+=c*10
            c=1
        elif i=="i":
            r+=c
            c=1
        else:
            c=int(i)
    return r


def itom(r):
    m=r//1000
    c=r//100-m*10
    x=r//10-m*100-c*10
    i=r-1000*m-100*c-10*x
    t=""
    if m:
        if m==1:t+="m"
        else:t+=str(m)+"m"
    if c:
        if c==1:t+="c"
        else:t+=str(c)+"c"
    if x:
        if x==1:t+="x"
        else:t+=str(x)+"x"
    if i:
        if i==1:t+="i"
        else:t+=str(i)+"i"
    return t

for _ in range(int(input())):
    l=input().split()
    print(itom(sum(map(mtoi,l))))



Measured memory_bytes: 5620
using System;

namespace test
{
    class Swap
    {
        public void swap(ref int x,ref int y){
            int t = x;
            x = y;
            y = t;
        }
    }

    class Program
    {
        static void Main(string[] args){
            Swap ob = new Swap();
            int a, b, c;
            string[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            c = int.Parse(str[2]);
            if (a > b){
                ob.swap(ref a, ref b);
            }
            if (b > c){
                    ob.swap(ref b, ref c);
                }
            if(a>b){
                    ob.swap(ref a, ref b);
                    }
                
            
            Console.WriteLine("{0} {1} {2}", a, b, c);
		}
    }
}

Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
#define fin(ans) cout << ans << endl

int main(void) {
  int a, b, j;
  cin >> a >> b;
  j = max(a*500, b);
  if (j == a*500)
    fin("Yes");
  else
    fin("No");
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
d = defaultdict(lambda: 0)
for a in range(1, 10**2):
    for b in range(1, 10**2):
        for c in range(1, 10**2):
            t = a**2+b**2+c**2+a*b+b*c+c*a
            if t <= n:
                d[t] += 1
            else:
                break

for i in range(1, n+1):
    print(d[i])


Measured memory_bytes: 70588