akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int x;
	cin >> x;
	int ret = 1;
	FOR(b,2,x) {
		int bp = b;
		//cout << "b= " << b << endl;
		if (bp*b > x)continue;
		while (true) {
			if (bp*b > x)break;
			bp *= b;
			ret = max(bp, ret);
		}
		//cout << "bp= " << bp << endl;
	}
	print(ret);
}

Measured memory_bytes: 3588
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int n;
	cin >> n;
	vector<pair<int,int>> a(n-1);
	vector<vector<pair<int,int>>> g(n); // {node,edge}
	REP(i,n-1){
		cin >> a[i].first >> a[i].second;
		a[i].first--; a[i].second--;
		
		g[a[i].first].push_back(make_pair(a[i].second, i));
		g[a[i].second].push_back(make_pair(a[i].first, i));
	}
	
	int maxsize = 0;
	int index=-1;
	REP(i,n){
		if(maxsize < (int)g[i].size()){
			maxsize = g[i].size();
			index = i;
		}
	}
	
	vector<int> color(n-1,0);
	queue<pair<int,int>> que;
	que.push(make_pair(index,0));
	while(!que.empty()){
		int now = que.front().first;
		int parcolor = que.front().second;
		que.pop();
		int col = 1;
		for(auto x: g[now]){
			int child = x.first;
			int edge = x.second;
			if(color[edge]!=0) continue;
			if(col!=parcolor){
				color[edge] = col;
				col++;
			}else{
				col++;
				color[edge] = col;
				col++;
			}
			que.push(make_pair(child, color[edge]));
		}
	}
	
	cout << maxsize << endl;
	REP(i,n-1){
		cout << color[i] << endl;
	}
	
	
	
	return 0;
}

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

signed main(){
  
  int n, k;
  cin>>n>>k;
  
  int ans = 0;
  
  for(int i=0;i<n;i++)  {
    int h;
    cin>>h;
    if( h >= k ) ans++;
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	int n, a, b, c, d;
	cin >> n;
	a = n/1000; n%=1000;
	b= n/100; n%=100;
	c = n/10; n%=10;
	d = n;
	int t[4]={a, b, c, d}; 
	for(int bit=0; bit<(1<<3); bit++){
		int sum = t[0];
		string s=to_string(a);
		for(int i=0; i<3; i++){
			if(bit&(1<<i)){
				sum+=t[i+1];
				s+="+";
			}else{
				sum-=t[i+1];
				s+="-";
			}
			s+=to_string(t[i+1]);
		}
		if(sum == 7){
			cout << s+"=7" << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3692
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int count = 0;
		int[] A = new int[n];

		for(int i=0;i<n;i++) {
			A[i]=scan.nextInt();
		}

		for(int i = 0; i<n;i++) {
			int min = i;
			for(int j=i;j<n;j++) {
				if(A[j]<A[min]) {
					min = j;
				}
			}
			if(min!=i) {
				int temp = A[i];
				A[i] = A[min];
				A[min] = temp;
				count++;
			}

		}
		for(int i = 0; i < n; i++) {
			if(i==0) {
				System.out.print(A[i]);
			}
			else {
				System.out.print(" " + A[i]);
			}
		}
		System.out.println();
		System.out.println(count);
		scan.close();
	}
}


Measured memory_bytes: 26344
n,m,x,y = map(int,input().split())
lx = list(map(int,input().split()))
ly = list(map(int,input().split()))
ans = 'War'
for i in range(x+1,y+1):
    if i <= max(lx):
        pass
    else:
        if i <= min(ly):
            ans = 'No War'
            print(ans)
            break
        else:
            pass
if ans == 'War':
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

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

using namespace std;
using namespace __gnu_pbds; // gp_hash_table<int, int> table;

template <typename T> void smin(T &a, const T &b) { a = (a < b ? a : b); }
template <typename T> void smax(T &a, const T &b) { a = (a > b ? a : b); }

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

const int N = 650;

vector <int> g[N];
vector <int> rg[N];

double dp[N];
const ld EPS = 1e-7;

bool used[N];

int bad = 0;
void dfs(int u)
{
  used[u] = 1;
  for (int v : g[u])
  {
    if (!used[v])
      dfs(v);
    dp[u] += (dp[v] + 1) / g[u].size();
  }
  if (g[u].empty())
    smin(bad, u);
}

/*void dfs2(int u)
{

}
*/
signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;

  for (int i = 0; i < m; i++)
  {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    rg[v].push_back(u);
  }

  double ans = N * N * N;
  bad = n;
  dfs(1);
  smin(ans, dp[1]);

  vector <ld> prob(n + 1);
  vector <bool> vis(n + 1);
  vis[1] = 1;
  prob[1] = 1;
  for (int i = 2; i <= n; i++)
  {
    for (int v : rg[i])
    {
      if (vis[v])
      {
        prob[i] += prob[v] / g[v].size();
        vis[i] = 1;
      }
    }
  }

  for (int i = 1; i <= n; i++)
  {
    if (g[i].size() == 1)
      continue;

    double cur = dp[1];
    for (int v : g[i])
    {
      cur -= prob[i] * (dp[v] + 1) / g[i].size();
      cur += prob[i] * (dp[v] + 1) / (g[i].size() - 1);
    }

    for (int v : g[i])
    {
      double tmp = cur - prob[i] * (dp[v] + 1) / (g[i].size() - 1);

      smin(ans, tmp);
    }
  }
  cout << fixed << setprecision(10) << ans;


  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using s64 = signed long long;
using u64 = unsigned long long;
using f128 = long double;

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

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

    s64 count = 0;
    for(int i = 0; i < l.size(); i++)
    {
        for(int j = i + 1; j < l.size(); j++)
        {
            if(l[i] == l[j])
            {
                continue;
            }

            s64 i_plus_j = l[i] + l[j];
            for(int k = j + 1; k < l.size(); k++)
            {
                if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i])
                {
                    if(l[k] < i_plus_j)
                    {
                        count++;
                    }
                }
            }
        }
    }

    cout << count << endl;

    return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

