akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REV(i,a,n) for(int i=a;i>=n;i--)
#define all(a) a.begin(),a.end()
#define UB upper_bound
#define LB lower_bound
const int NUM = 2e5 + 5;
int w[100], v[100], dp[100][100001];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int num_tests=1; 
    //cin >> num_tests;
    while(num_tests-->0){
        int n,W; cin >> n >> W;
        FOR(i,0,n){
            cin >> w[i] >> v[i] ;
        }
        dp[0][0] = 0;
        dp[0][w[0]] = v[0];
        FOR(i,1,n){
            dp[i][0] = 0;
            FOR(j,1,W+1){
                dp[i][j] = dp[i-1][j];
                if(j >= w[i])
                    dp[i][j] = max(dp[i][j], dp[i-1][j - w[i]] + v[i]);
            }
        }
        int ans = -1e18;
        FOR(i,0,W+1)
            ans = max(ans,dp[n-1][i]);
        cout << ans;
    }   
}

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


int main()
{	
	int n,m,x,c[15],a[15][15],ans=1000000000;
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		cin>>c[i];
		for(int j=0;j<m;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int bit=0;bit<(1<<n);bit++)
	{	
		int cost=0;
		int sum[15]={};
		for(int i=0;i<n;i++)
		{	
			if(bit&(1<<i))
			{
				cost+=c[i];
				for(int j=0;j<m;j++)
				{
					sum[j]+=a[i][j];
				}
				bool flag=true;
				for(int j=0;j<m;j++)
				{
					if(sum[j]<x)flag=false;
				}
				if(flag)ans=min(ans,cost);
			}
		}
	}
	if(ans==1000000000)cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,h,a;
    cin>>h>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        h-=a;
    }
    if(h<=0){cout<<"Yes";}
    else{cout<<"No";}
}

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

int main(){
    int N;
    cin >> N;
    cout << N + N*N + N*N*N << endl;
}

Measured memory_bytes: 3636
arr = gets.chomp.split(' ').map(&:to_i)
a = arr[0]
b = arr[1]
# a = Math.sqrt(arr[0])
# b = Math.sqrt(arr[1])
s = - (arr[3] * Math::PI) / 30
t = - (Math::PI * (60 * arr[2] + arr[3]) ) / 360
sol = (a * Math.cos(s) - b * Math.cos(t) ) ** 2 + (a * Math.sin(s) - b * Math.sin(t) ) ** 2
print Math.sqrt(sol)

Measured memory_bytes: 14752
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

typedef int Weight;
const Weight INF = 1000000000;
struct Edge{ int src, dest; Weight weight; };
 
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

Weight shortestHamiltonPath(Matrix w, int s) {
  int n = w.size(), N = 1 << n;
  vector<vector<int>> best(N, vector<int>(n));
  REP(v,N) REP(i,n) best[v][i] = INF;
  best[1<<s][s] = 0;
  REP(v,N) REP(i,n) if (v & (1 << i))
    REP(j,n) if (best[v|(1<<j)][j] > best[v][i] + w[i][j])
      best[v|(1<<j)][j] = best[v][i] + w[i][j];
  auto it = best[N-1].begin();
  int t = min_element(it, it + n) - it;
  return best[N-1][t];
}

int d(string& a,string& b){
  int mn = 0;
  REP(i,min(a.size(), b.size())){
    bool ok=true;
    REP(j,i){
      if(a[a.size()-i+j] != b[j]){
        ok=false;
        break;
      }
    }
    if(ok) mn = i;
  }
  return b.size() - mn;
}

int main() {
  while(1){
    int n;
    cin >> n;
    if(!n) break;
    vector<string> a(n);
    REP(i,n) cin >> a[i];
    sort(begin(a),end(a),[](const string& l,const string& r){return l.size()>r.size();});
    for(auto itr=begin(a);itr!=end(a);++itr) {
      bool ok=true;
      for(auto itr2=begin(a);itr2!=itr;++itr2){
        if(itr2->find(*itr) != string::npos){
          ok=false;
          break;
        }
      }
      if(!ok){
        itr = prev(a.erase(itr));
      }
    }
    n=a.size();
    Matrix dist(n,Array(n,INF));
    REP(i,n)REP(j,n){
      if(i==j)continue;
      dist[i][j] = d(a[i],a[j]);
    }
    size_t mind=INF;
    REP(i,n){
      mind=min(mind,a[i].size() + shortestHamiltonPath(dist, i));
    }
    cout<<mind<<endl;
  }
  return 0;
}

Measured memory_bytes: 2584
N = int(input())
h = [int(i) for i in input().split()]
dp = [10**10 for _ in range(N)]
dp[0] = 0
for i in range(N-1):
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1]-h[i]))
    if i+2 < N:
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2]-h[i]))
print(dp[-1])

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

