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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
set<string> S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>s;
		S.insert(s);
	}
	cout<<S.size()<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main() {
	long long n; cin >> n;
	if (n % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	long long d = 10, ans = 0;
	while (n / d > 0) {
		ans += n / d;
		d *= 5;
	}
	cout << ans << endl;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

ll sol = 0;

ll calc(ll n) {
	if (n == 0) return 0;
	return 1LL + 2LL*calc(n/2);
}

int main() {
	ll n;
	scanf("%lld", &n);
	printf("%lld\n", calc(n));
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())
max_L = max(L)
min_R = min(R)
if(min_R - max_L + 1 > 0):
    print(min_R - max_L + 1)
else:
    print(0)

Measured memory_bytes: 10868
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};


int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);   
    string s;
    cin>>s;
    ll cnt=0,mx=0;
    for(ll i=0;i<3;i++){
        if(s[i]=='R') cnt++;
        else{
            mx = max(mx,cnt);
            cnt=0;
        } 
    }
    mx = max(mx,cnt);
    pfl(mx);
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(m),b(m);
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i];
        a[i]--,b[i]--;
    }
    int ans = 0;
    for (int i = 0; i < m; ++i) {
        UnionFind uf(n);
        for (int j = 0; j < m; ++j) {
            if(i == j) continue;
            uf.merge(a[j],b[j]);
        }
        if(uf.size(a[0]) != n) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

c =Counter(s)
c2 = c.most_common()
a = c2[0][1]
ans = []

for i in range(len(c)):
    if c2[i][1] == a:
        ans.append(c2[i][0])
ans.sort()
print(*ans,sep="\n")


Measured memory_bytes: 50164
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, k, m;
        cin >> n >> k >> m;
        if(n == 0)
            return 0;

        vector<int> next(n);
        for(int i=0; i<n; ++i)
            next[i] = (i+1) % n;

        int curr = m - 1;
        int prev = (m - 2 + n) % n;
        for(int i=1; i<n; ++i){
            next[prev] = next[curr];
            curr = prev;
            int k1 = (k-1) % (n-i) + 1;
            for(int j=0; j<k1; ++j){
                prev = curr;
                curr = next[curr];
            }
        }

        cout << (curr+1) << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 1LL << 20;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    int N;
    ll K;
    cin >> N;
    cin >> K;

    int A[200000];
    for(int i = 0l; i < N; i++){
        cin >> A[i];
        A[i]--;
    }

    int l = 0;
    ll c = 1;
    int T[200000]={0};
    T[l] = c++;
    for(;;){
        l = A[l];
        if(T[l] != 0){
            break;
        }
        T[l] = c++;
    }
    c--;

    int begin = T[l] - 1;

    if(K <= begin){
        int v = 0;
        for(int i = 0; i < K; i++){
            v = A[v];
        }
        cout << v + 1 << endl; 
        return;
    }

    ll n = ((K - begin) % (c-begin)) + begin;
    int v = 0;
    for(int i = 0; i < n; i++){
        v = A[v];
    }

    cout << v + 1 << endl; 
}


Measured memory_bytes: 5204
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
int x_1,y_1,x_2,y_2;
cin >> x_1 >> y_1 >> x_2 >> y_2;
int x = x_2 - x_1;
int y = y_2 - y_1;
int x_3 = x_2 - y;
int y_3 = y_2 + x;
int x_4 = x_3 - x; 
int y_4 = y_3 - y;
cout << x_3 << " " << y_3 << " " << x_4 << " " << y_4 << endl;
}


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

using namespace std;

int main(){
	long long N, M;
	cin >> N >> M;
	
	vector< pair<long long, long long> > stores(N);
	for (int i = 0; i < N; i++){
		long long a, b;
		cin >> a >> b;
		stores[i] = make_pair(a, b);
	}

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

	long long num = 0;
	long long ans = 0;
	for (int i = 0; i < N; i++){
		if (num + stores[i].second < M){
			ans += stores[i].first * stores[i].second;
			num += stores[i].second;
		} else {
			ans += stores[i].first * (M - num);
			break;
		}
	}

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

Measured memory_bytes: 1792
use proconio::input;

fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let max_a = aa.iter().copied().max().unwrap();
    let mut nums = vec![0; max_a + 1];

    for a in aa {
        nums[a] += 1;
    }

    let mut index_min = 0;
    let mut index_max = nums.len() - 1;
    'outer: while index_min <= index_max {
        while nums[index_min] < 2 {
            index_min += 1;
            if index_min >= nums.len() {
                break 'outer;
            }
        }
        while nums[index_max] < 2 {
            if index_max == 0 {
                break 'outer;
            }
            index_max -= 1;
        }

        nums[index_min] -= 1;
        nums[index_max] -= 1;
    }

    let mut ans = 0;
    for n in nums {
        if n == 1 {
            ans += 1;
        }
    }

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