using pii = pair<int, int>;

int main() {
   int n, m, c;
   cin >> n >> m >> c;
   vec<int> lim(c);
   rep (i, c) { cin >> lim[i]; }
   priority_queue<pii> PQ; // value, color
   rep (i, n) {
      int c, w;
      cin >> c >> w;
      c--;
      PQ.push({w, c});
   }

   ll ans = 0;
   int i = 0;
   while (PQ.size()) {
      pii p = PQ.top(); PQ.pop();
      if (lim[p.second] > 0) {
         ans += p.first;
         lim[p.second]--;
         i++;
      }
      if (i >= m) break;
   }

   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4172
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

if N == 1:
    print(abs(a[0] - W))
    exit()

ans1 = abs(a[-1] - a[-2])
if abs(a[-1] - W) > ans1:
    print(abs(a[-1] - W))
else:
    print(ans1)


Measured memory_bytes: 38640
from collections import deque

N,u,v = map(int,input().split())
u -= 1
v -= 1

AB = []
dic = {}

for i in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    AB.append([a,b])

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

q = deque([u])

tk = [float("inf")] * N
tk[u] = 0

while len(q) > 0:

    now = q.popleft()

    for i in dic[now]:

        if tk[i] > tk[now] + 1:
            tk[i] = tk[now] + 1
            q.append(i)

#print (dic)

ao = [float("inf")] * N
q = deque([v])
ao[v] = 0

while len(q) > 0:

    now = q.popleft()

    for i in dic[now]:

        if ao[i] > ao[now] + 1:
            ao[i] = ao[now] + 1
            q.append(i)

ans = 0
for i in range(N):

    if ao[i] > tk[i]:
        ans = max(ans , ao[i] - 1)

print (ans)

    


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


def solve(S: str):
    print("x" * len(S))
    return


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

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp
{
  char name[100];
  int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x)
{
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue()
{
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b)
{
  return a<b?a:b;/*最小値を返す*/
}

int main(){
  int elaps=0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;
  tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t-=c;
    elaps+=c;
    if(u.t>0)enqueue(u);
    else
      printf("%s %d\n",u.name,elaps);
  }

  return 0;
}



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

using ll = long long;



int main() {
    int n;
    scanf("%d", &n);
    // dp[heads]
    // if we had i tosses, then tails=i-heads
    vector<double> dp(n + 1);
    // dp[i] - p-bility that there are i heads so far
    dp[0] = 1;
    for(int coin = 0; coin < n; ++coin) {
        double p_heads;
        scanf("%lf", &p_heads);
        for(int i = coin + 1; i >= 0; --i) {
            dp[i] = (i == 0 ? 0 : dp[i-1] * p_heads) + dp[i] * (1 - p_heads);
        }
    }
    double answer = 0;
    for(int heads = 0; heads <= n; ++heads) {
        int tails = n - heads;
        if(heads > tails) {
            answer += dp[heads];
        }
    }
    printf("%.10lf\n", answer);
}

Measured memory_bytes: 3836
class Node
  # property parent : Int32
  # property s : Int32
  attr_accessor :parent, :s # Ruby
    
  def initialize(n)
    @parent = n
    @s = 0
  end
end

class UnionFindTree
  
  # property nodes : Array(Node) # Crystal
  attr_accessor :nodes        # Ruby

  def initialize(n)
    @nodes = (0..n).to_a.map{ |i| Node.new(i) }
  end

  def root(x)
    return x if x == nodes[x].parent
    nodes[x].parent = root(nodes[x].parent)
  end

  def unite_by_size(a, b)
    a = root(a)
    b = root(b)
    return false if a == b
    a, b = b, a if nodes[a].s < nodes[b].s
    nodes[b].parent = a
    nodes[a].s += nodes[b].s
    true
  end
  
  def unite_by_rank(a, b)
    a = root(a)
    b = root(b)
    return false if a == b
    a, b = b, a if nodes[a].s < nodes[b].s
    nodes[b].parent = a
    nodes[a].s += 1 if nodes[a].s == nodes[b].s
  end

  def same?(a, b)
    root(a) == root(b)
  end

  def size(node)
    nodes[root(node)]
  end

end

n, m = gets.to_s.chomp.split.map{|i| i.to_i}
perm = gets.to_s.chomp.split.map{|i| i.to_i - 1 }

uf = UnionFindTree.new(n)
m.times do
  x, y = gets.to_s.chomp.split.map{|i| i.to_i - 1 }
  uf.unite_by_size(x,y)
end
 
ans = 0
n.times do |i|
  ans += 1 if uf.same?(i, perm[i])
end

puts ans

Measured memory_bytes: 18580
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
  static void Main()
  {
    long n = long.Parse(Console.ReadLine());
    bool[] isPrimes = makePrimeList(55555);//i-1が素数かどうか
    long[] answers = new long[n];
    long memo = 0;
    for(int i = 0; i < 55555; i++)
    {
      if(isPrimes[i] && (i+1)%5==1)
      {
        answers[memo] = i+1;
        memo++;
        if(memo == n) break;
      }
    }
    Console.WriteLine(string.Join(" ", answers));
  }


  static bool[] makePrimeList(long maxPrime)//「引数1以上」max以下の素数判定。エラトステネスの篩を用いる。
  {
    bool[] isPrimes = new bool[maxPrime];//素数リスト
    isPrimes[0] = false;//1は素数でないのでfalse
    for(long i = 1; i < maxPrime; i++) isPrimes[i] = true;//素数と仮定してtrue
  
    for(long i = 2; i <= Math.Sqrt(maxPrime); i++)
    {
      if(isPrimes[i-1])
      {
        for (long j = i*2; j <= maxPrime; j+=i)
        {
          isPrimes[j-1] = false;//素数でないのでfalse
        }
      }
    }

    return isPrimes;
  }
}