int main(){
    long long x, ans;
    cin >> x;
    
    ans = (x / 11) * 2;
    x %= 11;
    if(x > 0){
        if(x > 6) ans += 2;
        else ans += 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long b){
	long long ans = 1;
	while (b > 0){
		if (b % 2 == 1){
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		b /= 2;
	}
	return ans;
}
long long modinv(long long a){
	return modpow(a, MOD - 2);
}
int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	map<int, int> mp;
	for (int i = 0; i < N; i++){
		int B = A[i];
		for (int j = 2; j * j <= B; j++){
			if (B % j == 0){
				int cnt = 0;
				while (B % j == 0){
					cnt++;
					B /= j;
				}
				mp[j] = max(mp[j], cnt);
			}
		}
		if (B != 1){
			mp[B] = max(mp[B], 1);
		}
	}
	long long lcm = 1;
	for (auto P : mp){
		for (int i = 0; i < P.second; i++){
			lcm *= P.first;
			lcm %= MOD;
		}
	}
	long long ans = 0;
	for (int i = 0; i < N; i++){
		ans += lcm * modinv(A[i]);
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4080
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  set<int> A;
  int n;
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    if (A.count(x)) {
      A.erase(x);
    } else {
      A.insert(x);
    }
  }
  printf("%d\n", A.size());
  return 0;
}


Measured memory_bytes: 4864
#include <stdio.h>

int main(void){
  int i,sum;
  char num[1001];

  for(;;){
    scanf("%s", &num);
    if(num[0] == '0') break;
    
    sum = 0;
    for(i=0;num[i]!='\0';i++)
      sum += num[i] - '0';
    printf("%d\n", sum);
  }
  
  return 0;
}





  

 





Measured memory_bytes: 2092
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << (x) << '\n'
#pragma GCC optimize("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	ll x, k, d;
	cin >> x >> k >> d;
	ll step = abs(x) / d;
	if (step >= k) {
		cout << abs(x) - k * d << '\n';
		return 0;
	}
	k -= step;
	ll ans = abs(x) - step * d;
	if (k & 1) cout << d - ans << '\n';
	else cout << ans << '\n';
}

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

struct Card{
    char c;
    int num;
    bool operator<(const Card& rhs) const{
        return num<rhs.num;
    }
    bool operator<=(const Card& rhs) const{
        return num<=rhs.num;
    }
    bool operator==(const Card& rhs) const{
        return c==rhs.c and num==rhs.num;
    }
};

int main()
{
    int N; cin>>N;
    vector<Card> card(N);
    for(int i=0;i<N;i++) cin>>card[i].c>>card[i].num;
    vector<Card> tmp=card;

    auto partition=[&](int l,int r)
    {
        int i=l;
        for(int j=l;j<r;j++){
            if(card[j]<=card[r]) swap(card[i++],card[j]);
        }
        swap(card[i],card[r]);
        return i;
    };
    function<void(int,int)> quicksort=[&](int l,int r)
    {
        if(r-l>1){
            int m=partition(l,r-1);
            quicksort(l,m);
            quicksort(m+1,r);
        }
    };
    quicksort(0,N);
    stable_sort(tmp.begin(),tmp.end());
    bool stable=true;
    for(int i=0;i<N;i++){
        stable&=(card[i]==tmp[i]);
    }
    cout<<(stable? "Stable":"Not stable")<<endl;
    for(int i=0;i<N;i++) cout<<card[i].c<<' '<<card[i].num<<endl;
    return 0;
}


Measured memory_bytes: 4660
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

bool check_number(char c){
  if('0' <= c && c <= '9') return true;
  return false;
}

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

  bool flag = true;
  if(s.size() != a+b+1) flag = false;
  else {
    rep(i, a){
    if(!check_number(s[i])) flag = false;
    }
    if(s[a] != '-') flag = false;
    for(int i = s.size()-1; i >= s.size() - b; i--){
      if(!check_number(s[i])) flag = false;
    }
  }
  
  if(flag) print("Yes");
  else print("No");
}


Measured memory_bytes: 256
N = int(input())
S = [''.join(sorted(input())) for _ in range(N)]

ans = 0
dic ={} 
#print(S)
for s in  S:
   if s in dic:
      ans+=dic[s]
      dic[s]+=1
   else:
      dic[s] = 1

#print(dic)
print(ans)

Measured memory_bytes: 19404
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 54
#define INF 1e9+7

using namespace std;

ll n,k,ar[N][N],mod=1e9+7;
ll identity[N][N],zero_mat[N][N];

void make_equal(ll A[][N],ll B[][N])
{
    rep(i,0,n)
        rep(j,0,n)
            A[i][j] = B[i][j];

    return;
}

