akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Coer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskI solver = new TaskI();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskI {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            double[] p = new double[n + 1];
            for (int i = 1; i <= n; i++) {
                p[i] = in.nextDouble();
            }
            double[][] dp = new double[n + 1][n + 1];
            dp[0][0] = 1.0;
            for (int i = 1; i <= n; i++) {
                dp[i][0] = dp[i - 1][0] * (1 - p[i]);
                for (int j = 1; j <= n; j++) {
                    dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
                }
            }
            double ans = 0.0;
            for (int j = 1; j <= n; j++) {
                if (j > n - j) {
                    ans += dp[n][j];
                }
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }
}

Measured memory_bytes: 131144
#include <iostream>
using namespace std;
int main(){
    int x[] = {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 y;
    cin >> y;
    cout << x[y-1];
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#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;

long long gcd(long long a, long long b){
    while(b != 0){
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int main()
{
    int n;
    cin >> n;

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

    int b = a[0];
    for(int i=1; i<n; ++i)
        b = gcd(b, a[i]);

    vector<int> ret;
    for(int i=1; i*i<=b; ++i){
        if(b % i == 0){
            ret.push_back(i);
            if(i*i < b)
                ret.push_back(b/i);
        }
    }

    sort(ret.begin(), ret.end());
    for(unsigned i=0; i<ret.size(); ++i)
        cout << ret[i] << endl;

    return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
map<lint, int> factorize(lint n) {
    map<lint, int> res;
    for (lint i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) ++res[n];
    return res;
}

int main() {
    lint n; cin >> n;
    auto mp = factorize(n);
    int mn = mp.size(), mx = 1;
    for (const auto& e : mp) {
        mx *= e.second + 1;
    }
    --mx;
    cout << mn << ' ' << mx << '\n';
    return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    char prev = s[0];
    int cnt = 0;
    repall (c, s) {
        if (prev != c) cnt++;
        prev = c;
    }
    print(cnt + 1);

    return 0;
}


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

using namespace std;

const int N = 200005;

vector<int> g[N];

int sz[N];
int dfs(int u, int p) {
	sz[u] = 1;
	for(int v : g[u]) if(v != p)
		sz[u] += dfs(v, u);
	return sz[u];
}

int main() {
	int n;
	scanf("%d", &n);
	for(int i = 2; i <= n; i++) {
		int p;
		scanf("%d", &p);
		sz[p]++;
		g[p].push_back(i);
	}
// 	dfs(1, 1);

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


Measured memory_bytes: 15312
#include<iostream>
#include<algorithm>
#include<string>
#define int long long
using namespace std;

int tmp[50][27] = {};
signed main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string str;
		cin >> str;
		for (int j = 0; j < str.length(); j++) {
			int num = (int)str[j]-97;
			tmp[i][num]++;
		}
	}
	/*
	for (int i = 0; i < n; i++) {
		cout << "わあああ" << i << endl;
		for (int j = 0; j < 26; j++) {
			if (tmp[i][j] != 0) {
				char zz = (char)97 + j;
				cout << zz << " " << tmp[i][j] << endl;
			}
		}
	}
	*/
	
	
	for (int i = 0; i < 26; i++) {
		int x = 9999999;
		for (int j = 0; j < n; j++) {
			x = min(x, tmp[j][i]);
		}
		for (int j = 0; j < x; j++) {
			char zz = (char)97 + i;
			cout << zz;
		}
	}
	

	return 0;
}

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

int f(int n)
{
  return n*(n+1)*(n+2)/6;
}

int main()
{
  static const int M = 1000000;
  static int tetra[200];
  int tetra_size = 0;
  for (int i = 1; f(i) <= M; i++) {
    tetra[tetra_size++] = f(i);
  }

  static int dp[M+1], odd_dp[M+1];
  fill_n(dp+1, M, 1000000);
  fill_n(odd_dp+1, M, 1000000);
  for (int i = 0; i < tetra_size; i++) {
    for (int j = tetra[i]; j <= M; j++) {
      dp[j] = min(dp[j], dp[j-tetra[i]] + 1);
    }
    if (tetra[i] % 2 == 1) {
      for (int j = tetra[i]; j <= M; j++) {
        odd_dp[j] = min(odd_dp[j], odd_dp[j-tetra[i]] + 1);
      }
    }
  }
  int N;
  while (cin >> N && N != 0) {
    cout << dp[N] << ' ' << odd_dp[N] << endl;
  }
  return 0;
}

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

int R, C;
int a[10][10000];

signed main()
{
	while (true) {
		cin >> R >> C;
		if (R == 0 && C == 0) break;
		//rep(i,R) rep(j,C) cin >> a[i][j];
		rep(i,R) rep(j,C) scanf("%d", &a[i][j]);

		int ans = 0;
		for (int i = 0; i < 1 << R; i++) {
			int temp = 0;
			rep(j,C) {
				int one = 0;
				rep(k,R) {
					if ((i >> k & 1) && (a[k][j] == 0)) one++;
					else if (!(i >> k & 1) && (a[k][j] == 1)) one++;
				}
				temp += max(one, R - one);
			}
			ans = max(ans, temp);
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 1632
A, B, N = map(int, input().split())
t = N // B
if N % B == 0:
    a = max(0, N-1)
    b = N
    d = max(0,t*B-1)
    e = 1
    f = 0
else:
    a = max(0, t * B - 1)
    b = N
    d = max(0,N-1)
    e = 1
    f = 0

k = A * N // B
if A * N % B == 0:
    case = [a, b, max(min(B-1,N),0),d,e,f]
else:
    c = max(0,k*B//A+1)
    g = max(0,k*B//A)
    case = [a,b,max(min(B-1,N),0),d,e,f,g]

ans = 0
for i in case:
    ans = max(ans,A*i//B-A*(i//B))

print(ans)

Measured memory_bytes: 62044
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

int n;
int d[111];
int ans;

int main(){
  ios_base::sync_with_stdio(false);

  cin >> n;
  for(int i=0;i<n;i++){
    int m;
    cin >> m;
    d[m]++;
  }
  
  for(int i=1;i<=100;i++){
    if(d[i])ans++;
  }
  
  cout << ans << endl;    

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
bool find(vector<string> v, string s) {
	for (size_t i = 0; i < v.size(); i++)if (v[i] == s)return true; return false;
}
int main() {
	int n; cin >> n;
	vector<string>v;
	map<string, int>m;
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		if (!find(v, s)) {
			v.push_back(s);
			m[s] = 1;
		}
		else m[s]++;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		if (find(v, s))m[s]--;
	}
	int ans = 0;
	for (size_t i = 0; i < v.size(); i++) ans = max(ans, m[v[i]]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <iterator>
#include <queue>
#include <utility>

using namespace std;

int A, B, D;
bool Swapped;
bool input() {
    cin >> A >> B >> D;
    return A != 0;
}

void solve() {
#define INF (1<<28)
    int X = INF, Y = INF,
        MinSum = INF, MinProduct = INF;
    for (int x = 0; A * x <= D; x++) {
        int R = D - A * x;
        if (R % B != 0) continue;
        int y = R / B;
        if (x + y < MinSum || (x + y == MinSum && A * x + B * y < MinProduct)) {
            MinSum = x + y;
            MinProduct = A * x + B * y;
            X = x; Y = y;
        }
    }
    for (int x = 0; x < MinSum; x++) {
        int R = A * x - D;
        if (R < 0) continue;
        if (R % B == 0) {
            int y = R / B;
            if (x + y < MinSum || (x + y == MinSum && A * x + B * y < MinProduct)) {
                MinSum = x + y;
                MinProduct = A * x + B * y;
                X = x; Y = y;
            }
        }
    }
    for (int y = 0; y < MinSum; y++) {
        int R = B * y - D;
        if (R < 0) continue;
        if (R % A == 0) {
            int x = R / A;
            if (x + y < MinSum || (x + y == MinSum && A * x + B * y < MinProduct)) {
                MinSum = x + y;
                MinProduct = A * x + B * y;
                X = x; Y = y;
            }
        }
    }
    cout << X << " " << Y << endl;
}

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

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

int main() {
  uint32_t N = 0;
  std::cin >> N;

  uint32_t count = 0;
  for (size_t n = 105; n <= N; n += 2) {
    uint32_t div_count = 0;
    for (size_t i = 3; i < std::sqrt(n); i += 2) {
      if (n % i == 0) div_count++;
    }
    if (div_count == 3) count++;
  }

  std::cout << count << std::endl;

  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    while(1){
        int n,x;
        cin>>n>>x;
        if(n==0 && x==0) break;
        int ans=0;
        for(int a=1;a<=n;a++){
            for(int b=a+1;b<=n;b++){
                for(int c=b+1;c<=n;c++){
                    if(a+b+c==x) ans++;
                }
            }
        }
    
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3084
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var all = ReadInts();
        var H = all[0];
        var W = all[1];

        var del = ReadInts();
        var h = del[0];
        var w = del[1];


        Console.WriteLine(H * W - (h * W + w * H - h * w));
    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}



Measured memory_bytes: 13268
# coding: utf-8
# Here your code !
s=input()
p=''.join(s.split('x'));
if p==p[::-1]:
    a=[0]
    for i in range(len(s)):
        if s[i]=='x':
            a[-1]+=1
        else:
            a.append(0)

    for i in range(len(a)//2):
        a[i]=abs(a[i]-a[-i-1])
    print(sum(a[:len(a)//2]))
else:
    print(-1)    

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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int x = A;
	if(C == 0){
		cout << "YES" << endl;
		return 0;
	}
	while(x % B != 0){
		if(x % B == C){
			cout << "YES" << endl;
			return 0;
		}
		else{
			x += A;
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;
typedef long long ll;
const int maxn = 2e5+10;
const int inf = 1e9+7;

int cnt,head[maxn];ll dis[maxn];

struct Edge{
    int v;ll w;int next;
    bool operator < (const Edge &rhs) const {
        return w > rhs.w;
    }
}e[maxn<<2];

void add(int u,int v,int value){
    e[cnt].v = v;
    e[cnt].w = value;
    e[cnt].next = head[u];
    head[u] = cnt++;
}

void init(){
    cnt = 0;
    memset(head,-1,sizeof(head));
}

void dij(int s,int len){
    priority_queue<Edge>pq;
    for(int i = 1;i <= len;i++)
        dis[i] = inf;
    bool vis[maxn];
    memset(vis,false,sizeof(vis));
    dis[s] = 0;
    pq.push((Edge){s,0,0});
    while(!pq.empty()){
        Edge tmp = pq.top();pq.pop();
        if(vis[tmp.v]) continue;
        vis[tmp.v] = true;
        for(int i = head[tmp.v];~i;i = e[i].next){
            Edge u = e[i];
            if(dis[u.v] > dis[tmp.v] + u.w){
                dis[u.v] = dis[tmp.v] + u.w;
                pq.push((Edge){u.v,dis[u.v],0});
            }
        }
    }
}

int main(){
    int n,m,u,v,w;
    while(~scanf("%d%d",&n,&m)){
        init();
        while(m--){
            scanf("%d%d",&u,&v);
            w = 1;
            add(u,v,w);
            add(v,u,w);
        }
        dij(1,n);
        if(dis[n] > 2) puts("IMPOSSIBLE");
        else puts("POSSIBLE");
    }
    return 0;
}


Measured memory_bytes: 17524
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int a,b,c,x,y,z;
	rep(i,0,3){
		int h=0,m=0,s=0;
		cin>>a>>b>>c>>x>>y>>z;
		s=z-c;
		m=y-b;
		h=x-a;
		if(s<0){
			s+=60; m-=1;
		}if(m<0){
			m+=60; h-=1;
		}
		o(h<<" "<<m<<" "<<s);
	}
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void)
{
	int a,b,c,ans;
  	scanf("%d %d %d",&a,&b,&c);
	
  	if(c > b / a) {
    	ans = b / a;
    } else {
    	ans = c;
    }

	printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
const ll N=4e18;
int main()
{
   int n;
   cin>>n;
   ll arr[n];
   forl(i,0,n) cin>>arr[i];
   ll dp[n][n];
   forl(i,0,n) forl(j,0,n) dp[i][j]=N;
   forl(i,0,n)dp[i][i]=arr[i];
   ll ps[n+1];
   ps[0]=0;
   forl(i,1,n+1)ps[i]=ps[i-1]+arr[i-1]; 
   forl(leng,2,n+1)
   {
       fore(i,0,n-leng)
       {
           int j=i+leng-1;
           forl(k,i,j)
           {
               dp[i][j]=min(dp[i][j],ps[j+1]-ps[i]+dp[i][k]+dp[k+1][j]);
           }
           
       }
       
   }
   cout<<dp[0][n-1]-ps[n]<<endl;

}



Measured memory_bytes: 1536
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)

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

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

    if ((A == 1 && B == 2) || (A == 2 && B == 1))
    {
        cout << "3" << endl;
    }
    else if ((A == 1 && B == 3) || (A == 3 && B == 1))
    {
        cout << "2" << endl;
    }
    else if ((A == 2 && B == 3) || (A == 3 && B == 2))
    {
        cout << "1" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    import heapq
    
    def dijkstra(graph,start,cd,s):
        dist = [[float("inf")]*2505 for _ in range(n)]
        q = []
        dist[start][s] = 0
        heapq.heappush(q, (0,start,s))
        
        while q:
            cost, cur_node,coin = heapq.heappop(q)
            
            if dist[cur_node][coin] < cost:
                continue
            
            for nex_node,nex_cost,nex_time  in graph[cur_node]:
                if coin >= nex_cost and dist[nex_node][coin-nex_cost] > cost+nex_time:
                    dist[nex_node][coin-nex_cost] = cost+nex_time
                    heapq.heappush(q, (cost+nex_time,nex_node,coin-nex_cost))
            if dist[cur_node][min(2500,coin+cd[cur_node][0])] > cost+cd[cur_node][1]:
                 dist[cur_node][min(2500,coin+cd[cur_node][0])] = cost+cd[cur_node][1]
                 heapq.heappush(q,(cost+cd[cur_node][1],cur_node,min(2500,coin+cd[cur_node][0])))
                    
        for i in dist[1:]:
            print(min(i))
    n,m,s = map(int,input().split())
    E = [[] for i in range(n)]
    la = []
    for i in range(m):
        u,v,a,b = map(int,input().split())
        u -= 1
        v-= 1
        la.append(a)
        E[u].append((v,a,b))
        E[v].append((u,a,b))

    cd = [list(map(int,input().split())) for i in range(n)]

    dijkstra(E,0,cd,min(s,2500))
if __name__ == "__main__":
    main()

Measured memory_bytes: 99456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A; 
  cin >> N;
  cin >> A;
  
  if(N <= A)cout << "Yes" << endl;
  else
  {
  	if(N%500<= A)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
 
}

Measured memory_bytes: 256
import numpy as np
h, w = list(map(int, input().split()))
s = np.array([list(input()) for i in range(h)])

infer = []
for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      pts = set([
        (max(0, i-1), j), 
        (i, max(0, j-1)), 
        (min(h-1, i+1), j), 
        (i, min(w-1, j+1))
      ])
      check = np.array([ s[ix][iy] for ix, iy in list(pts - set([(i, j)])) ])
      infer.append((check == "#").sum())

print("No" if 0 in infer else "Yes")


        
      
      

Measured memory_bytes: 12448
#!/usr/bin/env python3
import math

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

index = a.index(1)

pre = index
post = n-index-1

ans = 10**10
for i in range(0, k):
    ans_tmp = 0
    pre_tmp = max(0, pre-i)
    post_tmp = max(0, post-(k-1-i))
    ans_tmp += math.ceil(pre_tmp/(k-1))
    ans_tmp += math.ceil(post_tmp/(k-1))
    ans = min(ans, ans_tmp)
    # print(pre_tmp, post_tmp, ans)

print(ans+1)


Measured memory_bytes: 20380
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = mutableListOf<MutableList<Int>>()
    (0 until n).forEach { i ->
        a.add(mutableListOf())
        (0 until 3).forEach { j ->
            a[i].add(sc.next().toInt())
        }
    }
    println(edpcB(n, a))
}

fun edpcB(n: Int, a: MutableList<MutableList<Int>>): Int {
    val dp = (0..n).map { (0 until 3).map { 0 }.toMutableList() }.toMutableList()
    for (i in 0 until n) {
        for (j in 0 until 3) {
            for (k in 0 until 3) {
                if (j != k) {
                    dp[i + 1][k] = Math.max(dp[i + 1][k], dp[i][j] + a[i][k])
                }
            }
        }
    }
    return listOf(dp[n][0], dp[n][1], dp[n][2]).max()!!
}

Measured memory_bytes: 89028
#include <stdio.h>
#define ull unsigned long long
#define maxn 505
int s[maxn],t[maxn],br[maxn],bc[maxn],cnt[maxn],a[maxn][maxn];//s[0]:row,and;s[1]:row:or.t[0]:col,and;t[1]:col,or;
ull u[maxn],v[maxn],ans[maxn][maxn];
int main(){
	int i,j,n,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&s[i]);
	for(i=1;i<=n;i++)scanf("%d",&t[i]);
	for(i=1;i<=n;i++)scanf("%llu",&u[i]);
	for(i=1;i<=n;i++)scanf("%llu",&v[i]);
	for(k=0;k<64;k++){//逐位判定，状压
		for(i=1;i<=n;i++)br[i]=((u[i]>>k)&1),bc[i]=((v[i]>>k)&1);//获得第k位上的值
		int hr[4]={0,0,0,0},hc[4]={0,0,0,0};//hr{(row,and,0),(row,and,1),(row,or,0),(row,or,1)}统计数量
		for(i=1;i<=n;i++)//行列计算
			hr[s[i]*2+br[i]]++,hc[2*t[i]+bc[i]]++;//hc{(col,and,0),(col,and,1),(col,or,0),(col,or,1)}
		if(hr[2]&&hc[1])return 0*printf("-1\n");//粗筛(row,or,0),(col,and,1),两者不能同时有取值
		if(hc[2]&&hr[1])return 0*printf("-1\n");//粗筛(col,or,0),(row,and,1),两者不能同时有取值
		for(i=1;i<=n;i++){//用行操作后的值，来设定初值
			cnt[i]=n;//i行上，雷同的数据有n个
			for(j=1;j<=n;j++)
				a[i][j]=br[i];//可以这样设置的理由:1&1=1,0&0=0;1|1=1,0|0=0;
		}
		for(j=1;j<=n;j++)
			if(t[j]!=bc[j])
				for(i=1;i<=n;i++)
					if(a[i][j]!=bc[j])cnt[i]--,a[i][j]=bc[j];
		for(j=1;j<=n;j++){//用列操作后的值，来进行修补,全1,全0的情况在粗筛时，已做了判定
			int flag=0;//判定是否找到
			if(t[j]==bc[j]){//(col,and,0,0)或者(col,or,1,1)
				for(i=1;i<=n;i++)
					if(a[i][j]==bc[j]){flag=1;break;}
				if(flag)continue;//找到
				for(i=1;i<=n;i++)//继续找
					if(s[i]==br[i]&&cnt[i]>=2){//找同样类型的行
						cnt[i]--,a[i][j]=bc[j];
						break;
					}
			}
			//可能存在找不到，不要怕，之后会进行检验。
		}
		for(i=1;i<=n;i++)
			for(j=1;j<=n;j++)
				ans[i][j]|=((ull)a[i][j]<<k);//生成 位上相应值
	}
	for(i=1;i<=n;i++){//行检验
		ull c=ans[i][1];
		for(j=2;j<=n;j++)
			if(s[i]==0)c=c&ans[i][j];
			else c=c|ans[i][j];
		if(c!=u[i])return 0*printf("-1\n");
	}
	for(j=1;j<=n;j++){//列检验
		ull c=ans[1][j];
		for(i=2;i<=n;i++)
			if(t[j]==0)c=c&ans[i][j];
			else c=c|ans[i][j];
		if(c!=v[j])return 0*printf("-1\n");
	}
	for(i=1;i<=n;i++){//经历了考验
		for(j=1;j<=n;j++)
			printf("%llu ",ans[i][j]);
		printf("\n");
	}
	return 0;
}

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

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif

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

    ll n,k;

    cin >> n >> k;

    vector<ll> cnt(n,0);

    for(ll i=0; i<k; i++){
        ll d;
        cin >> d;
        for(ll j=0; j<d; j++){
            ll a;
            cin >> a;
            cnt[a-1]++;
        }
    }

    ll ans = 0;
    for(ll i=0; i<n; i++){
        if(cnt[i] == 0)
            ans ++;
    }

    cout << ans << endl;

    return 0;
}

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

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        string s, t;
        cin >> s >> t;
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] != t[i]) ans++;
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
int main(){
  
 int n,c;
 cin>>n>>c;
  
 long long w[n+1],v[n+1];
  
 for(int i=1;i<=n;i++)
   cin>>w[i]>>v[i];
 
 long long dp[n+1][c+1];
  
 for(int i = 0;i<=n;i++){
  for(int j = 0;j<=c;j++){
   if(i == 0 || j == 0){
     dp[i][j] = 0;
     continue;
   }
   dp[i][j] = dp[i-1][j];
   if(w[i]<=j)
   	dp[i][j] = max(dp[i][j],v[i]+dp[i-1][j-w[i]]);
  }
 }
  
 cout<<dp[n][c];
  
}

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

int main() {
  int a;
  cin >> a;
  cout << a + a*a + a*a*a << endl;
  return 0;
}



Measured memory_bytes: 3632
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

void main() {
    "aiueo".canFind(readln.chomp.to!char).pipe!(a => a?"vowel":"consonant").writeln;
}


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


int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> x(510, vector<int>(510, 0));

    for (int i = 1; i <= m ; ++i) {
        int l, r;
        cin >> l >> r;
        x[l][r]++;
    }

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            x[i][j] += x[i][j - 1];
        }
    }

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            x[i][j] += x[i - 1][j];
        }
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << x[r][r] + x[l - 1][l - 1] - x[l - 1][r] - x[r][l - 1] << endl;
    }
}

Measured memory_bytes: 1920
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

ll ans;
string S[1005];
int dw[] = {0, 0, -1, 1}, dh[] = {-1, 1, 0, 0};
int dp[1005][1005];
queue<P> Q;
int H, W;

void bfs(int h, int w) {
    queue<P> q;
    q.push(mp(h, w));
    while (!q.empty()) {
        P p = q.front(); q.pop();
        int sh = p.first, sw = p.second;
        rep(i, -2, 3) rep(j, -2, 3) {
            if (sh+i<0 || sh+i>=H || sw+j<0 || sw+j>=W) continue;
            if (dp[sh+i][sw+j]>dp[sh][sw]+1 && S[sh+i][sw+j] != '#') {
                Q.push(mp(sh+i, sw+j));
                dp[sh+i][sw+j] = dp[sh][sw]+1;
            }
        }
        rep(r, 0, 4) {
            int th = sh+dh[r], tw = sw+dw[r];
            if (tw<0 || th<0 || tw>=W || th>=H || S[th][tw]=='#') continue;
            if (dp[th][tw]<=dp[sh][sw]) continue;
            dp[th][tw] = dp[sh][sw];
            q.push(mp(th, tw));
        }

    }
}

int main(void) {
    int Ch, Cw, Dh, Dw;
    cin >> H >> W;
    cin >> Ch >> Cw;
    Ch--; Cw--;
    cin >> Dh >> Dw;
    Dh--; Dw--;
    rep(i, 0, H) cin >> S[i];

    rep(i, 0, H) rep(j, 0, W) dp[i][j] = INF;

    
    Q.push(mp(Ch, Cw));
    dp[Ch][Cw] = 0;

    while(!Q.empty()) {
        P p = Q.front(); Q.pop();
        bfs(p.first, p.second);
    }


    
    if (dp[Dh][Dw]!=INF) cout << dp[Dh][Dw] << endl;
    else cout << -1 << endl;
    return 0;
}





Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,D;
    cin >> N >> D;
    int X[N][D];
    for(int i=0; i<N; i++){
        for(int j=0; j<D; j++){
            cin >> X[i][j];
        }
    }

    int ans=0;

    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            double distance=0;
            for(int k=0; k<D; k++){
                distance += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            distance = sqrt(distance);
            //cout << "distance " << distance << endl;
            if( distance == (double) ( (int) distance ) ){
                //cout << "int distance " << (double) ( (int) distance ) << endl;
                ans++;
            }
        }
    }    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int machi, i, baibai, price[100000]={}, cnt=0, dif=-1, min;
	
	scanf("%d %d", &machi, &baibai);
	
	for(i=0;i<machi;i++)
	scanf("%d", &price[i]);
	
	min=price[0];
	
	for(i=0;i<machi;i++){
		if(min>price[i])
		min=price[i];
		
		if(dif<price[i]-min){
			dif=price[i]-min;
			cnt=1;
			continue;
		}
		
		if(dif==price[i]-min){
			cnt++;
		}
	}
	
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 512
a, b, c = gets.split.map{|i| i.to_i}
if ((a * b * c) % 2 == 0) then
    puts(0)
else
    min = a * b

    if (min > b * c) then
        min = b * c
    end
    if (min > a * c) then
        min = a * c
    end

    puts(min)
end

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
class Solution
{
    static void Main(string[] args)
    {
        List<int> data = new List<int>();
        int n = int.Parse(System.Console.ReadLine().Trim()),sum=0;
        for (int i = 0; i < n; i++) 
        {
            int x =int.Parse(System.Console.ReadLine().Trim());
            data.Add(x);
            sum += x;
        }
        data.Sort((a, b) => a-b);
        int pos = -1,kai=0;
        if (sum % 10 == 0)
        {
            for(int i = 0;i<data.Count;i++)
            {
                if (data[i] % 10 != 0) { pos = i; break; }
            }
            if (pos == -1) kai = 0;
            else kai = sum - data[pos];
        }
        else
        {
            kai = sum;
        }
        System.Console.WriteLine(kai);
        System.Console.ReadLine();
    }
}

Measured memory_bytes: 11220
from operator import itemgetter

n = int(input())
XLs = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]
    XLs[i].append(x+l)

#右手の端の位置でソート

XLs.sort(key=itemgetter(2))

choice = -10**10
cnt = 0
for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]

    if choice <= x-l:
        choice = x+l
        cnt += 1

print(cnt)

Measured memory_bytes: 32652
# -*- coding: utf-8 -*-
import math

list = []
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))

zflist = []
zflist.append(str(list[0]).zfill(3))
zflist.append(str(list[1]).zfill(3))
zflist.append(str(list[2]).zfill(3))
zflist.append(str(list[3]).zfill(3))
zflist.append(str(list[4]).zfill(3))

# x[-1] = 1桁目
temp = sorted(zflist, key=lambda x: x[-1])
sortedlist = []
sortedlist.append(int(temp[0]))
sortedlist.append(int(temp[1]))
sortedlist.append(int(temp[2]))
sortedlist.append(int(temp[3]))
sortedlist.append(int(temp[4]))

last = 0
for i in sortedlist:
    if str(i).zfill(3)[-1] != '0':
        # print(i)
        last = i
        break
    last = i

sortedlist.remove(last)


# print(list)
# print(sortedlist)
# print(last)

# 10区切りにする
tenlist = []
tenlist.append(math.ceil(int(sortedlist[0])/10)*10)
tenlist.append(math.ceil(int(sortedlist[1])/10)*10)
tenlist.append(math.ceil(int(sortedlist[2])/10)*10)
tenlist.append(math.ceil(int(sortedlist[3])/10)*10)
# print(tenlist)

print(sum(tenlist) + last)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N, Q;
  cin >> N >> Q;
  vector<ll> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < Q; i++) {
    ll x;
    cin >> x;
    int l = 0, r = 0;
    ll sum = 0, ans = 0;
    while (l < N) {
      while (r < N && sum + a[r] <= x) sum += a[r++];
      ans += r - l;
      sum -= a[l++];
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3508
#include<cstdio>
#include<algorithm>
using namespace std;
int a[205];
int main()
{
    int res=2333333,n,num,x;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
    scanf("%d",&x);
    num=0;
    while(x%2==0){
    x/=2;
    num++;}
    res=min(res,num);
    }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

struct edge { int cost, from, to ; };

bool comp(const edge& e1, const edge& e2){
    return e1.cost > e2.cost;
}

int main() {
    int N, T;
    cin>>N>>T;
    
    int nums[N+5];
    rep1(i,N) cin>>nums[i];
    
    int mins[N+5]; mins[1]=nums[1];
    for(int i=2; i<=N; i++) mins[i] = min(mins[i-1],nums[i]);
    
    int maxs[N+5]; maxs[N]=nums[N];
    for(int i=N-1;i>=1;i--) maxs[i] = max(maxs[i+1],nums[i]);
    
    int mxd=0, mn=0, cnt=0;
    rep1(i,N){
        if( mn != mins[i] && maxs[i]-mins[i]>=mxd){
            if( maxs[i]-mins[i]>mxd){
                mxd = maxs[i]-mins[i];
                cnt = 1;
            }else{
                cnt++;
            }
            mn = mins[i];
        }
    }
    cout1(cnt);
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#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 <unordered_set>
#include <unordered_map>
using namespace std;

const int MAX_N = 1e6; 
vector<int>dp1, dp2;
vector<int>tetra;

int main(void)
{
	int n = 1;
	do
	{
		tetra.push_back(n * (n + 1) * (n + 2) / 6);
		++n;
	} while (tetra.back() <= MAX_N);
	dp1.push_back(0);
	dp2.push_back(0);
	for (int i = 1; i <= MAX_N; ++i)
	{
		int a1 = INT_MAX, a2 = INT_MAX;
		for (int t : tetra)
		{
			if (t > i)break;
			a1 = min(a1, dp1[i - t] + 1);
			if (t % 2)
			{
				a2 = min(a2, dp2[i - t] + 1);
			}
		}
		dp1.push_back(a1);
		dp2.push_back(a2);
	}
	int x;
	while (cin >> x, x)
	{
		cout << dp1[x] << " " << dp2[x] << endl;
	}
	return 0;
}

Measured memory_bytes: 10664
#include<bits/stdc++.h>
using namespace std;
string s, t;
bool flag = true;
int main() {
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != t[i])	flag = false;
	}
	if(s.size() + 1 == t.size() && flag)	cout << "Yes\n";
	else	cout << "No\n";
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int p, q, r;
  cin >> p >> q >> r;
  cout << min(min(p + q, q + r), r + p) << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(!(a%3)||!(b%3)||!((a+b)%3)){
        cout<<"Possible"<<endl;
    }
    else{
        cout<<"Impossible"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
list_a = list(map(int,input().split()))
W = list_a[0] 
H = list_a[1] 
x = list_a[2]
y = list_a[3]
r = list_a[4]

if x - r < 0:
    print('No')
elif x + r > W:
    print('No')
elif y - r < 0:
    print('No')
elif y + r > H:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 5596
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

int i, j, k, tmp;

int main(void) {
	int A, B, C, ans;

	scanf("%d %d %d", &A, &B ,&C);
	ans = C - (A - B);
	if (ans < 0) {
		printf("0");
	}
	else {
		printf("%d", ans);
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
def f(s):
    list = s.split()
    return list[0],int(list[1])
play = [f(input()) for i in range(n)]
x = input()

s = []
t = []
for i in range(n):
    s.append(play[i][0])
    t.append(play[i][1])

for i in range(n):
    if s[i] == x:
        ans=sum(t[(i+1):(n+1)])

print(ans)

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var a, b, c, d, e, f int
	fmt.Scan(&a, &b, &c, &d, &e, &f)
	fmt.Println(solve(a, b, c, d, e, f))
}

func solve(a, b, c, d, e, f int) (int, int) {
	x, y := a*100, 0

	for wa := 0; wa <= f; wa += a * 100 {
		for wb := 0; wa+wb <= f; wb += b * 100 {
			w := wa + wb
			for sc := 0; w+sc <= f && sc <= w/100*e; sc += c {
				for sd := 0; w+sc+sd <= f && sc+sd <= w/100*e; sd += d {
					s := sc + sd
					t := w + s
					if s*x > y*t {
						x, y = t, s
					}
				}
			}
		}
	}

	return x, y
}


Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        d: [i32; n]
    }
    let mut sum: i32 = 0;
    for i in 0..n {
        for j in 0..n {
            if i == j {
                continue;
            }
            sum += d[i] * d[j];
        }
    }
    println!("{}", sum / 2);
}

Measured memory_bytes: 4352
a,b,k=map(int,input().split())
ao=[]
for i in range(a,0,-1):
    if a%i==0:
        ao.append(i)
bo=[]
for i in range(b,0,-1):
    if b%i==0:
        bo.append(i)
# print(ao,bo)
i,j,n=0,0,0
ans=0
while n<k:
    if ao[i]==bo[j]:
        n+=1
        ans=ao[i]
        i+=1
    elif ao[i]>bo[j]:
        i+=1
    else:
        j+=1
print(ans)


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

int main() {
	int N;
	while (cin >> N) {
		if (N == 0) return 0;
		vector<int> A(N);
		int SUM = 0;
		for (int i = 0; i < N; i++) {
			cin >> A[i];
			SUM += A[i];
		}
		int ANS = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] * N <= SUM) ANS++;
		}
		cout << ANS << endl;
	}
}


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

int main(void) {
    string S; cin >> S;
    for(int i=0; i<S.length(); i++) cout << 'x';
    cout << endl;
}

Measured memory_bytes: 3548
#include <iostream>
using namespace std;
#define Nmax 20

int main()
{
	int n;
	int a[Nmax] = { 0 }, b[Nmax] = { 0 }, c[Nmax - 1] = { 0 };

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < (n - 1); i++) {
		cin >> c[i];
	}

	int m = 0;
	for (int i = 0; i < n; i++) {
		m += b[a[i] - 1];
		if ((i > 0) && ((a[i - 1] + 1) == a[i])) {
			m += c[a[i - 1] - 1];
		}
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""


x,y = m()

for i in range(101):
	for j in range(101):
		if i + j == x and 2*i + 4*j == y:
			print("Yes")
			exit()
print("No")

Measured memory_bytes: 67820