Measured memory_bytes: 13204
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s; cin >> s;
    map<char, int> data;
    for (auto &c : s)
        data[c]++;
    if (data.size() == 2) {
        if (data.begin()->second == 2)
            cout << "Yes\n";
        else cout << "No\n";
    } else cout << "No\n";

}


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

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

    if(S.size() == 0 || S.size()%2 == 1) {
        cout << "No" << endl;
        return 0;
    }

    bool is_hitachi = true;
    for(int i = 0; i < S.size(); i += 2) {
        if(S[i] == 'h' && S[i+1] == 'i') {
            ;
        } else {
            is_hitachi = false;
        }
    }

    if(is_hitachi) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();

        var d = DateTime.Parse(s);
        return d <= DateTime.Parse("2019/4/30") ? "Heisei" : "TBD";
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B;
    cin >> A >> B;
    if(A%3==0 || B%3==0 || (A+B)%3==0){
        cout << "Possible" << "\n";
    }else{
        cout << "Impossible" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)
const ll INF = 1e10;
#define pb push_back

struct point {
    double x;
    double y;
};
int main()
{
    char c;
    vector<point> P;
    double x, y;
    while (cin >> x >> c >> y) {
        point pnt;
        pnt.x = x;
        pnt.y = y;
        P.pb(pnt);
    }
    double sum = 0;
    int n = P.size();
    range(i, 1, n - 1)
    {
        sum += (P[i].x - P[0].x) * (P[i + 1].y - P[0].y) - (P[i].y - P[0].y) * (P[i + 1].x - P[0].x);
    }
    cout << abs(sum / 2) << endl;
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  long long a,b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<'\n';
  }  
  else if(a==b){
    cout<<"a == b"<<'\n';
  }
  else{
    cout<<"a > b"<<'\n';
  }  
  return(0);
}