void mult(ll A[][N],ll B[][N])
{
    ll mat[N][N];

    make_equal(mat,zero_mat);

    rep(i,0,n)
        rep(j,0,n)
            rep(k,0,n)
                mat[i][j] = (mat[i][j] + A[i][k]*B[k][j])%mod;

    make_equal(A,mat);

    return;
}

void mat_expo(ll v[][N],ll e,ll res[][N])
{
    if(e == 0)
    {
        make_equal(res,identity);
        return;
    }
    if(e == 1)
    {
        make_equal(res,v);
        return;
    }


    mat_expo(v,e/2,res);
    mult(res,res);

    if(e%2==1)
        mult(res,v);

    return;
}

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

    cin >> n >> k;

    rep(i,0,n)
        identity[i][i] = 1;

    rep(i,0,n)
    {
        rep(j,0,n)
        {
            cin >> ar[i][j];
        }
    }

    ll res[N][N];
    mat_expo(ar,k,res);

    ll ans = 0;

    rep(i,0,n)
    {
        rep(j,0,n)
        {
            ans=(ans+res[i][j])%mod;
        }
    }

    cout << ans;

    return 0;
}

/*
4 1
0 1 0 0
0 0 1 1
0 0 0 1
1 0 0 0
*/


Measured memory_bytes: 384
from collections import deque

N, Q = map(int, input().split())

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

cnt = [0 for _ in range(N)]
for _ in range(Q):
  p, x = map(int, input().split())
  p -= 1
  cnt[p] += x

queue = deque()
queue.append((0, -1))
while queue:
  q = queue.popleft()
  if q[0] != 0:
    cnt[q[0]] += cnt[q[1]]
  for i in to[q[0]]:
    if i != q[1]:
      queue.append((i, q[0]))

for c in cnt:
  print(c)

Measured memory_bytes: 104004
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int 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 dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    int H,W,ch,cw,dh,dw;   
    cin>>H>>W;
    cin>>ch>>cw;
    cin>>dh>>dw;
    ch--,cw--,dh--,dw--;
    char maze[H][W];
    rep(i,H){
        rep(j,W){
            cin>>maze[i][j];
        }
    }
    queue<pair<int,int>> que,que2;
    int d[H][W];
    rep(i,H){
        rep(j,W){
            d[i][j]=INF;
        }
    }
    que.push(make_pair(ch,cw)); // (0,0)スタート
    d[ch][cw]=0;
    while(!que.empty() || !que2.empty()){
        if(que.empty()){
            pair<int,int> p=que2.front();
            que2.pop();

            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    if(i==0 && j==0) continue;
                    int nx=p.first+i;
                    int ny=p.second+j;
                    if(0<=nx && nx<H && 0<=ny && ny<W && maze[nx][ny]!='#' && d[nx][ny]==INF){
                        que.push(make_pair(nx,ny));
                        d[nx][ny]=min(d[nx][ny],d[p.first][p.second]+1);            
                    }
                }
            }
        }
        else{
            pair<int,int> p=que.front();
            que.pop();
            que2.push({p.first,p.second});
            for(int i=0;i<4;i++){
                int nx=p.first+dx[i];
                int ny=p.second+dy[i];
                if(0<=nx && nx<H && 0<=ny && ny<W && maze[nx][ny]!='#' && d[nx][ny]==INF){
                    que.push(make_pair(nx,ny));
                    d[nx][ny]=min(d[nx][ny],d[p.first][p.second]);            
                }
            }
        }      
    }

    if(d[dh][dw]==INF) d[dh][dw]=-1;
    cout<<d[dh][dw]<<endl;
}

Measured memory_bytes: 8588
from collections import deque

dq = deque()
n, q = map(int, input().split())
for i in range(n):
  p, t = map(str, input().split())
  dq.append([p, int(t)])

t = 0
while dq:
  if dq[0][1] <= q:
    t += dq[0][1]
    print(str(dq[0][0]) + " " + str(t))
    dq.popleft()
  else:
    t += q
    dq[0][1] -= q
    dq.append(dq[0])
    dq.popleft()


Measured memory_bytes: 13300
N = gets.to_i
A = gets.chomp.split(" ").map(&:to_i)

mx = A.max
sieve = Array.new(mx+1).map{[]}
(2..mx/2).each{|i|
  next if not sieve[i].empty?
  j=2*i
  while j <= mx do
    sieve[j] << i
    j += i
  end
}
prm = Hash.new{|h, k| h[k] = 0}
A.each{|a|
  next if a == 1
  sieve[a].empty? ? prm[a] += 1 : sieve[a].each{|i| prm[i] += 1}
}

if prm.all?{|k, v| v == 1} then
  puts 'pairwise coprime'
elsif prm.any?{|k, v| v == N} then
  puts 'not coprime'