Measured memory_bytes: 3824
/**
    Bismillahir Rahmanir Rahim
    Md. Rakibul Islam
    Dept. of CSE, CoU
    **/
#include<bits/stdc++.h>
#define SQR(n) (n*n)
#define CHR getchar()
#define NL printf("\n")
#define PI 2.0*acos(0.0)
#define ll              long long int
#define ull             unsigned long long int
#define sc              scanf
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        ((a)*(b))/gcd(a,b)
#define pf              printf
#define MOD             1000000007
#define mx              123456789
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define ff first
#define D double
#define sz size()
#define ss second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()

#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))

#define BitCnt(a) __builtin_popcountll(a)
#define MEM(a,val) memset(a,val,sizeof(a))
using namespace std;
int main()
{
    int a, b, c;
    cin>>a>>b;
    if(a+b==15)
        cout<<"+"<<endl;
    else if(a*b==15)
        cout<<"*"<<endl;
    else
        cout<<"x"<<endl;
    return 0;
}


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    int prev_h = 0;
    REP(i, n) {
        int h;
        cin >> h;
        ans += max(h - prev_h, 0);
        prev_h = h;
    }
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 256
#2019/09/30
std_input = open(0).readlines()
N, M, Q = map(int, std_input[0].split())
#print(N, M, Q)
A = list(map(int, std_input[1].split()))
#print(A)
cnt_up = 0
cnt_down = 0
Qup = Q
Qdown = Q
for i in range(N-Q):
    Qup += 1
    if Qup in A:
        cnt_up += 1
for i in range(N):
    Qdown -= 1
#    print(Qdown)
    if Qdown < 0:
        break
    if Qdown in A:
        cnt_down += 1
#print(cnt_up, cnt_down)
print(min(cnt_up,cnt_down))

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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

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

    i64 r = 0, g = 0, b = 0;
    for (auto& e : s) {
        switch (e) {
        case 'R':
            r++;
            break;
        case 'G':
            g++;
            break;
        case 'B':
            b++;
            break;
        }
    }

    i64 ans = r * g * b;
    for (i32 d = 1; d < n; d++) {
        for (i32 i = d; i + d < n; i++) {
            if (s[i-d] != s[i] && s[i] != s[i+d] && s[i+d] != s[i-d]) ans--;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3628
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))


void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}

int main() {
//  std::vector<int> vec = {10,40,40,20,20,30,20,20,40};
//  std::sort(vec.begin(), vec.end());
//  vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
//  printVec(vec);    // 10 20 30 40

	int ans=0;
	int n;
	cin >> n;

  //std::vector<int> vec = {10,40,40,20,20,30,20,20,40};
	int tmp;
  std::vector<int> vec;
	rep(i,n) {
		cin >> tmp;
		vec.push_back(tmp);
	}
  std::sort(vec.begin(), vec.end());
  //vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
  //printVec(vec);    // 10 20 30 40

	n=vec.size();
	//cout << "vec" << n << endl;
	for(int x=0;x<n-2;x++){
		for(int y=x+1;y<n-1;y++){
			for(int z=y+1;z<n;z++){
				//cout << x << ","<< y << ","<< z << ",";
				if((vec[x] < vec[y]) && (vec[y] < vec[z]))
				{
				if(vec[x]+vec[y]>vec[z]) {
					ans++;
					//cout << "ans";
				}
				}
				//cout << endl;
			}
		}
	}



//	vector<int> l;
	//int l[n];
//	rep(i,n) cin >> l[i];
 // sort(l.begin(), l.end());
 // l.erase(std::unique(l.begin(), l.end()), l.end());
	cout << ans << endl;

}

Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main(){
    int n,d,x,a[100]={};
    int sum=0;
    cin>>n>>d>>x;
    for(int i=0;i<n;i++)
        cin>>a[i];
    
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            if(d/((j+1)*a[i]+1)>0) sum++;
        }
    }
    sum+=n;
    cout<<sum+x<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