Measured memory_bytes: 3084
n, p = map(int, input().split())
a = list(map(int, input().split()))
e = 0
o = 0
for i in a:
    if i % 2 == 0:
        e += 1
    else:
        o += 1
if p == 0:
    if o == 0:
        print(2 ** n)
    else:
        print(2 ** (n - 1))
else:
    if o == 0:
        print(0)
    else:
        print(2 ** (n - 1))



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

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){
    int n;
    float v[50+5];
    scanf("%d", &n);
    for(int i=0; i<n; i++)scanf("%f", &v[i]);
    qsort(v, n, sizeof(float), compare_int);
    
    
    for(int i=1; i<n; i++){
        v[i]=(v[i-1]+v[i])/2;
    }
    printf("%f", v[n-1]);
    return 0;
}


Measured memory_bytes: 1704
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
const ll N = 1e5+507;
ll sol,i,x,y,a,b,c,k,a1[N],b1[N],c1[N],p[3*N];
int main()
{
    cin>>x>>y>>a>>b>>c;
    for (i=1;i<=a;++i)
         cin>>a1[i];
    for (i=1;i<=b;++i)
        cin>>b1[i];
    for (i=1;i<=c;++i)
         cin>>c1[i],p[++k]=c1[i];
    sort(a1+1,a1+a+1,greater<int>());
    sort(b1+1,b1+b+1,greater<int>());
    for (i=1;i<=x;++i)
         p[++k]=a1[i];
    for (i=1;i<=y;++i)
         p[++k]=b1[i];
    sort(p+1,p+k+1,greater<int>());
    for (i=1;i<=x+y;++i)
         sol+=p[i];
    cout<<sol;
}



Measured memory_bytes: 4992
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	int x[102];
	for (i = 0; i < n; i++)
		scanf("%d", &x[i]);
	int v, ans = 1000000009;
	for (i = 0; i < 102; i++)
	{
		v = 0;
		for (j = 0; j < n; j++)
			v += (x[j] - i) * (x[j] - i);
		if (ans > v)
			ans = v;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int X = sc.nextInt();
		int Y = sc.nextInt();
		
		int x = X + Y / 2;
		
		System.out.println(x);
		
	}
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,d;
    scanf("%d%d%d",&n,&m,&d);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            int x=(i+j)/d%2;
            int y=(m+i-j)/d%2;
            char c="RGBY"[2*x+y];
            printf("%c",c);
        }
        printf("\n");
    }    
    return 0;
}

