akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    ll a[100010];
    vector<ll> pos, neg, z;
    for(int i=0; i<n; i++){
        cin>>a[i];
        if(a[i]>0) pos.push_back(a[i]);
        else if(a[i]<0) neg.push_back(a[i]);
        else z.push_back(0);
    }
    if(z.size()==n){
        cout<<0<<endl;
        for(int i=0; i<n-1; i++){
            cout<<0<<" "<<0<<endl;
        }
        return 0;
    }
    vector<ll> v1, v2;
    if(pos.size()==n){
        sort(pos.begin(), pos.end());
        v2.push_back(pos[0]);
        for(int i=1; i<n; i++) v1.push_back(pos[i]);
    }else if(neg.size()==n){
        sort(neg.begin(), neg.end());
        v1.push_back(neg[n-1]);
        for(int i=0; i<n-1; i++) v2.push_back(neg[i]);
    }else{
        v1=pos, v2=neg;
        if(v1.empty()) v1=z;
        else{
            for(auto x:z) v2.push_back(x);
        }
    }
    vector<ll> ansx, ansy;
    if(v1.size()>=2 && v2.size()>=2){
        ll x=v1[0];
        for(int i=1; i<v2.size(); i++){
            ansx.push_back(x), ansy.push_back(v2[i]);
            x-=v2[i];
        }
        ll x2=v2[0];
        for(int i=1; i<v1.size(); i++){
            ansx.push_back(x2), ansy.push_back(v1[i]);
            x2-=v1[i];
        }
        ansx.push_back(x), ansy.push_back(x2);
    }else if(v1.size()==1){
        ll x=v1[0];
        for(int i=0; i<v2.size(); i++){
            ansx.push_back(x), ansy.push_back(v2[i]);
            x-=v2[i];
        }
    }else{
        ll x2=v2[0];
        for(int i=1; i<v1.size(); i++){
            ansx.push_back(x2), ansy.push_back(v1[i]);
            x2-=v1[i];
        }
        ansx.push_back(v1[0]), ansy.push_back(x2);
    }
    cout<<ansx.back()-ansy.back()<<endl;
    for(int i=0; i<n-1; i++){
        cout<<ansx[i]<<" "<<ansy[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 6772
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#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(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  REP(i, N) cin >> X[i];
  vector<int> Y(N);
  REP(i, N) Y[i] = X[i];
  sort(ALL(Y));
  REP(i, N) {
    if (X[i] < Y[N / 2])
      cout << Y[N / 2] << endl;
    else
      cout << Y[N / 2 - 1] << endl;
  }
  return 0;
}

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

def main():
  h, w = map(int, input().split())
  costs = []
  for _ in range(10):
    costs.append(list(map(int, input().split())))

  for k in range(10):
    for i in range(10):
      for j in range(10):
        if costs[i][j] > costs[i][k] + costs[k][j]:
          costs[i][j] = costs[i][k] + costs[k][j]

  ans = 0
  for _ in range(h):
    alist = map(int, input().split())
    for a in alist:
      if a == -1:
        continue
      ans += costs[a][1]
  print(ans)


if __name__ == '__main__':
  main()


Measured memory_bytes: 40300
class Fib:
    def __init__(self):
        self.FIB = [1, 1]

    def fib(self, n):
        if n < len(self.FIB):
            return self.FIB[n]
        else:
            self.FIB.append(self.fib(n-1) + self.fib(n-2))
            return self.FIB[n]


N = int(input())
f = Fib()
print(f.fib(N))



Measured memory_bytes: 5596
#include<iostream>

using namespace std;

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

int n;
int c[100000];
int oddc, evenc;

int main(){
    cin >> n;

    REP(i, 100000) c[i] = 0;

    REP(i, n){
        int a;
        cin >> a;
        c[a] += 1;
    }

    oddc = 0; evenc = 0;
    REP(i, 100000){
        if(c[i] !=0 && c[i]%2==0){
            evenc += 1;
        } else if (c[i]%2 == 1){
            oddc += 1;
        }
    }

    evenc = (evenc/2) * 2;
    cout << evenc + oddc << endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, D;
  cin >> N >> D;
  vector<int> X(N);
  vector<int> Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i) >> Y.at(i);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (pow(X.at(i), 2) + pow(Y.at(i), 2) <= pow(D, 2)) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;
const ll INF = 1e18;

int main(){
  ll n,m,r;
  cin >> n >> m >> r;

  vector<ll> R(r);
  rep(i,r) {
    cin >> R[i];
    R[i]--;
  }

  vector<vector<ll>> g(n, vector<ll> (n,INF));

  // self roop
  rep(i,n){
    g[i][i] = 0;
   }
  
  rep(i,m){
      ll a, b, c;
      cin >> a >> b >> c;
      a--; b--;
      g[a][b] = c;
      g[b][a] = c;
  }

  // roop start from k?
  rep(k,n){
    rep(i,n){
      rep(j,n){
        g[i][j] = min(g[i][j], g[i][k]+g[k][j]);
      }
    }
  }

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

  ll ans = INF;

  do {
      ll sum = 0;
      rep(i,r-1){
        sum += g[R[i]][R[i+1]];
      }
      ans = min(ans,sum);
    }while(next_permutation(R.begin(), R.end()));
  cout << ans << endl;
}


Measured memory_bytes: 3892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define MOD 1000000007

int main()
{
  int n;
  ll tmp;
  ll min = pow(10, 9);
  ll ans = 0;
  int nega = 1;
  cin >> n;
  rep(i, n) {
    cin >> tmp;
    ans += abs(tmp);
    if (tmp < 0) nega *= -1;
    if (abs(tmp) < min) min = abs(tmp);
  }
  if (nega < 0) ans -= 2 * min;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}


int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll a,b;cin>>a>>b;
  rep(ans, 1000000){
    if(ans * 8 / 100 == a && ans * 10 / 100 == b){
      cout<<ans<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
n,x,m = map(int,input().split())
ans = 0
al = set([x])
for i in range(n):
  ans += x
  x = (x**2)%m
  if x==0:
    break
  if x in al:
    ind = list(al).index(x)
    loop = i-ind+1
    l = list(al)
    ans += sum(l[ind:i+1])*((n-i-1)//loop)
    for j in range((n-i-1)%loop):
      ans += l[ind+j]
    break
  al.add(x)
print(ans)

Measured memory_bytes: 75404
package main

import (
        "bufio"
        "fmt"
        "os"
        "sort"
        "strconv"
)

func main() {
        var n int
        fmt.Scan(&n)
        sc := bufio.NewScanner(os.Stdin)
        sc.Split(bufio.ScanWords)
        as := make([]int, 3*n)
        for i := 0; i < 3*n; i++ {
                sc.Scan()
                as[i], _ = strconv.Atoi(sc.Text())
        }
        sort.Ints(as)
        var sum int
        for i := n; i < 3*n; i += 2 {
                sum += as[i]
        }
        fmt.Printf("%d\n", sum)
}

Measured memory_bytes: 5504
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll H, W;
	std::cin >> H >> W;
	if (H == 1 || W == 1) {
		std::cout << 1 << endl;
		return 0;
	}

	ll tmp = H * W;
	ll ans = tmp / 2;
	if (tmp & 1) {
		ans++;
	}
	std::cout << ans << endl;
	return 0;

}


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

int main(){
    int N, A;
    cin >> N >> A;
    bool divid = false;
    for (int i = 0; i <= A; ++i){
        if ((N - i) % 500 == 0){
            divid = true;
            break;
        }
    }
    if (divid) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
 
int a,b,d,cnt=0;
cin>>a>>b>>d;
for(int i=a;i<=b;i++)
	if(!(i%d))
		cnt++;
	cout<<cnt<<endl;
  return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define ll long long
#define pii pair<int,int>
#define pll pair<long,long> 
#define xmod 1000000007
#define pi 3.14159265358
using namespace std;

int n;
char s[5];
double ans,x;
int main(){
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++){
		scanf("%lf %s",&x,s);
		if (s[0] == 'J')
		ans+=x;
		else
		ans+=(380000)/(1.0/x);
		if (i < n)
		scanf("\n");
	}
	printf("%.10lf\n",ans);
	return 0;
}
//kikkik kik kik

Measured memory_bytes: 256
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math


N,K = map(int,input().split())
S = str(input())

now,cnt = 1,0
Nums = []
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        Nums.append(cnt)
        cnt = 1
        now = 1 - now

if cnt!=0:
    Nums.append(cnt)

if len(Nums)%2==0:
    Nums.append(0)

#累積和
Sums = [0]
tmp = 0
for i in range(len(Nums)):
    tmp += Nums[i]
    Sums.append(tmp)
# print(Nums)
# print(Sums)
ans = 0
Add = 2*K+1
for i in range(len(Sums)):
    if i%2==0:
        left = i
        right = min(i+Add,len(Sums)-1)
        tmp = Sums[right]-Sums[left]
        ans = max(tmp,ans)
print(ans)


Measured memory_bytes: 18116
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);

       while(true){
        int a=sc.nextInt();
        String op=sc.next();
        int b= sc.nextInt();
       

if(op.equals("+")){
System.out.println(a+b);

}else if(op.equals("-")){
System.out.println(a-b);

}else if(op.equals("*")){
System.out.println(a*b);

}else if(op.equals("/")){
System.out.println(a/b);

}else{
    break;
}
       }
       sc.close();
    }

}