else
  puts 'setwise coprime'
end


Measured memory_bytes: 187948
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;
 
int main(){
	long long n,m;
	cin >> n >> m;
	
	vector<long long> h(n,0);
	for(long long i=0;i<n;i++){
		cin >> h[i];
	}
	
	pair<long long,long long> pa[m];
	for(long long i=0;i<m;i++){
		cin >> pa[i].first >> pa[i].second;
	}
	
	vector<bool> check(n,true);
	for(long long i=0;i<m;i++){
		if(h[pa[i].first-1]>h[pa[i].second-1]){
			check[pa[i].second-1]=false;
		}else if(h[pa[i].first-1]<h[pa[i].second-1]){
			check[pa[i].first-1]=false;
		}else{
			check[pa[i].first-1]=false;
			check[pa[i].second-1]=false;
		}
	}
	
	long long cnt=0;
	for(long long i=0;i<n;i++){
		if(check[i]==true)cnt++;
		//cout << check[i] << endl;
	}
	
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 5572
#include <stdio.h>

int main(void){
    int n,m,l,i,j,k;
    long long int sum;
    long long int a[100][100],b[100][100],c[100][100];
    
    scanf("%d %d %d",&n,&m,&l);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%lld",&a[i][j]);
        }
    }
    for(i=0;i<m;i++){
        for(j=0;j<l;j++){
            scanf("%lld",&b[i][j]);
        }
    }
    for(i=0;i<n;i++){
        
        for(j=0;j<l;j++){
            sum=0;
            for(k=0;k<m;k++){
                sum+=a[i][k]*b[k][j];
            }
            c[i][j]=sum;
            
        }
    }
    
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            printf("%lld",c[i][j]);
            if(j!=l-1) printf(" ");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string S;
    cin >> S;
    rep(i, 0, 3)
    {
        if (S[i] == S[i + 1])
        {
            cout << "Bad" << endl;
            return;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int h, w;
     
    char c[2010][2010];
    int x[2010][2010];
     
    int main(){
    cin >> h >> w;
    for(int i = 0;i < h;i++) cin >> c[i];
     
    for(int i = 1;i < h;i++){
    for(int j = 1;j < w;j++){
    if(c[i-1][j-1] == c[i-1][j]){
    x[i-1][j-1] = c[i][j-1] == c[i][j] ? 1 : 0;
    }else{
    x[i-1][j-1] = c[i][j-1] != c[i][j] ? 1 : 0;
    }
    }
    }
     
    int dp[2010][2010] = {};
    for(int j = 0;j < w-1;j++){
    if(x[0][j] == 1) dp[0][j] = 1;
    for(int i = 1;i < h-1;i++){
    if(x[i][j] == 1){
    dp[i][j] += dp[i-1][j] + 1;
    }
    }
    }
     
    int ans = max(h, w);
     
    for(int i = 0;i < h-1;i++){
    stack<pair<int, int> > st;
    for(int j = 0;j < w;j++){
    pair<int, int> p;
    p.first = dp[i][j];
    p.second = j;
    if(st.empty()){
    st.push(p);
    }else if(st.top().first < p.first){
    st.push(p);
    }else{
    int target = j;
    while(!st.empty() && st.top().first >= p.first){
    ans = max(ans, (st.top().first+1)*(j-st.top().second+1));
    target = st.top().second;
    st.pop();
    }
    p.second = target;
    st.push(p);
    }
    }
    }
     
    cout << ans << endl;
    return 0;
    }
     

Measured memory_bytes: 35712
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
int main() {
   long long a,b,c;
   cin>>a>>b>>c;
   bool flag = false;
   rep(i,b){
      if(a*(i+1)%b==c){
         flag=true;
      }
   }
   if(flag){
      cout<<"YES"<<endl;
   }
   else{
      cout<<"NO"<<endl;
   }
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N, K;
  cin >> N >> K;
  
  ll ct = N / K;
  fin(min(abs(N - K * ct), abs(N - K * (ct + 1))));
}

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

int main() {
  int K, S, res = 0;
  cin >> K >> S;

  for(int i=0; i<=K; ++i) {
    for(int j=0; j<=K; ++j) {
      if(S-(i+j)<=K && i+j<=S) ++res;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  math2do
 *    created: 30.08.2020 16:42:56
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  char ch;
  cin >> ch;
  puts((ch >= 'a' && ch <= 'z') ? "a" : "A");
  return 0;
}


Measured memory_bytes: 3652
import sys
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
mod = 10 ** 9 + 7
count = Counter(A)
flag = 0
if N % 2 == 0:
    for i in range(1, N, 2):
        if count[i] != 2:
            flag = 1
else:
    if count[0] != 1:
        flag = 1
    for i in range(2, N, 2):
        if count[i] != 2:
            flag = 1
if flag:
    print(0)
else:
    print((2 ** (N // 2)) % mod)

Measured memory_bytes: 14820
#include<cstdio>
using namespace std;
int main(){
    int n,x[100010]={},a,b,m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        x[a]++;
        x[b]++;
    }
    for(int i=1;i<=n;i++){
        if(x[i]%2){
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
}

Measured memory_bytes: 512
import math


A,B,H,M=(input().split())
kakuH=(float(int(H)*30)+float(int(M)*0.5))
kakuM=int(int(M)*6)



if kakuH > int(kakuM + 180):
    kaku=float(kakuM+360-kakuH)
else :
    kaku=float(abs(kakuM-kakuH))

kaku=kaku*(float(math.pi)/180)

A=float(A)
B=float(B)
C=float(2*A*B*math.cos(kaku))

Ans1=float(int(A*A)+int(B*B)-float(C))
        
print(float(math.sqrt(Ans1)))

Measured memory_bytes: 9596
#include<stdio.h>
#include<stdlib.h>
 
int main(void){
    int N;
    scanf("%d",&N);
    int i,t[N+1],x[N+1],y[N+1];
    int dt,dx,dy,dist;
 
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
 
    for(i = 1;i < N+1;i++){
        scanf("%d%d%d",&t[i],&x[i],&y[i]);
    }
    
    for(i = 1;i < N+1;i++){
        dt = t[i] - t[i-1];
        dx = x[i] - x[i-1];
        dy = y[i] - y[i-1];
 
        dist = abs(dx) + abs(dy);
        
        if(dist > dt){
            printf("No");
            return 0;
        }
        
        if(dist % 2 != dt % 2){
            printf("No");
            return 0;
        }
        
    }
    
    printf("Yes");
 
    return 0;
}

Measured memory_bytes: 1280
// AOJ Volume 1 Problem 0103

#include <stdio.h>
#include <string.h>

int main(void)
{
	int n;
	char event[8];
	int base1, base2, base3;
	int out;
	int score;
	int i;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		base1 = base2 = base3 = out = score = 0;
		while (1){
			scanf("%s", event);
			if (strcmp(event, "HIT") == 0){
				score += base3;
				base3 = base2;
				base2 = base1;
				base1 = 1;
			}
			else if (strcmp(event, "HOMERUN") == 0){
				score += (base1 + base2 + base3 + 1);
				base1 = base2 = base3 = 0;
			}
			else {
				out++;
				if (out == 3){
					break;
				}
			}
		}
		printf("%d\n", score);
	}
	
	return (0);
}

Measured memory_bytes: 0
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vii a;
    priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    cin>>s;

    a.pb({0,-1});
    pq.push({0,0});

    repA(i,1,n)
    {
        if(s[i]=='1')
        {
            a.pb({INF,i});
            continue;
        }

        while(!pq.empty())
        {
            auto u=pq.top();
            if(i-u.Y<=m)
                break;
            pq.pop();
        }

        if(pq.empty())
        {
            cout<<-1<<endl;
            return 0;
        }

        auto u=pq.top();
        a.pb({u.X+1,u.Y});
        pq.push({u.X+1,i});
    }

    dbg(a);

    vi b;
    while(n>0)
    {
        m=a[n].Y;
        b.pb(n-m);
        n=m;
    }

    reverse(all(b));
    for(auto x:b)
        cout<<x<<" ";

}   aryanc403();
    return 0;
}

Measured memory_bytes: 3904
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#define DIV 1000000007

long long N;

int main() {
  scanf("%lld%*c", &N);
  long long i;
  long long ans = 1;
  for (i = 1; i <= N; i++) {
    ans *= i % DIV;
    ans = ans % DIV;
    //      printf("%lld\n", ans);
  }
  printf("%lld\n", ans);
  return 0;
}



Measured memory_bytes: 128
sci = (380 * 5 * 0.8).to_i
scj = (550 * 4 * 0.85).to_i
sck = (850 * 3 * 0.88).to_i

while true
  w = gets.chomp.to_i
  break if w == 0

  w /= 100

  min_cost = nil

  for i in (0..(w / 2))
    wi = w - 2 * i
    ci = (i / 5) * sci + (i % 5) * 380
    for j in (0..(wi / 3))
      wj = wi - 3 * j
      if wj % 5 == 0
        cj = (j / 4) * scj + (j % 4) * 550
        k = wj / 5
        ck = (k / 3) * sck + (k % 3) * 850

        cost = ci + cj + ck
        if min_cost.nil? || min_cost > cost
          min_cost = cost
        end
      end
    end
  end

  puts min_cost
end

Measured memory_bytes: 6116
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)

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

    if (a == b) puts("Draw");
    else if (a == 1) puts("Alice");
    else if (b == 1) puts("Bob");
    else if (a > b) puts("Alice");
    else puts("Bob");
    return 0;
}

Measured memory_bytes: 128
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,x[55]={},y[55]={},ans=INF,cnt=0;
  cin >> n >> m;
  for(int i=0; i<n; i++) {
    cin >> x[i] >> y[i];
  }
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      for(int k=0; k<n; k++) {
        for(int l=0; l<n; l++) {
          if(x[i]<x[j]&&y[k]<y[l]) {
            cnt=0;
            for(int o=0; o<n; o++) {
              if(x[i]<=x[o]&&x[o]<=x[j]&&y[k]<=y[o]&&y[o]<=y[l]) {
                cnt++;
              }
            }
            if(cnt>=m) {
              ans=min(ans,(x[j]-x[i])*(y[l]-y[k]));
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
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 (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, k; cin >> n >> k;
    vector<ll> v(n);
    REP(i, n) cin >> v[i];

    ll ans = 0;
    REP(l, k+1) REP(r, k+1) {
        if (l + r > n || l + r > k) continue;
        if (l + r == 0) continue;
        vector<ll> taken(l + r);
        if (l) copy(v.begin()  , v.begin() + l, taken.begin());
        if (r) copy(v.end() - r, v.end()      , taken.begin() + l);
        sort(ALL_OF(taken));
        ll naway = k - (l + r);
        ll term = accumulate(ALL_OF(taken), 0);
        ll plimit = lower_bound(ALL_OF(taken), 0LL) - taken.begin();
        chmin(naway, plimit);
        if (naway > 0) {
            term -= accumulate(taken.begin(), taken.begin() + naway, 0);
        }
        chmax(ans, term);
    }
    cout << ans << endl;
    
}

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

	public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int N = scan.nextInt();
	int shine[] = new int[N];
	for(int i = 1;i != N; i++) {
		int A = scan.nextInt();
		shine[A-1]++;
	}
	
	for(int j = 0;j != N; j++) {
		System.out.println(shine[j]);
	}
	
	}

}


Measured memory_bytes: 62316
#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int n , a , b , c ;
    cin >> n ;
    for( int i=0 ; i<n ; i++ ){
        cin >> a >> b >> c;
        a = a*a;
        b = b*b;
        c = c*c;
        int ab=a+b;
        int ac=a+c;
        int bc=b+c;
        if( ab == c ){
            cout << "YES" << endl;
        }
        else if( ac == b ){
            cout << "YES" << endl;
        }
        else if( bc == a ){
            cout << "YES" << endl;
        }
        else
            cout << "NO" << endl;
    }
}

Measured memory_bytes: 3076
#include <cstdio>
#include <iostream>

int main() {
    int a, b;
    std::string s;
    scanf("%d %d", &a, &b);
    if ((a+b) % 3 == 0 || a % 3 == 0 || b % 3 == 0) s = "Possible";
    else           s = "Impossible";
    std::cout << s << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define PI acos(-1.0)
#define LL long long
#define MAX 0x3fffffff
using namespace std;

int a, b, c;
map<int, int> ma;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> a >> b >> c;
	ma[a]++;
	ma[b]++;
	ma[c]++;
	if (ma.size() == 2)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010
#define lb lower_bound //[2,4)=lb(4)-lb(2)

int main()
{
  string s;
  cin>>s;
  map<ll,ll> m;
  
  reverse(s.begin(),s.end());
  
  ll n=0;
  ll p=1;
  for (int i=0;i<s.size();i++)
  {
    n = (s[i]-'0')*p + n;
    //cout<<n<<endl;
    p *= 10;
    p %= 2019;
    n %= 2019;
    m[n%2019]++;
  }
  
  ll ans =0;
  for(auto i=m.begin();i!=m.end();i++)
  {
     ans += (i->second)*(i->second-1)/2;
  }
  ans += m[0];
  
  cout<<ans<<endl;
}

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

int main() {
	int n;
	cin >> n;
	//n==1処理
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	
	//n!の素因数分解
	vector<long long>primes(n+1,0);
	for (int i = 2; i <= n; i++) {
		int x = i;
		int j = 2;
		while (j <= sqrt(x)) {
			if (x % j == 0) {
				x /= j;
				primes.at(j)++;
			}
			else j++;
		}
		primes.at(x)++;
	}
	vector<long long>prime;
	for (int i = 0; i < primes.size(); i++) {
		if (primes.at(i) != 0) {
			prime.push_back(primes.at(i));
		}
	}
	long long ans = 1;
	for (int i = 0; i < prime.size(); i++) {
		ans *= prime.at(i) + 1;
		ans %= 1000000007;
	}
	cout << ans % 1000000007 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int[][] mat = new int[n + 1][n + 1];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++) {
					mat[i][j] = sc.nextInt();
					mat[i][n] += mat[i][j];
					mat[n][j] += mat[i][j];
					mat[n][n] += mat[i][j];
				}
			for (int i = 0; i < n + 1; i++) {
				for (int j = 0; j < n + 1; j++) {
					System.out.printf("%5d", mat[i][j]);
				}
				System.out.println();
			}
		}
	}

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

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> flg(n, 0), wcnt(n, 0);
  rep(i, m) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (flg[p] == 0 && s == "WA") wcnt[p]++;
    if (s == "AC") flg[p] = 1;
  }

  int a = 0;
  int b = 0;
  rep(i, n) {
    if (flg[i]) {
      a++;
      b += wcnt[i];
    }
  }

  cout << a << ' ' << b << endl;
}


Measured memory_bytes: 1024
n = int(input())
s = [1 if si == 'o' else 0 for si in list(input())]
t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
for ti in t0:
    flag = True
    for i in range(1, n - 1):
        if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
            ti.append(1 - ti[i - 1])
        else:
            ti.append(ti[i - 1])
    for i in range(2):
        if ti[i - 1]:
            if (s[i - 1] and not ti[i - 2] == ti[i]) or (1 - s[i - 1] and ti[i - 2] == ti[i]):
                flag = False
        else:
            if (s[i - 1] and ti[i - 2] == ti[i]) or (1 - s[i - 1] and not ti[i - 2] == ti[i]):
                flag = False
    if flag:
        ans = ['S' if x else 'W' for x in ti]
        print(''.join(ans))
        exit()
print(-1)

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

ll gcd(ll a,ll b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}

int main(){
  int K,X;
  cin >> K >> X ;
  if(500*K>=X){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}
      
  
  
  

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-

# 入力はstringで入る．
# intにしたければ int(input())
# floatで受け取ると 1.0 になる．

# 入力 : N M
N,M = map(int,input().split())

print(int(N*(N-1)/2+M*(M-1)/2))


Measured memory_bytes: 2940
N,K=map(int,input().split())
p=[int(i)-1 for i in input().split()]
q=[int(i)-1 for i in input().split()]
e=[i for i in range(N)]
def cir(x,y):
    z=[0]*N
    for i in range(N):
        z[i]=x[y[i]]
    return z
def inv(x):
    z=[0]*N
    for i in range(N):
        z[x[i]]=i
    return z
def f(x,y):
    return cir(y,inv(x))

def double(x,k):
    a=k
    t=x
    num=e
    while a!=0:
        if a%2==1:
            num=cir(num,t)
        a=a//2
        t=cir(t,t)
    return num
P=inv(p)
Q=inv(q)
#print(p,q,P,Q)
quo=(K-1)//6
r=K-quo*6-1
X=cir(q,cir(P,cir(Q,p)))
#Y=cir(P,cir(q,cir(p,Q)))
#Z=cir(q,double(Y,quo))
Z=double(X,quo)
A=cir(Z,cir(p,inv(Z)))
B=cir(Z,cir(q,inv(Z)))
#print(A,B,quo,r)
def g(n):
    if n==0:
        return A
    if n==1:
        return B
    return f(g(n-2),g(n-1))
L=g(r)
for i in range(N):
    L[i]+=1
print(' '.join(map(str,L)))


Measured memory_bytes: 112164
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>
int main(){
  int w,h,i,j,t,r,ny,nx,x[10000],y[10000],d[100][100];
  int Y[]={1,0,-1,0};
  int X[]={0,1,0,-1};
  while(scanf("%d %d",&w,&h),w||h){
    for(i=0;i<10000;i++)d[i/100][i%100]=10000;
    for(i=0;i<h*2-1;i++){
      for(j=0;j<w-1+i%2;j++){
	scanf("%d",&d[i+2][j*2+3-i%2]);
      }
    }
    d[y[0]=2][x[0]=2]=r=1;
    for(t=0;r-t;t++){//printf("%d %d\n",y[t],x[t]);
      for(i=0;i<4;i++){
	if(d[y[t]+Y[i]][x[t]+X[i]])continue;
	ny=y[t]+Y[i]*2;
	nx=x[t]+X[i]*2;
	if(d[ny][nx]>d[y[t]][x[t]]+1){
	  d[y[r]=ny][x[r]=nx]=d[y[t]][x[t]]+1;
	  r++;
	}
      }
    }//d[h*2][w*2]=-1;
    /*for(i=0;i<h*2+2;i++){
      for(j=0;j<w*2+2;j++)printf("%5d ",d[i][j]);
      printf("\n");
      }//*/
    if(d[h*2][w*2]==10000)printf("0\n");
    else printf("%d\n",d[h*2][w*2]);
  }
  return 0;
}

Measured memory_bytes: 664
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr= input.trim().split("\n");
var [n,d]=arr.shift().split(" ").map(Number);
var p=arr.shift().split(" ").map(Number);
var sum=0;
p.forEach(v=>{
   sum+=Math.max(0,v-d);
});
console.log((sum==0)?"kusoge":sum);


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

int main(){
long long n,k;
cin >>n>>k;
  long long a[n];

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

  sort(b,b+max);

long long check=0;
  for(long long i=0;i<max;i++){
if(b[i]!=0){
  check=i;
  break;
}
  }

  long long s=max-check;
    long long count=0;
    for(long long i=check;i<max;i++){
      if(s>k){
        s--;
        count+=b[i];
      }
      else{
      break;
      }
}
  
 cout << count;
  
  

return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
int n;
vector<string> dat;

//inputします
void input() {
	cin >> n;
	dat.resize(n);
	ff(i, 0, n) {
		cin >> dat[i];
	}
}

//ライブラリ置き場



//main
int main() {
	input();
	int ma = 0;
	map<string, int> dd;
	ff(i, 0, n) {
		if (!dd.count(dat[i]))dd[dat[i]] = 1;
		else dd[dat[i]]++;
		if (dd[dat[i]] > ma)ma = dd[dat[i]];
	}
	set<string> ans;
	ff(i, 0, n) {
		if (dd[dat[i]] == ma) {
			ans.insert(dat[i]);
		}
	}
	srt(dat);
	ff(i, 0, n) {
		if (ans.count(dat[i])) {
          if(i==0){
			cout << dat[i] << endl;
          }
          if(i>0){
            if(dat[i]!=dat[i-1])cout << dat[i] << endl;
          }
        }
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long llu;

int main(int argc, char *argv[]) {
  ll A, B;
  cin >> A >> B;
  
  ll n = max(A, B);
  for (ll i = 0; i < n; ++i) {
    if (abs(A - i) == abs(B - i)) {
      cout << i << endl;
      return 0;
    }
  }

  cout << "IMPOSSIBLE" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <numeric>
#include <cassert>
#include <functional>
using namespace std;

typedef unsigned long long int llui;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
constexpr double pi = 3.141592653589793238462643383279502884L;

// TODO: Mod class

const int sz = 1e5;

int main() {
  ios::sync_with_stdio(false);
  string a;
  cin >> a;

  bool all = false;
  for (int i = 1; i < a.size(); ++i) {
    if (all) {
      a[i] = '9';
      continue;
    }
    if (a[i] != '9') {
      --a[i - 1];
      a[i] = '9';
      all = true;
    }
  }

  int sum = 0;
  for (int i = 0; i < a.size(); ++i) {
    sum += a[i] - '0';
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
N, K = map( int, input().split() )

l = [0] * N
for _ in range(K):
  d = input()
  lists = map( int, input().split() )
  for j in lists:
    l[j-1] += 1
cnt = 0
for i in l:
  if i == 0:
    cnt += 1
print( cnt )

Measured memory_bytes: 9184
N = int(input())
p = [[None] for i in range(N)]

for i in range(N):
    p[i] = list(map(int, input().split()))

p.sort()
#print(p)

INFINITE = 5 * 10**9
maxUp = {}
minDown = {}

for i in range(1, N):
    maxUp[i] = max(maxUp.get(i-1, -INFINITE), p[i-1][1] - p[i-1][0])
for i in range(1, N):
    minDown[i] = min(minDown.get(i-1, INFINITE), p[i-1][0] + p[i-1][1])

#print(maxUp)
#print(minDown)

ans = -INFINITE
for i in range(1, N):
    ans = max(ans, 
        p[i][0] - p[i][1] + maxUp.get(i, -INFINITE)
    )
    ans = max(ans, 
        p[i][0] + p[i][1] - minDown.get(i, INFINITE)
    )
print(ans)

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

using namespace std;

int main(void)
{
    double pi = (double)3.14159265359;
    double a,b,x;
    cin >>a>>b>>x;

    double result;

    if(x> a*a*b/2){
        double v = a*a*b - x;
        result = atan((double)2*v/a/a/a);
    }
    else{
        result = atan((double)2*x/b/b/a);
        result = pi/2 - result;
    }
  
    result = 180/pi * result;
    cout <<setprecision(11)<<result<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int x; cin >> x;
	cout << ( x < 1200 ? "ABC" : "ARC" ) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;
const int INF = 1e18;

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int k;
    cin >> k;

    int notone = INF;
    rep(i, s.size())
    {
        if (s[i] != '1')
        {
            notone = i;
            break;
        }
    }

    if (notone == INF)
    {
        cout << 1 << endl;
    }
    else
    {
        if (k - 1 < notone)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << s[notone] << endl;
        }
    }
}

signed main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256