Measured memory_bytes: 512
v[5];a[]={0,10,50,100,500,v};c,b;main(z){for(;c>4?b>3?c=0,b=-1:++b?z=v[b]+*v%a[b+1]/a[b],z<1||printf("%d %d\n",a[b],z):puts(a):~scanf("%d",v+c)?*v-=v[c]*a[c],++c:0;);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define maxi(a,b,c) max(a,max(b,c))
#define mini(a,b,c) max(a,min(b,c))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<endl
#define scan(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define int long long
#define double long double
#define mod 1000000007
using namespace std;
int32_t main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

	char x;
	cin>>x;
	x++;
	cout<<x;    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
using namespace std;


int main() {
	int n, k,result=0; cin >> n >> k;
	vector<int> count1(200010, 100000000);
	bool flag[200000] = {};
	vector<int> a(200010, 10000000); REP(i, n) { cin >> a[i]; if (!flag[a[i]]) { count1[a[i]] = 0; flag[a[i]] = 1; } count1[a[i]]++; }

	sort(count1.begin(), count1.end());
	
	REP(i, 200000) {
		if (count1[i]<100000000)result++;
	}
	int ans = 0;
	if (result <= k) { cout << "0" << endl; return 0; }
	else {
		for(int i=0;i<result-k;i++) {
			ans += count1[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2048
#include<iostream>
using namespace std;
int main(){
    int N,X;
    cin>>N>>X;
    int L[110];
    for(int i = 0;i < N;i++)cin>>L[i];
    
    int res = 0;
    int tmp = 0;
    for(int i = 0;i < N + 1;i++){
        tmp = tmp + L[i];
        if(tmp <= X)res++;
    }
    
    cout<<res+1;
    
    return 0;
}

Measured memory_bytes: 256
na,nb,nm = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
TA = []
for i in range(nm):
    m1, m2, m3 = map(int,input().split())
    T = a[m1-1]+b[m2-1]-m3
    TA.append(T)
T = min(a) + min(b)
TA.append(T)
print(min(TA))

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

const int N = (int)2e3;

int dat[N+5][N+5];

int fill(int x1, int x2, int y1, int y2) {
    int x_mid = (x1 + x2) / 2;
    int y_mid = (y1 + y2) / 2;

    dat[x_mid][y_mid] = 1;

    if (x2-x1 < y2-y1) {
        fill(x1,x2, y1, y_mid-1);
        fill(x1,x2, y_mid,y_mid);
        fill(x1,x2, y_mid+1, y2);
    } else if (x2-x1 > y2-y1) {
        fill(x1, x_mid-1, y1,y2);
        fill(x_mid,x_mid, y1,y2);
        fill(x_mid+1, x2, y1,y2);
    } else if (x1 != x2) {
        fill(x1,x_mid-1, y1,y_mid-1);
        fill(x1,x_mid-1, y_mid+1,y2);
        fill(x_mid+1,x2, y1,y_mid-1);
        fill(x_mid+1,x2, y_mid+1,y2);
    }
    return 0;
}

int main() {
    int n,m; scanf("%d %d", &n, &m);

    n = (1 << n) - 1;
    m = (1 << m) - 1;

    fill(1,n, 1,m);

    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            printf("%d", dat[i][j]);
        }
        printf("\n");
    }
    return 0;
}


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

long long gr(long long a,long long k)
{
	if (a%k==0LL)
	{
		return a/k;
	}
	else if (a==k+1LL)
	{
		return 0LL;
	}
	return gr(a-(a/k+1LL)*max(1LL,(a%k)/(a/k+1LL)),k);
}

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	long long a,k,ans=0LL;
	for (int i = 0; i < n; ++i)
	{
		cin>>a>>k;
		ans^=gr(a,k);
	}
	if (ans)
	{
		cout<<"Takahashi\n";
	}
	else
	{
		cout<<"Aoki\n";
	}
	return 0;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    gems = set()

    for _ in range(n):
        x, y = map(int, input().split())
        gems.add((x, y))

    m = int(input())
    nx = ny = 10

    for _ in range(m):
        d, l = input().split()
        l = int(l)
        for i in range(l):
            if d == 'N':
                ny += 1
            if d == 'E':
                nx += 1
            if d == 'S':
                ny -= 1
            if d == 'W':
                nx -= 1
            if (nx, ny) in gems:
                gems.remove((nx, ny))
    if len(gems) == 0:
        print("Yes")
    else:
        print("No")
    

Measured memory_bytes: 7580
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val x = sc.nextInt()
    val y = sc.nextInt()
    var ans = Int.MAX_VALUE
    for (ab in 0..Math.max(x*2, y*2)) {
        val remA = Math.max(0, x - ab / 2)
        val remB = Math.max(0, y - ab / 2)
        ans = Math.min(ans, ab * c + a * remA + b * remB)
    }
    println(ans)
}

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

using namespace std;

#define FaSt ios::sync_with_stdio(0),cin.tie(0);
#define random uniform_int_distribution<long long>(1, 2000000000000000LL)(rng)

const int N = 3005;
string s, t;
int dp[N][N];
bool solved[N][N];

int calc(int i, int j)
{
    if (solved[i][j])
    {
        return dp[i][j];
    }
    
    if (i == s.size() || j == t.size())
    {
        return 0;
    }
   
    dp[i][j] = max(calc(i + 1, j), calc(i, j + 1));
    if (s[i] == t[j])
    {
        dp[i][j] = max(dp[i][j], 1 + calc(i + 1, j + 1));
    }
   
    solved[i][j] = 1;
    return dp[i][j];
}

void build(int i, int j)
{
    if (i == s.size() || j == t.size())
    {
        return;
    }
    
    if (s[i] == t[j] && calc(i + 1, j + 1) + 1 == calc(i, j))
    {
        cout << s[i];
        build(i + 1, j + 1);
    }
    else if (calc(i + 1, j) == calc(i, j))
    {
        build(i + 1, j);
    }
    else
    {
        build(i, j + 1);
    }
}
int main()
{
    FaSt
    cin >> s >> t;

    build(0, 0);
}


Measured memory_bytes: 44672
#include<cstdio>
using namespace std;
const char N_MAX = 105;
int INF = 1<<30;
int dp[N_MAX][N_MAX];
char matrix[N_MAX];
int n;
int solve() {
    for(char offset = 1; offset < n; offset++) {
        for(char c = 1, r = c + offset; r <= n; c++, r++) {
            dp[c][r] = INF;
            for(char divid = 1; divid <= offset; divid ++) {
                int newValue = dp[c][c - 1 + divid] + dp[c + divid][r] + matrix[c - 1] * matrix[r] * matrix[c + divid - 1];
                if(newValue < dp[c][r])
                    dp[c][r] = newValue;
            }
        }
    }
    return dp[1][n];
}
int main(){
    scanf("%d", &n);
    for(char i=0;i<n;i++) scanf("%d %d", &matrix[i], &matrix[i+1]);
    printf("%d\n", solve());
    return 0;
}



Measured memory_bytes: 2792
from collections import deque
n, k = map(int, input().split())
inf = pow(10, 9)+7

tree = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)

not_yet = deque(tree[0])
already = [False]*n
already[0] = True
ans = k
key = k-1
for v in tree[0]:
  already[v] = True
  ans *= key
  ans %= inf
  key -= 1

while not_yet:
  key = not_yet.popleft()
  for v in range(k-2, k-1-len(tree[key]), -1):
    ans *= v
    ans %= inf
  
  for value in tree[key]:
    if already[value]:
      continue
    not_yet.append(value)
    already[value] = True

print(ans)

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i=1; i*i<=n; i++) {
        if(n%i==0) {
            ret.pb(i);
            if(i*i!=n) {
                ret.pb(n/i);
            }
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    Vec d;
    d = divisor(n);
    ll ans=INF;
    rep(i,d.size()){
        ll a = d[i];
        ll b = n/a;
        auto keta = [&](ll x){
            return to_string(x).size();
        };
        chmin(ans,(ll) max(keta(a),keta(b)));
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    m1, d1 = map(int, input().split())
    m2, d2 = map(int, input().split())

    if m1 == m2:
        print(0)
    else:
        print(1)

if __name__ == '__main__':
    main()


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

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;
/* c++11
#include <tuple>
using std::tuple; 
using std::make_tuple;
using std::get; // tuple std::get<NUM>(t); (0 <= NUM <= 2)
 */

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

int main(void) {
    int n;
    int m;
    int t;
    cin >> n >> m >> t;
    VI a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int study_time = 0;
    if (a[0] - m > 0) {
        study_time += (a[0] - m);
    }
    if (t - (a[n - 1] + m) > 0) {
        study_time += (t - (a[n - 1] + m));
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i + 1] - a[i] > 2 * m) {
            study_time += (a[i + 1] - a[i]) - 2 * m;
        }
    }
    cout << study_time << endl;
    return 0;
}

Measured memory_bytes: 3112
// In the name of God
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <assert.h>
#include <bitset>
#define sqr(a) (a)*(a)
#define all(a) (a).begin(), (a).end()
using namespace std;

template <typename T>
T next_int() {
    T x = 0, p = 1;
    char ch;
    do { ch = getchar(); } while(ch <= ' ');
    if(ch == '-') {
        p = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9') {
        x = x * 10 + (ch - '0');
        ch = getchar();
    }
    return p * x;
}

string next_token() {
    char ch;
    string ans = "";
    do { ch = getchar(); } while(ch <= ' ');
    while((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
        ans += ch;
        ch = getchar();
    }
    return ans;
}
    
const long long INF = (long long)1e18;
const int INFINT = (int)1e9 + 227 + 1;
const int MAXN = (int)1e5 + 227 + 1;    
const int MOD = (int)1e9 + 7;
const long double EPS = 1e-9;

long long Pow(long long a, long long b) {
    if(!b) return 1;

    long long ans = Pow(a, b / 2);

    ans = ans * ans % MOD;

    if(b % 2) ans = ans * a % MOD;

    return ans;
}

int main() {
    // freopen(".in", "r", stdin);

    string a; cin >> a;
    int m; cin >> m;

    for(int i = 0; i < a.size(); i++) {
        int c = a[i] - 'a';

        if(26 - c <= m && c) {
            m -= 26 - c;
            a[i] = 'a';
        }
    }

    m %= 26;
    a[a.size() - 1] += m;

    cout << a << "\n";
}

Measured memory_bytes: 544
N, M = map(int, input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)

for i in range (0, M):
    A, B = map(str, input().split())
    A = int(A)
    if B == 'WA':
        if AC[A] == 0:
            WA[A]+=1
    else:
        if AC[A] == 0:
            AC[A] = 1

Wronganswer = 0
for i in range (0, N+1):
    Wronganswer+=(AC[i]*WA[i])
print(sum(AC), Wronganswer)

Measured memory_bytes: 10388
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto i : a) cout << i << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);