Measured memory_bytes: 26396
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "YES";
    private static final String NO = "NO";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));
    }

    private static String solve(String S) {
        if (S.equals("Sunny"))  return "Cloudy";
        if (S.equals("Cloudy")) return "Rainy";

        return "Sunny";
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] A = new int[n][m];
        int[] B = new int[m];
        int[] c = new int[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < m; i++) {
            B[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                c[i] += A[i][j] * B[j];
            }
            System.out.println(c[i]);
        }
        sc.close();
    }
}


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


int N,M;
pair<int,int> a[100000];
int main(){
  while(cin >> N >> M){
    if(N==0 && M==0){
      return 0;
    }
    else{
      for(int i=0; i<N; i++){
	int d,p;
	cin >> d >> p;
	a[i] = make_pair(p,d);
      }
      
      sort(a, a+N);
      reverse(a, a+N);
      
      int S = 0;
      for(int k=0; k<N; k++){
	S += a[k].first*a[k].second;
      }
      for(int l=0; l<N; l++){
	if(M<=0)break;
	int guarded = min(M, a[l].second);
	S -= a[l].first*guarded;
	M -= guarded;
      }
      cout << S << endl;
    }
  }
}

#if 0
????????????????´?????????¢??¨??????????´????, ??????????????????????????????????????????. ???????????¨???????????§???????????¨?????????????????????, ??????????¨?????????£????????£???. ?????????????????§????????????, ??\?????????????????????????????????, ????±??????????????????£???????????????????????????????????§??????.
	      for(int i=0; i<N, i++){
		if(M>=a[i].second){
		  M -= a[i].second;
		}
		else{
		  ...???????????°?????????
		}
	      }