static const int N = 100;

int main() {
  int M[N][N];  // 0 オリジンの隣接行列
  int n, u, k, v;

  cin >> n;
  
  // initial condition insert
  for (int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) M[i][j] = 0;
  }

  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    u--; // 0オリジンへ変換
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--; // 0オリジンへ変換
      M[u][v] = 1; // uとvの間に辺を振る
    }
  }

  for (int i = 0; i < n; i++) {
    for ( int j = 0; j < n; j++) {
      if (j) cout << " "; // 最初以外は空白を前におく
      cout << M[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

      




Measured memory_bytes: 3112
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;

//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
const LL INF=LONG_MAX;
const double EPS=0.00001;
const long double PI = acos(-1.0);

const int MAX_N=2e5+2;

int main(){
    LL N;
    cin>>N;
    if(N%2==0){
        cout<<N/2LL<<" "<<N<<" "<<N<<endl;
        return 0;
    }else{
        FOR(h,1,3501)FOR(n,1,3501){
            LL y=h+n;
            LL x=n*h;
            if(4*x>N*y&&N*x%(4*x-N*y)==0){
                cout<<n<<" "<<h<<" "<<N*x/(4*x-N*y)<<endl;
                return 0;
            }
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<int> vc{ -1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 };
    
    int x, y;
    cin >> x >> y;
    
    cout << ( vc[ x ] == vc[ y ] ? "Yes" : "No" ) << endl;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto N = readln.chomp.to!int;
    auto XS = readln.split.to!(int[]);
    auto YS = XS.dup;
    sort(XS);
    auto XA = XS[N/2-1];
    auto XB = XS[N/2];

    foreach (y; YS)
        writeln(y <= XA ? XB : XA);
}

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

int main(void){
    int N;
    cin >> N;
    vector<int> weight(N), abs_vector(N), sum(N), sum1(N), sum2(N);
    int i, T;
    
    for(i = 0; i < N; i++){
        int W;
        cin >> W;
        weight[i] = W;
        //cout << weight[i] << endl;
    }
    sum[0] = weight[0];
    //cout << sum[0] << endl;
    for(i = 0; i < N-1; i++){
        sum[i+1] = weight[i+1] + sum[i];
    }
    for(T = 0; T < N; T++){
        sum1[T] = sum[T];
        sum2[T] = sum[N-1]-sum[T];
        //        cout << sum[T] << " " <<sum1[T]<< " " << sum2[T]<< " " << endl;
    }
    for(i = 0; i < N; i++){
        int tmp = sum1[i] - sum2[i];
        abs_vector[i] = ((int)abs(tmp));
        //        cout << abs_vector[i] << endl;
    }
    
    cout << *min_element(abs_vector.begin(),abs_vector.end()) << endl;
}


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


int main(){
  ll x,y;
  cin >> x >> y;
  if(y >= 2*x && y<=4*x && (y%2==0)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}



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

using ll = long long;
const int mod = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    if (N == M)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	int ct = 1;
	for (int i = 0; i < N; i++) {
		if (ct * 2 < ct + K)ct *= 2;
		else ct += K;
	}
	cout << ct << endl;
	return 0;
}

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

int main() {
  long double x1,y1,x2,y2;
  cin >> x1>>y1>>x2>>y2;
  cout << fixed;
  cout << powl((powl(x2-x1, 2) + powl(y2-y1, 2)), 0.5) << endl;
  return 0;
}



Measured memory_bytes: 3476
from math import gcd
N = int(input())
A = list(map(int, input().split()))


X = A[:]
while len(X) > 1:
    X.append(gcd(X.pop(), X.pop()))


def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


S = set()
pairwise_coprime_flg = True
for a in A:
    s = set(prime_factorization(a))
    for v in s:
        if v in S:
            pairwise_coprime_flg = False
        S.add(v)
    if not pairwise_coprime_flg:
        break

if pairwise_coprime_flg:
    print('pairwise coprime')
elif X[0] == 1:
    print('setwise coprime')
else:
    print('not coprime')


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

using namespace std;

int main(void){

	
	unsigned int N;
	scanf("%d", &N);
	//printf("N:%d\n", N);
	unsigned int A[N+1], order[N+1];//A[0], order[0] は使わない
	
	for(int i=1; i<=N; i++){ 
		scanf("%d", &A[i]); //A[i]:ID=iの学生はA[i] 番目に登校した。
		order[A[i]] = i; 
	}

	for(int i=1; i<=N; i++){
		printf("%d ", order[i]);
	
	}

	return 0;
}


Measured memory_bytes: 1536
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int WALL = 10000;
	int GOAL = 100000;
	int w, h;
	int map[][];
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			w = sc.nextInt();
			h = sc.nextInt();
			if( (w|h) == 0 ) break;
			
			map = new int[h+2][w+2];
			for(int i=1;i<=h;i++) {
				String str = sc.next();
				for(int j=1;j<=w;j++) { 
					switch (str.charAt(j-1)) {
					case '#': map[i][j] = WALL; break;
					case '&': map[i][j] = GOAL; break;
					}
				}
			}

			int c=1;
			
			System.out.println(bfs());
		}
	}
	
	int dx[] ={-1,0,1,0};
	int dy[] ={0,-1,0,1};
	
	int bfs() {
		PriorityQueue<P> que = new PriorityQueue<P>();
		que.add(new P(0,0,0,false));
		map[0][0] = INF;
		
		for(;;) {
			P now = que.remove();
//			debug(now.x, now.y);
			for(int i=0;i<4;i++) {
				int nx = now.x + dx[i];
				int ny = now.y + dy[i];
				if( nx < 0 || nx >= w+2 || ny < 0 || ny >= h+2 ) continue;
				
				if( map[ny][nx] < WALL ) {
					map[ny][nx] = INF;
					que.add(new P(nx,ny,now.c,false));
				}
				else if(map[ny][nx] == WALL) {
					map[ny][nx] = INF;
					que.add(new P(nx,ny,now.c+(now.isWall? 0:1),true));
				}
				else if(map[ny][nx] == GOAL) return now.c;
			}
		}
	}
	
	class P implements Comparable<P>{
		int x, y, c;
		boolean isWall;
		P(int x, int y, int c, boolean w) {
			this.x = x;
			this.y = y;
			this.c = c;
			isWall = w;
		}
		@Override
		public int compareTo(P o) {
			// TODO 自動生成されたメソッド・スタブ
			if(c != o.c)
				return c-o.c;
			return isWall? -1:1;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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

int main(){
	int n;
	cin >> n;
	long long cnt = 0;
	for(int i = 1;i<=n;i++){
		if(i%3!=0 && i%5!=0){
			cnt += i;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int a, b;
int g, l;

int gcd(int a, int b)
{
	if(b == 0) return a;
	
	int r;
	r = a % b;
	return gcd(b, r);
}

int main(void)
{
	while(1){
		cin >> a;
		if(cin.eof()) break;
		cin >> b;
		
		g = gcd(a, b);
		l = a / g * b;
		cout << g << " " << l << endl;
	}
	return 0;
}

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

using namespace std;	

int main() 
{
	int n,a;
	cin >> n >> a;
	int flag=0;

	int temp = n%500;
	if (temp<=a)
		flag = 1;

	if (flag) cout << "Yes";
	else cout << "No";    


   return 0;
}

Measured memory_bytes: 256
from collections import deque

def main():
    _ = int(input())
    B = deque([int(x) for x in input().split()])
    # B.appendleft(B[0])
    old = B[0]
    B.append(B[-1])
    ans = 0
    while B:
        now = B.popleft()
        ans += min(old, now)
        old = now
    print(ans)

if __name__ == "__main__":
    main()


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  string n;
  cin >> n;
  ll tmp = 0;
  for (char c : n) {
    tmp += c - '0';
  }
  bool ok = tmp % 9 == 0;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3752
#input
import sys
imput = sys.stdin.readline
def main():
    
    from collections import Counter
    N = int(input())
    A = list(map(int, input().split()))

#output
    B = [i-a for i, a in enumerate(A) if i-a > 0]    
    C = [i+a for i, a in enumerate(A)]
    D = Counter(C)

    answer = 0
    for b in B:
        answer += D[b]

    print(answer)    
if __name__ == "__main__":
    main()

Measured memory_bytes: 44760
a,b,c,d = gets.split('').map(&:to_i)

if a+b+c+d == 7
  puts "#{a}+#{b}+#{c}+#{d}=7"
elsif a+b+c-d == 7
  puts "#{a}+#{b}+#{c}-#{d}=7"
elsif a+b-c+d == 7
  puts "#{a}+#{b}-#{c}+#{d}=7"
elsif a-b+c+d == 7
  puts "#{a}-#{b}+#{c}+#{d}=7"
elsif a+b-c-d == 7
  puts "#{a}+#{b}-#{c}-#{d}=7"
elsif a-b-c+d == 7
  puts "#{a}-#{b}-#{c}+#{d}=7"
elsif a-b+c-d == 7
  puts "#{a}-#{b}+#{c}-#{d}=7"
elsif a-b-c-d == 7
  puts "#{a}-#{b}-#{c}-#{d}=7"
end

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


int main(){
  int n; cin >>n;
  for(int i=0; i<n; i++){
    float x1, y1, x2, y2, x3, y3, x4, y4;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    if((x2-x1)*(y3-y4)-(y2-y1)*(x3-x4) == 0){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
  
  


Measured memory_bytes: 3140
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int X = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		int sum = 0;
		for(int i = 0; i< N; i++) {
			list.add(Integer.parseInt(sc.next()));
			sum += list.get(i);
		}
		sc.close();

		//リストを昇順にソート
		Collections.sort(list);

		int plus = (X - sum) / list.get(0);
		int ans = N + plus;
		System.out.println(ans);

	}

}

Measured memory_bytes: 23636
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8"))},function(e,t){function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}e.exports=function(e){var t=e.split("\n"),n=r(t[0].split(" ").map(function(e){return Number(e)}),2),o=n[0],u=n[1],i=(t[1].split(" ").map(function(e){return Number(e)}),1+Math.ceil((o-u)/(u-1)));console.log(i)}},function(e,t){e.exports=require("fs")}]);

Measured memory_bytes: 16716
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[] h = new int[n];

        int max = 0;
        int tmp = 0;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        for (int i = n-1; i > 0; i--) {
            if (h[i] <= h[i-1]) {
                tmp++;
            } else {
                max = Math.max(tmp, max);
                tmp = 0;
            }
        }

        max = Math.max(tmp, max);
        System.out.println(max);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 42040
N[1000];main(n,m,i,c,r,x){
	for(;scanf("%d%d",&n,&m),n;printf("%d\n",r)){
		for(i=0;i<n;i++)scanf("%d",N+i);
		for(r=c=i=0;i<m;i++){
			scanf("%d",&x);
			if(!r){c+=x,c+=N[c];if(c>=n-1)r=i+1;}
		}
	}
	exit(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define ri register int
using namespace std;
#define y2 cyktxdy
typedef long long ll;
typedef vector<int> poly;
typedef vector<ll> Poly;
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
const int rlen=1<<18|1,inf=0x3f3f3f3f;
const ll Inf=1e18;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  char ch=gc();
  while(!isdigit(ch)) ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return ans;
}
inline ll readl() {
  ll ans=0;
  char ch=gc();
  while(!isdigit(ch)) ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return ans;
}
namespace modular {
  const int mod=998244353;
  inline int add(int a,int b) { return a+b<mod?a+b:a+b-mod; }
  inline int dec(int a,int b) { return a<b?a-b+mod:a-b; }
  inline int mul(int a,int b) { return (ll)a*b%mod; }
  inline void Add(int&a,int b) { a=a+b<mod?a+b:a+b-mod; }
  inline void Dec(int&a,int b) { a=a<b?a-b+mod:a-b; }
  inline void Mul(int&a,int b) { a=(ll)a*b%mod; }
  inline int ksm(int a,int p) { int ret=1;for(;p;p>>=1,Mul(a,a)) (p&1)&&(Mul(ret,a),1);return ret; }
  inline int Ksm(int a,int p) {
    int ret=1;
    for(;p;p>>=1,a=(ll)a*a%(mod-1)) (p&1)&&(ret=(ll)ret*a%(mod-1));
    return ret;
  }
  inline int Inv(int a) { return ksm(a,mod-2); }
}
using namespace modular;
template<typename T>inline void ckmax(T&a,T b) { a<b?a=b:0; }
template<typename T>inline void ckmin(T&a,T b) { a>b?a=b:0; }
template<typename T>inline T gcd(T a,T b) { T t;while(b) t=a,a=b,b=t-t/a*a;return a; }
int a[1<<18],p[1<<18],lim;
inline void fwt(int*a,int typ) {
  for(ri i=1,a0,a1,iv=(mod+1)>>1;i<lim;i<<=1) for(ri j=0;j<lim;j+=i<<1) for(ri k=0;k<i;++k) {
    a0=a[j+k],a1=a[j+k+i],a[j+k]=add(a0,a1),a[j+k+i]=dec(a0,a1);
    if(typ==-1) Mul(a[j+k],iv),Mul(a[j+k+i],iv);
  }
}
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  lim=1<<read();
  int ss=0;
  for(ri i=0;i<lim;++i) Add(ss,p[i]=read()),a[i]=i?mod-1:lim-1;
  ss=Inv(ss);
  for(ri i=0;i<lim;++i) Mul(p[i],ss);
  Dec(p[0],1);
  fwt(a,1),fwt(p,1);
  for(ri i=1;i<lim;++i) Mul(a[i],Inv(p[i]));
  fwt(a,-1);
  for(ri i=0;i<lim;++i) cout<<dec(a[i],a[0])<<'\n';
  return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <map>

using namespace std;

int main(){
	int number;
	float times;
	map<float, int> race1, race2, race3,top;

	for(int i = 0; i<24; i++){
		cin >> number >> times;
		if(i<8){
			race1.insert(make_pair(times, number));
		} 
		else if(i<16){
			race2.insert(make_pair(times, number));
		} else {
			race3.insert(make_pair(times, number));
		}
	}

	int cnt = 0;
	for(auto it = race1.begin(); cnt < 4; it++){
			if(cnt<2) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race2.begin(); cnt < 8; it++){
			if(cnt<6) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = race3.begin(); cnt < 12; it++){
			if(cnt<10) cout << it->second << " " << it->first << endl;
			else top.insert(make_pair(it->first, it->second));
			cnt++;
		}
	for(auto it = top.begin(); cnt < 14; it++){
			cout << it->second << " " << it->first << endl;
			cnt++;
		}


}

Measured memory_bytes: 1300
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

#define loop(i,first,end) for(int i=(first);i<(end);i++)
#define uint unsigned int
#define ull unsigned long long
#define ll long long
#define vint vector<int>
#define vuint vector<unsigned int>
#define vull vector<ULL>
#define vll vector<LL>
#define mod 1000000007

int main(void){
	int n, d;
	cin >> n >> d;

	d = d * 2 + 1;
	cout << (n + d - 1) / d << endl;
	return 0;
}

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

using namespace std;

const int inf=1e9+5;
const int MOD=1e9+7;
const int MAX=1e5+5;

#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define vl vector<vector<ll> >
#define eb emplace_back


int main(){
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++){
  	cin>>a[i];
  }
  vector<bool> dp(k+1,false);
  for(int i=0;i<=k;i++){
  	for(int j=0;j<n;j++){
    	if(a[j]<=i && !dp[i-a[j]]){
        	dp[i]=true;
        }
    }
  }
  if(dp[k]){
  	cout<<"First";
  }
  else{
    cout<<"Second";
  }
  return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.zeros(N+2, dtype=np.int64)
A[1:-1] = input().split()

np.cumsum(A, out = A)
total = A[-1]
A[-1] = 10 ** 18

left = np.searchsorted(A, A/2)
P1 = A[left-1]
P2 = A[left]
Q1,Q2 = A-P1, A-P2

np.maximum(P1,Q2,out = P1)
np.minimum(P2,Q1,out = P2)
P,Q = P1,P2

right = np.searchsorted(A,(total+A)/2)
R1 = A[right-1] - A
R2 = A[right] - A
S1 = total - A[right-1]
S2 = total - A[right]
np.maximum(R1,S2,out=R1)
np.minimum(R2,S1,out=R2)
R,S = R1,R2

PQRS = np.vstack([P,Q,R,S])
x = np.max(PQRS, axis=0) - np.min(PQRS, axis=0)
answer = (x[1:-1].min())
print(answer)

Measured memory_bytes: 40592
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <map>
#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 RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define MAX_N 105
int vx [4]= {1,0,-1,0};
int vy [4]= {0,1,0,-1};
long long  dp[MAX_N][21]={};//dp[i???????????§???][???]????????°
int V[MAX_N],W[MAX_N];
int data[MAX_N],B[MAX_N];
int K ,N,a[MAX_N];
using namespace std;
void init(){

  cin >> N;
  cin >> a[1];
    dp[1][a[1]]=1;
  for(int l= 2;l<=N-1;l++){
    cin >> a[l];
    for(int i= 0;i<=20;i++){
      if(i-a[l]>=0&&i-a[l]<=20) dp[l][i] += dp[l-1][i-a[l]];
      if(i+a[l]>=0&&i+a[l]<=20) dp[l][i] += dp[l-1][i+a[l]];
    }
      //REP(i,21)cout<<l<<':'<< i<<' '<<dp[l-1][i]<<endl;
  }
  //REP(i,21)cout<< i<<' '<<dp[N-1][i]<<endl;
  cin >> a[N];
  cout << dp[N-1][a[N]]<<endl;
}
void solve(){
  init();

}
int main(){
    solve();
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define vec vector
#define pb push_back
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
#define endl "\n"

typedef pair<int, int> P;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};

// char to int
int ctoi(char c) {if (c >= '0' && c <= '9') {return c - '0';}return 0;}

//--------------------------------------------------------//



int main(){

	//input and initialization//
	int n;
	cin >> n;

	ll answer = 0;

	ll pow_10 = 1;
	ll pow_9 = 1;
	ll pow_8 = 1;
	rep(i, n){
		pow_10 = (pow_10 * 10);
		pow_9 = (pow_9 * 9);
		pow_8 = (pow_8 * 8);
		if(pow_10 > MOD && pow_9 > MOD && pow_8 > MOD){
			pow_10 %= MOD;
			pow_9 %= MOD;
			pow_8 %= MOD;
		}
	}

	answer = (pow_10 - 2 * pow_9 + pow_8) % MOD;
	if(answer < 0){
		answer += MOD;
	}

	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
typedef pair<string, int> token;
int main() {
	string s1, s2;
	while (cin >> s1, s1 != ".") {
		cin >> s2;
		vector<token> v1, v2;
		int pos = 0;
		while (pos < s1.size()) {
			if (s1[pos] == '"') {
				pos++;
				string s = "";
				while (pos < s1.size() && s1[pos] != '"') {
					s.push_back(s1[pos]);
					pos++;
				}
				v1.emplace_back(s, 1);
				pos++;
			}
			else {
				string s = "";
				while (pos < s1.size() && s1[pos] != '"') {
					s.push_back(s1[pos]);
					pos++;
				}
				v1.emplace_back(s, 0);
			}
		}
		pos = 0;
		while (pos < s2.size()) {
			if (s2[pos] == '"') {
				pos++;
				string s = "";
				while (s2[pos] != '"') {
					s.push_back(s2[pos]);
					pos++;
				}
				v2.emplace_back(s, 1);
				pos++;
			}
			else {
				string s = "";
				while (pos < s2.size() && s2[pos] != '"') {
					s.push_back(s2[pos]);
					pos++;
				}
				v2.emplace_back(s, 0);
			}
		}
		if (v1.size() != v2.size()) {
			cout << "DIFFERENT" << endl;
			continue;
		}
		bool ok = 1;
		int cnt = 0;
		for (int i = 0; i < v1.size(); i++) {
			if (v1[i].second != v2[i].second) {
				ok = 0;
				break;
			}
			else if (v1[i].second == 1) {
				if (v1[i].first != v2[i].first) cnt++;
			}
			else {
				if (v1[i].first != v2[i].first) {
					ok = 0;
					break;
				}
			}
		}
		if (ok) {
			if (cnt == 0) cout << "IDENTICAL" << endl;
			else if (cnt == 1) cout << "CLOSE" << endl;
			else cout << "DIFFERENT" << endl;
		}
		else {
			cout << "DIFFERENT" << endl;
		}
	}
}


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

struct UnionFindTree{
    int N;
    vector<int> par;
    void init(int n){
        N = n;
        par.resize(N);
        for(int i=0;i<N;i++){
            par[i] = i;
        }
    }
    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(x > y) swap(x, y);
        par[x] = y;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFindTree g;
    g.init(n+m);
    for(int i=0;i<k;i++){
        int f, x, y;
        cin >> f >> x >> y;
        x--; y--;
        if(f == 1){
            if(g.find(x) >= n && g.find(y) >= n && !g.same(x, y)){
                cout << i+1 << endl;
                return 0;
            }
            g.unite(x,y);
        }
        else{
            if(g.find(x) >= n && !g.same(x,y+n)){
                cout << i+1 << endl;
                return 0;
            }
            g.unite(x, y+n);
        }
    }
    cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int main(){
  string s;
  cin >> s;
  int a=0,b=0;
  rep(i,s.size()){
    if(s[i] == '1') a++;
    else b++;
  }
  
  cout << min(a,b) * 2 << endl;
  return 0;
}



Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static program.Input;
using static program.MyMath;
using static System.Console;

namespace program {
  class Program {
    static void Main()
    {
      var n = ScanIntArray();
      if(n[0]*500 >= n[1])
	      WriteLine("Yes");
      else
	      WriteLine("No");
    }
  }
  
  static class Input {
    static public int ScanInt() { return int.Parse(Console.ReadLine()); }
    static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
    static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
    static public long ScanLong() { return long.Parse(Console.ReadLine()); }
    static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
    static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
    static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
    static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
    static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
    static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

    static public string ScanStr() { return Console.ReadLine(); }
    static public string[] ScanStrArray() { return ScanStr().Split(); }
  }
  
  static class MyMath {
    public static int GCD(int a, int b) {
        Func<int, int, int> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long GCD(long a, long b) {
        Func<long, long, long> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y) {
      if(b==0) {
        x=1; 
        y=0;
        return a;
      }
      var d = extGCD(b, a%b, ref y, ref x);
      y -= a/b *x;
      return d;
    }
    public static int LCM(int a, int b) { return a * b / GCD(a, b); }
    public static long LCM(long a, long b) { return a * b / GCD(a, b); }
  }
}


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

int main() {
	int n, cnt[4] = { 0 };
	cin >> n;
	rep(i, n) {
		string si;
		cin >> si;
		if (si == "AC") cnt[0]++;
		else if (si == "WA") cnt[1]++;
		else if (si == "TLE") cnt[2]++;
		else if (si == "RE") cnt[3]++;
	}
	cout << "AC x " << cnt[0] << endl;
	cout << "WA x " << cnt[1] << endl;
	cout << "TLE x " << cnt[2] << endl;
	cout << "RE x " << cnt[3] << endl;
	return 0;
}

Measured memory_bytes: 3624
n = int(input())
s = input()

dp = [[0]*(n+1) for _ in range(n+1)]


for i in reversed(range(n-1)):
    for j in reversed(range(i+1, n)):
        if s[i] == s[j]:
            dp[i][j] = dp[i+1][j+1]+1


ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        x = min(dp[i][j], j-i)
        if ans < x:
            ans = x
print(ans)


Measured memory_bytes: 270164
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;

int main() {

	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (!(i % 2)) cout << s[i];
	}


	return 0;
}

Measured memory_bytes: 512
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    string fst, snd;
    cin>>fst>>snd;
    int ans = INT_MAX;
    int n = fst.length(), m = snd.length();
    for(int i =0;i < n-m+1; i++){
        int temp = 0;
        for(int j = 0; j < m; j++)
            temp += fst[i+j]!=snd[j];
        ans = min(ans, temp);
    }
    cout<<ans;
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3604
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n, m = mi()
    wa_count = [0] * n
    ac = [False] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if s == 'AC':
            ac[p] = True
        else:
            # WA かつまだ AC していない
            if not ac[p]:
                wa_count[p] += 1
    
    ac_num = 0
    penalty_num = 0
    for problem in range(n):
        if ac[problem]:
            ac_num += 1
            penalty_num += wa_count[problem]
    print("{} {}".format(ac_num, penalty_num))

    

if __name__ == "__main__":
    main()

Measured memory_bytes: 4596
#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 <cstring>
#include <limits>
#include <iomanip>

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  int a[N];
  for(int i = 0 ; i <N; i++) cin >> a[i];
  long long dp[N+1][K+1];
  for(int i = 0; i<=N; i++) for(int j = 0 ; j <=K; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  int mod = 1000000007;
  for(int i = 0 ; i < N; i++){
     for(int j = 0 ; j <=K ; j++){
        dp[i+1][j] = dp[i][j];
        if(j > 0) dp[i+1][j] += dp[i+1][j-1];
        if(j > a[i]) dp[i+1][j] += mod-dp[i][j-a[i]-1];
        dp[i+1][j] %= mod;
        //cout << i+1 <<", "<< j << ": " << dp[i+1][j] << endl;
     }
  }
  cout << dp[N][K] << endl;

  return 0;
}


Measured memory_bytes: 79104