using namespace std;

int main()
{
    int n, k; cin >> n >> k;
    int cnt = 0;
    FOR(i, n, 0)
    {
        int x; cin >> x;
        if(x >= k)cnt++;
    }
    cout << cnt;
	return 0;
}


Measured memory_bytes: 256
import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def dijkstra(start):
    dist = [INF] * (N+1)
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, prev = heappop(que)
        if dist[prev] < d:
            continue
        for cost, next in graph[prev]:
            d1 = d + cost
            if dist[next] > d1:
                dist[next] = d1
                heappush(que, (d1, next))
    return dist

N, M = lr()
INF = 10 ** 15
graph = [[] for _ in range(N+1)] # 1-indexed
for i in range(2, N+1):
    graph[i].append((0, i-1))

for _ in range(M):
    l, r, c = lr()
    graph[l].append((c, r))

dist = dijkstra(1)

if dist[N] == INF:
    print(-1)
else:
    print(dist[N])
# 19

Measured memory_bytes: 44124
while 1:
    M = int(input())
    N = int(input())
    if M == N == 0:
        break
    S = [list(map(int, input().split())) for i in range(N)]
    used=[[0]*M for i in range(N)]
    def dfs(x, y, dd=((-1,0),(0,-1),(1,0),(0,1))):
        r = 0
        for dx, dy in dd:
            nx = x + dx; ny = y + dy
            if 0 <= nx < M and 0 <= ny < N and S[ny][nx] and not used[ny][nx]:
                used[ny][nx] = 1
                r = max(r, dfs(nx, ny)+1)
                used[ny][nx] = 0
        return r
    ans = 0
    for i in range(N):
        for j in range(M):
            if S[i][j]:
                used[i][j] = 1
                ans = max(ans, dfs(j, i)+1)
                used[i][j] = 0
    print(ans)