???????????¨??????????´??????¨???????????????????¨???????????????§, ???????????¶?????????????????????, ??¨?????????????????°????????£???. ???????????????1???????????§?????£???.
#endif

Measured memory_bytes: 1944
import bisect
import re
import sys

N, Q = map(int, input().split())
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]

r = re.compile('AC')
a = [x.start() for x in r.finditer(S)]

if a:
    for q in P:
        p1 = bisect.bisect_left(a, q[0] - 1)
        p2 = bisect.bisect_right(a, q[1] - 2)
        print(p2 - p1)
else:
    for q in P:
        print(0)

Measured memory_bytes: 30432
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x ": " << x << endl;

int main() {
	IOS
	cout << fixed << setprecision(6);
	int n;
	cin >> n;
	long double ans = 0;
	for(int i=0; i<n; i++) {
		long double a;
		string s;
		cin >> a;
		cin >> s;
		if(s=="JPY") ans += a;
		if(s=="BTC") {
			a *= 380000;
			ans += a;
		}
	}
	cout << ans;
	return 0;
}


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

int main() {
  ll a, b, k;
  scanf("%lld%lld%lld", &a,&b,&k);
  if (a>k) {
    printf("%lld%*s%lld", a-k,1,"",b);
  }else if(b>(k-a)) {
    printf("%lld%*s%lld", 0,1,"",b-(k-a));
  }else {
    printf("%lld%*s%lld", 0,1,"",0);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<set>
#include<queue>
#define M 1000020
#define inf 0x3f3f3f3f
#define LL long long
#define int long long
const int mod=998244353;
using namespace std;
inline int read(){
	int f=1,x=0;char s=getchar();
	while (!isdigit(s)){if(s=='-')f=-1;s=getchar();}
	while (isdigit(s)){x=(x<<1)+(x<<3)+(s^48),s=getchar();}
	return x*f;
}
int n,a[M],f[M],cnt[M],prime[M],tot,mu[M],is[M],g[M],ans,maxx,inv[M];
inline void init(void){
	mu[1]=1,inv[1]=1;
	for (int i=2;i<=M-10;i++){
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		if (!is[i]) prime[++tot]=i,mu[i]=mod-1;
		for (int j=1;j<=tot&&prime[j]*i<=M-10;j++){
			is[i*prime[j]]=1;
			if (i%prime[j]) mu[i*prime[j]]=mod-mu[i];
			else break;
		}
	}
}
signed main(void){
	n=read();init();
	for (int i=1;i<=n;i++) a[i]=read(),cnt[a[i]]++,maxx=max(maxx,a[i]);
	for (int i=1;i<=maxx;i++){
		for (int j=i;j<=maxx;j+=i) f[i]=(f[i]+cnt[j]*j%mod)%mod;
		f[i]=f[i]*f[i]%mod;
	}
	for (int i=1;i<=maxx;i++){
		for (int j=i;j<=maxx;j+=i)
			g[i]=(g[i]+mu[j/i]*f[j]%mod)%mod;
		ans=(ans+g[i]*inv[i]%mod)%mod;
	}
	for (int i=1;i<=n;i++) ans=(ans-a[i]+mod)%mod;
	printf("%lld",ans*inv[2]%mod);
	return 0;
}

Measured memory_bytes: 52228
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

using usi=unordered_set<int>;
using usp=set<pii>;

int main(){
	int n,m,l,k,a,h;
	while(cin>>n>>m>>l>>k>>a>>h,n){
		int ans=0;
		usi freeze;
		freeze.insert(a);
		freeze.insert(h);
		rep(loop,l){
			int t;
			cin>>t;
			freeze.insert(t);
		}
		vector<usp> fpath(n),path(n);
		rep(loop,k){
			int x,y,t;
			cin>>x>>y>>t;
			fpath[x].insert(make_pair(y,t));
			fpath[y].insert(make_pair(x,t));
		}
		
		auto c=[](vi a, vi b){return a[0]>b[0];};
		priority_queue<vi,vvi,decltype(c)> que(c);
		usp isUsed;
		que.push({0,h,h});
		while(!que.empty()){
			int cost=que.top()[0];
			int town=que.top()[1];
			int prev=que.top()[2];
			que.pop();
			//cout<<cost<<" "<<town<<" "<<prev<<endl;
			if(isUsed.find(minmax(prev,town))!=isUsed.end()){
				continue;
			}
			isUsed.insert(minmax(prev,town));
			if(freeze.find(town)!=freeze.end() and town!=prev){
				path[prev].insert(make_pair(town,cost));
				path[town].insert(make_pair(prev,cost));
				cost=0;
				prev=town;
			}
			for(auto next : fpath[town]){
				if(cost+next.second<=m){
					que.push({cost+next.second, next.first, prev});
				}
			}
		}
		
		map<int,int> answer;
		que.push({0,h,0});
		while(!que.empty()){
			int cost=que.top()[0];
			int town=que.top()[1];
			int used=que.top()[2];
			que.pop();
			if(answer.find(town)!=answer.end()){
				continue;
			}
			answer[town]=cost;
			//cout<<town<<","<<cost<<endl;
			for(auto next:path[town]){
				//cout<<"<"<<next.first<<","<<next.second<<">"<<endl;
				int charge=max(0,used+next.second-m);
				que.push({cost+next.second+charge, next.first, used+next.second-charge});
			}
		}
		//cout<<"==answer======"<<endl;
		if(answer.find(a)==answer.end()){
			cout<<"Help!"<<endl;
		}else{
			cout<<answer[a]<<endl;
		}
		//cout<<"=============="<<endl;
	}
	return 0;
}



Measured memory_bytes: 9012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1000005, P = 1e9 + 7, M = 100001;
//typedef pair<int, int> pii;
//vector <pair<int, int> > v;
//vector <char> v;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    ll ans = 0;
    int cnt_l = 0, cnt_g = 0, t = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == '<'){
            if (!cnt_l){
                for (int j = 0; j < cnt_g; j++){
                    ans += j;
                }
                ans += max(cnt_g - t, 0);
            }
            cnt_l++;
            ans += cnt_l;
            cnt_g = 0;

        }
        else{
            if (cnt_l){
                t = cnt_l;
                cnt_l = 0;
            }
            cnt_g++;
        }
    }
    if (s[s.size() - 1] == '>'){
        for (int j = 0; j < cnt_g; j++){
            ans += j;
        }
        ans += max(cnt_g - t, 0);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1172
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    A = []
    i = 1
    while True:
        if 6**i <= 100000:
            A.append(6**i)
            i += 1
        else:
            break
    A.sort(reverse=True)
    B = []
    i = 1
    while True:
        if 9**i <= 100000:
            B.append(9**i)
            i += 1
        else:
            break
    B.sort(reverse=True)

    ans = float("inf")
    for i in range(N+1):
        n_6, n_9 = i, N-i
        c_6 = 0
        for a in A:
            q, _, = divmod(n_6, a)
            c_6 += q
            n_6 -= a * q
        c_6 += n_6
        c_9 = 0
        for b in B:
            q, _, = divmod(n_9, b)
            c_9 += q
            n_9 -= b * q
        c_9 += n_9
        c = c_6 + c_9
        if c < ans:
            ans = c
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
vector<pair<long long,long long>> prime(long long n){
  vector<pair<long long,long long>> res;
  for(long long p=2;p*p<=n;p++){
    if(n%p!=0) continue;
    int num=0;
    while(n%p==0){
      num++;
      n/=p;
    }
    res.push_back(make_pair(p,num));
  }
  if(n!=1) res.push_back(make_pair(n,1));
  return res;
}

int main(){
  long long N;
  cin>>N;
  auto pf=prime(N);
  long long res=0;
  for(auto p:pf){
    long long e=p.second;
    long long tmp=0,cur=1;
    while(e>=cur) e-=cur++,++tmp;
    res+=tmp;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long
				
int32_t main() {
	fast_cin();  

	int n, k; cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 1e15;
	for (int i = 0; i < n; i++) {
		if (i + k - 1 < n) {
			int temp = abs(a[i + k - 1] - a[i]) + min(abs(a[i]), abs(a[i + k - 1]));
			ans = min(ans, temp);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
l = input().split()
for i in range(len(l)):
    l[i] = int(l[i])
l.sort(reverse = True)
l2 = []
for i in range(n-1):
    l2.append(l[i+1])
s = sum(l2)
if l[0] < s:
    print("Yes")
else:
    print("No")

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

int int_sort( const void * a , const void * b ) {
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

int main(void){
 
  int N,K;
  int H[200000];
  int i,j;
  
  size_t data_cnt;
  
   scanf("%d %d\n",&N,&K);
  
  for(i=0;i<N;i++){
  	
    scanf("%d ",&H[i]);
  
  }
  
  data_cnt =N;
  
  qsort((void*)H, data_cnt , sizeof(H[0]), int_sort );
   
  long long int AAAA=0;
  
  for(i=0;i<N-K;i++){
	AAAA=AAAA+H[i];
  }
  

  printf("%lld\n",AAAA);
  

  
  return 0;
  
}

Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
static const int MAX = 200000;

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


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

using namespace std;

int main() {
  int N; cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) { cin >> v[i]; }
  int best = 123123123;
  for (int i = 0; i <= 100; i++) {
    int cur = 0;
    for (int x : v) {
      cur += (x - i) * (x - i);
    }
    best = min(best, cur);
  }
  cout << best << endl;
  return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
R,S,P=map(int,input().split())
t = input()
r,s,p=t.count('s'),t.count('p'),t.count('r')
ans=r*R+s*S+p*P
count=[1]*k
for i in range(k,n):
  if t[i-k]==t[i]:
    count[i%k]+=1
  else:
    if t[i-k]=='r':
      ans-=(count[i%k]//2)*P
    elif t[i-k]=='s':
      ans-=(count[i%k]//2)*R
    elif t[i-k]=='p':
      ans-=(count[i%k]//2)*S
    count[i%k]=1
for i in range(n-k,n):
  if t[i-k]=='r':
    ans-=(count[(i)%k]//2)*P
  elif t[i-k]=='s':
    ans-=(count[(i)%k]//2)*R
  elif t[i-k]=='p':
    ans-=(count[(i)%k]//2)*S
print(ans)

Measured memory_bytes: 3956
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())

int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    int n;
    cin >> n;
    map<int,int> mp;

    REP(i,n){
        int x;
        cin >> x;
        mp[x] ++;
    }

    bool fl = false;

    for(auto x:mp){
        if(x.second >= 2){
            fl = true;
            break;
        }
    }  
    if(fl){
        cout <<"NO" <<endl;
    }else{
        cout << "YES" <<endl;
    }
}





Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;
 
int main() {
  long double A, B, X, ans;
  long double pi = 3.14159265358979;
  cin >> A >> B >> X;
  if(2 * X <= (A*A*B)){
    long double num = A * B * B / (2 * X);
    ans = atanl(num);
  }
  else{
    long double num = ((A * A * B - X) * 2) / (A * A * A);
    ans = atanl(num);
  }
  ans = (ans *180.0 / pi) ;
  cout << std::fixed << std::setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long ans = 0;
        long tmp = 1;
        while(h > 0) {
            h /= 2;
            ans += tmp;
            tmp *= 2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35724
#include <bits/stdc++.h>     
#define ll long long
#define mk make_pair
#define y1 yyyy
using namespace std;

const int N = 5e4 + 5;
const int mod = 1e9 + 7;

int n, a[N], my[N], ans;
bool b[N * 200];
vector<int> V[2], G[N];

bool find(int x) {
	for (int i = 0; i < G[x].size(); i++) {
		int u = G[x][i];
		if (b[u]) continue; 
		b[u] = 1;
		if (my[u] == -1 || find(my[u])) {
			my[u] = x;
			return 1;
		} 
	}
	return 0;
}

bool check(int x) { 
	if (x <= 2) return 0;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return 0;
	}  
	return 1;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i], b[a[i]] = 1;
	for (int i = 1; i <= 10000001; i++) {
		if (b[i] != b[i - 1]) V[i & 1].push_back(i);
	}
	memset(my, -1, sizeof(my));
	for (int i = 0; i < V[0].size(); i++) {
		for (int j = 0; j < V[1].size(); j++) {
			if (check(abs(V[0][i] - V[1][j]))) 
				G[i].push_back(j);
		}
	}
	for (int i = 0; i < V[0].size(); i++) {
		for (int j = 0; j < V[1].size(); j++) b[j] = 0;
		if (find(i)) ans++;
	}
	cout << ans + (V[0].size() - ans) / 2 * 2 + (V[1].size() - ans) / 2 * 2 + (V[0].size() - ans) % 2 * 3;
}

Measured memory_bytes: 9984
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

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

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n;
    cin >> n;
    n++;
    vector<ll> a(n);
    cin >> a;

    if ((n == 1 && a[0] != 1) || (2 <= n && a[0] != 0)) {
        cout << -1 << endl;
        return 0;
    }

    vector<ll> max_vertex_num(n + 1);
    revrep(i, n) {
        max_vertex_num[i] = max_vertex_num[i + 1] + a[i];
    }

    ll ans = 1;
    ll v = 1;
    repr(i, 1, n) {
        v = min(max_vertex_num[i], (v - a[i - 1]) * 2);
        if (v < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans += v;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4804
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut acc = vec![0; n];
    acc[0] = a[0] as isize;
    for i in 1..n {
        acc[i] = a[i] as isize + acc[i - 1];
    }
    let mut result = INF as isize;
    let mut i = 0;
    let mut j = 2;
    for k in 1..n - 2 {
        while i + 1 < k && (acc[k] - 2 * acc[i + 1]).abs() < (acc[k] - 2 * acc[i]).abs() {
            i += 1;
        }
        let p = acc[i];
        let q = acc[k] - acc[i];
        while j <= k
            || (j + 1 < n
                && (acc[n - 1] - 2 * acc[j + 1] + acc[k]).abs()
                    < (acc[n - 1] - 2 * acc[j] + acc[k]).abs())
        {
            j += 1;
        }
        let r = acc[j] - acc[k];
        let s = acc[n - 1] - acc[j];
        let mut values = vec![p, q, r, s];
        values.sort();
        result = min(result, values[values.len() - 1] - values[0]);
    }
    println!("{}", result);
}


Measured memory_bytes: 6548
n = int(input())
s = list(input())
de_l = []

count = 1
while count != len(s) :
	count = 1
	for i in reversed(range(1,len(s))):
		
		if s[i] == s[i-1]:
			s.pop(i)
		else:
			count +=1


print(len(s))


Measured memory_bytes: 4084
import java.util.*;

public class Main{

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] mountains = new int[10];

for(int i=0; i<10; i++){
mountains[i] = sc.nextInt();
}

Arrays.sort(mountains);
System.out.println(mountains[9]);
System.out.println(mountains[8]);
System.out.println(mountains[7]);
}


}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

bool check(string s) {
    sort(s);
    if(s[0]==s[s.size()-1]) return true;
    return false;
}

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

    int ans = 0;

    char tmp = s[0];
    rep(i,s.size()) {
        if (s[i] != tmp) {
            ans++;
            tmp = s[i];
        }
    }
    P(ans);

    //while(true) {
    //    if(check(s)) {
    //        P(ans);
    //        return 0;
    //    }
    //    if(s[0]=='W') {
    //        rep(i,s.size()) {
    //            if(s[i]=='B') {
    //                s = s.substr(i);
    //                break;
    //            }
    //        }
    //    }
    //    else {
    //        rep(i,s.size()) {
    //            if(s[i]=='W') {
    //                s = s.substr(i);
    //                break;
    //            }
    //        }

    //    }
    //    ans++;
    //}

    return 0;
}



Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanString() string {
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

var sc = newScanner()

func main() {
	n, m := scanInt(), scanInt()
	a := scanInts(n)
	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
		a[i] *= 4 * m
	}

	cnt := 0
	for i := 0; i < n; i++ {
		if a[i] >= sum {
			cnt++
		}
	}

	if cnt >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int a, b;
  scanf("%d %d", &a, &b);
  
  if(a < b)
    printf("a < b\n");
  else if(a > b)
    printf("a > b\n");
  else
    printf("a == b\n");
  return 0;
}



Measured memory_bytes: 2148
#include <stdio.h>
int main () {
  int n, a[100], i, v, j, k;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) {
    scanf("%d", &a[i]);
  }
  for(i = 0 ; i < n ; i++) {
    printf("%d", a[i]);
    if(i != n-1) printf(" ");
  }
  printf("\n");

  for(i = 1 ; i <= n-1 ; i++) {
    v = a[i];
    j = i - 1;
    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;  
    }
    a[j+1] = v;
    for(k = 0 ; k < n ; k++) {
      printf("%d", a[k]);
      if(k != n-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}

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

#define COUT(x) cout << x << endl
#define CIN(x) cin >> x
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define EXIST(s, e) (s.find(e) != s.end())
#define SORT(c) sort(c.begin(), c.end())
#define ERASEUNIQE(v) v.erase(unique(v.begin(), v.end()), v.end())

// conversion
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

// math
template <class T>
inline T sqr(T x) { return x * x; }

// typedef
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

// container util
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()

// constant
const double EPS = 1e-10;
const double PI = acos(-1.0);

// debug
#define dump(x) cerr << #x << " = " << x << endl;
#define debug(x) cerr << #x << " = " << x << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

int main(int argc, char const *argv[])
{
    int a, b, c, ans = 0;
    CIN(a), CIN(b), CIN(c);
    ans = max(ans, 10 * a + b + c);
    ans = max(ans, a + 10 * b + c);
    ans = max(ans, a + b + 10 * c);
    COUT(ans);

    return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> x;
	n%=500;
	if(x >= n) cout<<"Yes\n";
	else cout<<"No\n";	
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}


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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_A

int main() {
	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++) cin >> arr[i];
	
	int count = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = n - 1; j >= i + 1; j--) {
			if (arr[j - 1] > arr[j]) {
				int t = arr[j - 1];
				arr[j - 1] = arr[j];
				arr[j] = t;
				count++;
			}
		}
	}
	
	cout << arr[0];
	for (int i = 1; i < n; i++) cout << " " << arr[i];
	cout << endl;
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1164
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, 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 1; } return 0; }
const int INF = 1000000000;

int main() {
    char alpha;
    cin >> alpha;
    if (isupper(alpha)){
        cout << "A" << endl;
    }
    else cout << "a" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 300011

int n, m, i, x, y;
vector< pair<int, int> > intr;
vector<int> qq[maxN];

ll ans[maxN], sum[maxN];
ll aib[maxN], p;

int zrs(int x) {
    return (x ^ (x - 1)) & x;
}

void add(int pos, int v) {
    while (pos <= m) {
        aib[pos] += v;
        pos += zrs(pos);
    }
}

ll sumi(int pos) {
    ll ans = 0;

    while (pos > 0) {
        ans += aib[pos];
        pos -= zrs(pos);
    }

    return ans;
}

void pre() {
    int i, d, x;

    ans[1] = n;

    for (auto e : intr)
        sum[e.first]++, sum[e.second + 1]--;

    for (i = 1; i <= m; i++) sum[i] += sum[i - 1];

    for (d = 2; d <= m; d++) {
        for (x = d; x <= m; x += d) {
            ans[d] += sum[x];
            if (x != d) qq[x - d].pb(d);
        }
    }
}

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

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i++) {
        scanf("%d%d", &x, &y);
        intr.pb(mp(x, y));
    }

    sort(intr.begin(), intr.end());
    pre();

    p = 0;
    for (i = 1; i <= m; i++) {
        while (p < intr.size()) {
            if (intr[p].first > i) break;
            add(intr[p].second, +1);
            p++;
        }

        for (auto e : qq[i]) {
            ans[e] -= p - sumi(i + e - 1);
        }
    }

    for (i = 1; i <= m; i++)
        printf("%lld\n", ans[i]);



    return 0;
}


Measured memory_bytes: 19948
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int a, b;
  cin >> a >> b;
  cout << max(a - b, 0) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var nm = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        var ans = new long[8];
        var inp = new long[nm[0]][];
        for (int i = 0; i < nm[0]; i++) inp[i] = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        for (int i = 0; i < 8; i++)
        {
            var score = new List<long>();
            for (int j = 0; j < nm[0]; j++)
            {
                long thisScore = 0;
                for (int k = 0; k < 3; k++)
                {
                    if (((i >> k) & 1) == 1) thisScore += inp[j][k];
                    else thisScore -= inp[j][k];
                }
                score.Add(thisScore);
            }
            score = score.OrderByDescending(L => L).ToList();
            long x = 0;
            for (int j = 0; j < nm[1]; j++) x += score[j];
            ans[i] = x;
        }
        Console.WriteLine(ans.Max());
    }
}

Measured memory_bytes: 13664
<?php
fscanf(STDIN, '%d', $n);

$vArr = explode(' ', fgets(STDIN));
$cArr = explode(' ', fgets(STDIN));

$ans = 0;

for ($i = 0;$i < $n;$i++) {
    if (((int)$vArr[$i] <=> (int)$cArr[$i]) < 0) {
        continue;
    }
    $ans += (int) $vArr[$i] - (int)$cArr[$i];
}

echo $ans .PHP_EOL;

Measured memory_bytes: 4728
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
n, a_list = gets_n_and_i_list

count = 0
a_list.each_with_index do |a, i|
  if i.even? && a.odd?
    count += 1
  end
end

puts count

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

int t[10];

int main()
{
  int d, g, p[10], c[10];
  cin >> d >> g;
  for(int i = 0; i < d; i++){
    cin >> p[i] >> c[i];
    t[i] = (i+1)*100*p[i] + c[i];
  }

  int ans = 1e+9;
  for(int i = 0; i < (1<<d); i++){
    int s = 0, cnt = 0, r = -1;
    for(int j = 0; j < d; j++){
      if(i >> j & 1){
        s += t[j];
        cnt += p[j];
      }else{
        r = j;
      }
    }

    if(s < g){
      int ss = (r+1)*100;
      int need = (g - s + ss - 1) / ss;
      if(need >= p[r]) continue;
      cnt += need;
    }

    ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

    cpp_int ans = 1LL;
    for(int i=0; i<N; i++) {
        ans *= A[i];
        if(ans > 1'000'000'000'000'000'000LL) {            
            cout << -1 << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 6440
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<P, null_type, less<P>, rb_tree_tag, tree_order_statistics_node_update>

void end(int n = -1)
{
	cout << n << "\n";
	exit(0);
}
int n, k;
int a[103];
int dp[N];

int fun(int rem)
{
	if (dp[rem])
		return dp[rem];
	for (int i = 1; i <= n; i++)
	{
		if (rem >= a[i])
		{
			if (fun(rem - a[i]) == 2)
			{
				dp[rem] = 1;
				return dp[rem];
			}
		}
	}
	return dp[rem] = 2;
}

int32_t main()
{
	AB_BHI_NI_DEGI
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	dp[0] = 2;
	int x = fun(k);
	if (x == 1)
		cout << "First\n";
	else
		cout << "Second\n";

	return 0;
}

Measured memory_bytes: 4224