Measured memory_bytes: 5816
#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 n, sum;
    cin >> n >> sum;

    rep(i,n+1) rep(j,n+1) {
        int x,y,z;
        x=i;
        y=j;
        z=n-i-j;
        if (z >= 0 && z <= n && 10000*x+5000*y+1000*z==sum) {
            cout << x << " " << y << " " << z << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main( void )
{
  	int i=0;
  	char s[3];
  
  	scanf( "%s\n", s );
  
   	if( s[0] == '1' ) i++;
  	if( s[1] == '1' ) i++;
  	if( s[2] == '1' ) i++;
      
  	printf( "%d\n", i );
  
 	return 0; 
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { 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; }

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

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

  int k;
  cin >> k;

  vector<ll> A(k);
  rep(i, k) cin >> A[i];

  reverse(A.begin(), A.end());

  ll min_val = 2;
  ll max_val = 2;

  rep(i, k){
    
    ll a = A[i];
    min_val = (min_val + a - 1) / a * a;
    max_val = max_val / a * a;

    if(max_val < min_val){
      cout << -1 << endl;
      return 0;
    }

    max_val = max_val + a-1;

  }

  cout << min_val << " " << max_val << endl;

  

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,k,ans,p,q;
  cin>>n>>k;
  p=n/k;
  ans+=p*p*p;
  if(k%2==0){q=(n+k/2)/k;ans+=q*q*q;}
  cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int ma = 0;
    for(auto p : mp){
        ma = max(ma,p.second);
    }
    for(auto p : mp){
        if(p.second == ma){
            cout << p.first << endl;
        }
    }
}

Measured memory_bytes: 25216
'use strict';
function main(input) {
  input = input.split(" ");
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);
  
  console.log(500 * a >= b ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll N;
    cin >>N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }

    ll ans=0;
    vector<ll> cnt(61);

    rep(i,61){
        rep(j,N){
            if((A[j]>>i)&1){
                cnt[i]++;
            }

        }
    }
    rep(i,61){
        ll ml = cnt[i]*(N-cnt[i]);
        rep(j,i){
            ml = (ml*2)%mod;
        }
        ans = (ans+ml)%mod;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 5572
#include <stdio.h>
int main()
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if ((x + r <= W) && (x - r >= 0) && (y + r <= H) && (y - r >= 0))
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

#define INF INT_MAX

int n, m;
vector<pair<int, int> > graph[100010];

int cost[100010];

bool flag = true;

void dfs(int idx, int num){
    if(!flag) return;

    cost[idx] = num;
    for(int i = 0;i < graph[idx].size();i++){
        if(cost[graph[idx][i].first] != INF){
            if(cost[graph[idx][i].first] != num + graph[idx][i].second){
                flag = false;
                return;
            }
        }else{
            dfs(graph[idx][i].first, num+graph[idx][i].second);
        }
    }
    return;
}

int main(){
    cin >> n >> m;
    int a, b, c;
    for(int i = 0;i < m;i++){
        cin >> a >> b >> c;
        a--, b--;
        graph[a].push_back(make_pair(b, c));
        graph[b].push_back(make_pair(a, -c));
    }

    for(int i = 0;i < n;i++){
        cost[i] = INF;
    }

    for(int i = 0;i < n;i++){
        if(cost[i] == INF){
            dfs(i, 0);
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 12032
#coding utf-8
from collections import deque
H,W=map(int,input().split())

s = [list(input().strip()) for _ in range(H)]
d = [[ 0 for i in range(W)] for j in range(H)]
q = deque([])
q.append([0,0,0])
y,x,z=q.popleft()

H = H-1
W = W-1
ans2=0
while y!=H or x!=W:
  if s[y][x]=="." and d[y][x]==0:
    if y<H:
      q.append([y+1,x,z+1])
    if x<W:
      q.append([y,x+1,z+1])
    if y>0:
      q.append([y-1,x,z+1])
    if x>0:
      q.append([y,x-1,z+1])
    d[y][x]=1
  if q==deque([]):
    ans2 = -1
    break
  y,x,z=q.popleft()
  

ans1=0
for i in range(H+1):
  for j in range(W+1):
    if s[i][j]=="#":
      ans1 +=1
      
ans = (H+1)*(W+1)-ans1-z-1
if ans2==-1:
  print(ans2)
else:
  print(ans)

  


Measured memory_bytes: 3436
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long
#define print(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = (1LL << 30);
const ll MOD = 1000000007;

//=============================================================
//=============================================================

int N;
const int Nmax = 101;
int x[100], y[100], h[100];

void solve()
{

    int valid_i = -1;
    rep(i, N)
    {
        if (h[i] >= 1)
        {
            valid_i = i;
            break;
        }
    }

    rep(xx, Nmax)
    {
        rep(yy, Nmax)
        {
            bool isOK = true;
            int Hnow = h[valid_i] + abs(xx - x[valid_i]) + abs(yy - y[valid_i]);
            rep(i, N)
            {
                int absx = abs(xx - x[i]);
                int absy = abs(yy - y[i]);
                int a = 0;
                int he = max((Hnow - absx - absy), a);
                if (he != h[i])
                {
                    isOK = false;
                    break;
                }
            }

            if (isOK)
            {
                cout << xx << " " << yy << " " << Hnow << endl;
                return;
            }
        }
    }
}
signed main()
{
    cin >> N;
    rep(i, N)
    {
        cin >> x[i] >> y[i] >> h[i];
    }
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const ll INF = 1LL << 60;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b)
{
   return a / GCD(a, b) * b;
}

int main()
{
	int N;
	cin >> N;
	ll num = 1;
	ll T;
	for(int i = 0; i < N; i++)
	{
		cin >> T;
		num = LCM(num,T);
	}
	cout << num << endl;
}


Measured memory_bytes: 256
//A
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] H = new int[N];

		for(int i=0;i<N;i++) H[i] = sc.nextInt();

		int ans = 1;

		int max = H[0];

		for(int i=1;i<N;i++) {

			if(H[i]>=max) {

				ans++;

				max = H[i];
			}
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
a,b=gets.split.map &:to_i
s=[]
y=[]
a.times{|i|s[i],y[i]=gets.split.map &:to_i}
ans=s.zip(y).sort
kai=0
ans.each{|x|
  (kai=x[0];break)if x[1]<=b
}
puts kai>0 ? kai: "TLE"


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll a, b; cin >> a >> b;
  fin(a + 1 >= b * 2?"YES":"NO")
  return;
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

int main() {

int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ( abs(a-b) <= d && abs(b-c) <= d || abs(a-c) <= d){
  cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    std::vector<int> a;
    for (int i = 1; i <= n; i++) {
        int k;
        cin >> k;
        a.push_back(k - i);
    }
    partial_sort(a.begin(), a.begin() + (n + 1) / 2, a.end());
    long sumu = 0;
    long sumd = 0;
    for (int i = 0; i < a.size(); i++) {
        sumu += abs(a[i] - a[n / 2]);
        sumd += abs(a[i] - a[(n - 1) / 2]);
    }
    cout << min(sumu, sumd) << endl;
}


Measured memory_bytes: 1400