akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    char[] s, t;
    int[] as, bs;
    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        Scanner s = new Scanner(System.in);
        this.s = s.nextLine().toCharArray();
        this.t = s.nextLine().toCharArray();
        as = new int[26];
        bs = new int[26];
    }

    private void solve() {
        Arrays.fill(as, -1);
        Arrays.fill(bs, -1);

        boolean check = itr(s, as, t) && itr(t, bs, s);
        if (check)
            System.out.println("Yes");
        else
            System.out.println("No");
    }

    private boolean itr(char[] src, int[] trg, char[] cmp) {
        boolean res = true;
        for (int i = 0; i < src.length; i++) {
            int ix = src[i] - 'a';
            if (trg[ix] < 0)
                trg[ix] = cmp[i];
            else
                res &= trg[ix] == cmp[i];
        }
        return res;
    }
}


Measured memory_bytes: 32092
#include<iostream>
using namespace std;
int main(){
  int a;
  cin >> a;
  a = a % 10;
  if(a == 3){
    cout << "bon\n";
  }
  else if(a == 0 || a == 1 || a == 6 || a == 8){
    cout << "pon\n";
  }
  else{
    cout << "hon\n";
  }
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(void){
        int a,b,c,count=0;
        scanf("%d %d %d",&a,&b,&c);

        while(a<=b){
                if(c%a==0)
                        count++;

                a++;
        }
        printf("%d\n",count);

        return 0;
}


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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

#define space cout << endl;
#define test_data(data) cout << data << endl;
#define test_comp(var1, var2) cout << var1 << " " << var2 << endl;

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int Y;    // input

  int count_1, count_5, count_10;
  int sum_money;
  bool flag;


  /* Input, Array_Proclamation */
  cin >> N;
  cin >> Y;
  Y /= 1000;


  /* Initialize */
  count_10 = 0;
  count_5  = 0;
  count_1  = 0;
  flag = false;


  /* Calculation */
  for(count_5 = 0; count_5 <= N; count_5++)
  {
    for(count_10 = 0; (count_5 + count_10) <= N; count_10++)
    {

      count_1 = N -( count_10 + count_5 );
      sum_money = count_10*10 + count_5*5 + count_1*1;
      
      if(count_1 >= 0 && sum_money == Y)
      {
        flag = true;
        goto LOOPEND;
      }

    }
  }
  LOOPEND:


  /* Output */
  if(flag == true)
  {
    printf("%d %d %d \n", count_10, count_5, count_1);
  }
  else
  {
    printf("-1 -1 -1\n");
  }
  

  return 0;

}


/* entity */
//  - none -




Measured memory_bytes: 256
//47
#include<iostream>
#include<sstream>
#include<string>
#include<map>
#include<algorithm>
#include<set>

using namespace std;

int main(){
  for(string si;getline(cin,si),si!="";){
    string s;
    do{
      s+=si;
      getline(cin,si);
    }while(si!="");
    string k;
    getline(cin,k);
    cin.ignore();
    map<char,int> m;
    int f=0,l=1<<30;
    int n=0;
    set<long long> st;
    for(int i=0;i<s.size();i++){
      if(k.find(s[i])!=string::npos){
	m[s[i]]=i;
      }
      if(m.size()!=k.size())continue;
      int cl=0,cf=1<<30;
      for(int j=0;j<k.size();j++){
	cl=max(cl,m[k[j]]);
	cf=min(cf,m[k[j]]);
      }
      if(!st.insert((long long)cl<<32|cf).second)continue;
      if(cl-cf<=l-f){
	if(cl-cf<l-f){
	  f=cf;
	  l=cl;
	  n=0;
	}
	n++;
      }
    }
    cout<<n<<endl<<endl;
    if(n){
      string t=s.substr(f,l-f+1);
      for(int i=0;i<t.size();i+=72){
	cout<<t.substr(i,72)<<endl;
      }
      cout<<endl;
    }
  }
  return 0;
}
    

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int h,w;
char mp[1252][1252];
ll dp[1252][1252];

int main(){
  scanf("%d%d",&h,&w);
  REP(i,h)scanf("%s",mp[i]);
  dp[0][0] = 1;
  REP(i,h)REP(j,w){
    if(i+1<h && mp[i+1][j]=='.')(dp[i+1][j] += dp[i][j]) %= MOD;
    if(j+1<w && mp[i][j+1]=='.')(dp[i][j+1] += dp[i][j]) %= MOD;
  }
  printf("%lld\n",dp[h-1][w-1]);
  return 0;
}


Measured memory_bytes: 13824
let f n =
  let rec mkls n' ls sum =
    if n' <= 0 then ls, sum
    else
      let a = (Scanf.scanf "%d " (fun x -> x)) in
      mkls (pred n') (a :: ls) (sum + a)
  in
  let ls, sum = mkls n [] 0 in
  let rec solve tmp ans = function
    | [] | [_] -> ans
    | h :: t ->
      let tmp' = h + tmp in
      let ans' = (sum - tmp') - tmp' |> abs in
      solve tmp' (min ans ans') t
  in
  solve 0 max_int ls

let () = Scanf.scanf "%d\n" f |> Printf.printf "%d\n"

Measured memory_bytes: 7296
#include<iostream>
using namespace std;
int l,r;
int main(){
    cin>>l>>r;
    if(r-l>=2018){cout<<0<<endl;return 0;}
    l%=2019;r%=2019;
    if(l<r){
        int m=2019;
        for(int i=l;i<r;i++)for(int j=l+1;j<=r;j++)m=min(m,i*j%2019);
        cout<<m<<endl;
    }
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int, input().split()))
ap = 0
xp = 0
xcount = 0

for i in range(N):
    a = A[i]
    x = (ap+xp)-a
    if x <= 0:
        xp = 0
    else:
        xp = x
    xcount = xcount + xp
    ap = a
print(xcount)

Measured memory_bytes: 32224
#include<iostream>

using namespace std;
int main(){
	int a, b, c;

	//string S,T;
	c = 0;

	cin >> a >> b;

	b -= 1;
	a -= 1;

	c = b / a;

	if (b % a != 0) {
		c++;
	}
	
	cout << c << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define FOR(i,a,b)  for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR(i,0,n)
using ll = long long;
using namespace std;

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

    int n, k;
    cin >> n;
    cin >> k;

    int ans = 1;
    for(int i=0; i<n; i++){
        if(ans * 2 <= ans + k){
            ans *= 2;
        } else {
            ans += k;
        }
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200)cout<<s;
    else cout<<"red";   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 256
a,b=map(int,input().split())

def calc(x):
      
    a = x%4

    if a == 0:
        return x
    elif a == 1:
        return 1
    elif a == 2:
       return x^1
    else:
        return 0
 
print(calc(b) ^ calc(a-1))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    string t;cin>>t;
    REP(i,SZ(t)){
        if(t[i]=='?')t[i]='D';
    }
    cout<<t<<endl;
}

Measured memory_bytes: 3712
def inpl(): return list(map(int, input().split()))
N = int(input())

A, B = [0]*N, [0]*N
for i in range(N):
    A[i], B[i] = inpl()

T = sorted([(B[i], A[i]) for i in range(N)])

t = 0
for i in range(N):
    b, a = T[i]
    if b < t+a :
        print("No")
        break
    t += a
else:
    print("Yes")

Measured memory_bytes: 69720
#include <cstdio>

int dfs(int n, int k) {
	if (n == 1) return 0;
	return (dfs(n-1,k)+k)%n;
}

int main() {
	int n, m;
	while (scanf("%d%d", &n, &m)) {
		if (n == 0 && m == 0) break;
		printf("%d\n", dfs(n,m)+1);
	}
}

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

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

int n;

int main() {
	cin >> n;
	for (int i = 41; i <= 55555; i += 10) {
		if (isprime(i) == true) {
			if (i != 41) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"math/rand"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	d := intScanner()
	c := intSliceScanner(26)
	s := make([][]int, d)
	for i := 0; i < d; i++ {
		s[i] = intSliceScanner(26)
	}
	best := -mod
	bestSchedule := make([]int, d)
	changeNum := 10
	for x := 0; x < 1; x++ {
		schedule := make([]int, d)
		for i := 0; i < d; i++ {
			schedule[i] = rand.Intn(26)
		}
		score := calcScore(schedule, c, s, d)
		t = float64(score) * 0.5
		for y := 0; y < 120000; y++ {
			changes := make([]int, changeNum)
			pres := make([]int, changeNum)
			for i := 0; i < changeNum; i++ {
				changes[i] = rand.Intn(d)
				pres[i] = schedule[changes[i]]
				schedule[changes[i]] = rand.Intn(26)
			}
			nextScore := calcScore(schedule, c, s, d)
			if prob(score, nextScore) >= math.Abs(rand.Float64()) {
				score = nextScore
			} else {
				for i := 0; i < changeNum; i++ {
					schedule[changes[i]] = pres[i]
				}
			}
			if nextScore >= best {
				best = nextScore
				copy(bestSchedule, schedule)
			}
			t *= 0.999
		}
	}
	for i := 0; i < d; i++ {
		fmt.Println(bestSchedule[i] + 1)
	}
}
func calcScore(schedule []int, c []int, s [][]int, d int) int {
	score := 0
	last := make([]int, 26)
	for i, v := range schedule {
		score += s[i][v]
		for j, _ := range last {
			last[j]++
		}
		last[v] = 0
		for j, v := range last {
			score -= c[j] * v
		}
	}
	return score
}
func prob(before int, after int) float64 {
	if before <= after {
		return 1.0
	}
	return math.Exp((float64(after) - float64(before)) / float64(t))
}


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

int main(){
	int a;
	cin>>a;
	int b[a];
	for(int i=0;i<a;i++) cin>>b[i];
	sort(b,b+a);
	cout<<b[a-1]-b[0]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define f first
#define s second
#define mod 1000000007
using namespace std;
int n, i;
int v[105];
pair<int, int> sol;
int mult(int x, int e){
    if(e == 0){
        return 1;
    }
    else{
        int a = mult(x, e / 2);
        if(e % 2 == 0){
            return a * 1LL * a % mod;
        }
        else{
            return a * 1LL * a % mod * x % mod;
        }
    }
}
pair<int, int> solve(int st, int dr){
    pair<int, int> sol;
    if(st == dr){
        sol.s = 0;
        sol.f = mult(2, v[st]);
        return sol;
    }
    int minim = 1000000000, nr = 0, num = 0, p, aux = 2, i;
    for(i = st; i <= dr; i++){
        minim = min(minim, v[i]);
    }
    for(i = st; i <= dr; i++){
        v[i] -= minim;
    }
    pair<int, int> d[105];
    p = st - 1;
    for(i = st; i <= dr; i++){
        if(v[i] == 0){
            num++;
            if(p != i - 1){
                d[++nr] = solve(p + 1, i - 1);
            }
            p = i;
        }
    }
    if(p != dr){
        d[++nr] = solve(p + 1, dr);
    }
    sol.f = mult(2, minim);
    sol.s = mult(2, num);
    for(i = 1; i <= nr; i++){
        sol.f = sol.f * 1LL * d[i].f % mod;
        sol.s = (2LL * d[i].f + d[i].s) * sol.s % mod;
        aux = aux * 1LL * d[i].f % mod;
    }
    sol.s -= aux;
    if(sol.s < 0){
        sol.s += mod;
    }
    return sol;
}
int main(){
    cin>> n;
    for(i = 1; i <= n; i++){
        cin>> v[i];
    }
    sol = solve(1, n);
    sol.f = (sol.f + sol.s) % mod;
    cout<< sol.f;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int a[100001];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	int ans = 1;
	int now;
	int tmp = 1;
	while(tmp < n && a[0] == a[tmp]) tmp++;
	if(tmp == n){
		cout << 1 << endl;
		return 0;
	}
	if(a[tmp] > a[0]) now = 1;
	else now = -1;
	for(int i = 2; i < n; i++){
		if(a[i] == a[i - 1]) continue;
		if((a[i] < a[i - 1] && now == 1) || (a[i] > a[i - 1] && now == -1)){
			ans++;
			int tmp = i + 1;
			while(tmp < n && a[i] == a[tmp]) tmp++;
			if(tmp == n) break;
			if(a[tmp] > a[i]){
				now = 1;
			} else {
				now = -1;
			}
			i = tmp;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void){
	int w, n;
	int i, j;
	int a[31];
	int b[31][2];

	for(i = 0; i < 31; i++) {
		a[i] = i;
		for(j = 0; j < 2; j++)
			b[i][j] = 0;
	}

	scanf("%d", &w);
	scanf("%d", &n);

	for(i = 0; i < n; i++){
		scanf("%d,%d", &b[i][0], &b[i][1]);
	}

	for(i = 0; i < n; i++){
		j = a[b[i][0]];
		a[b[i][0]] = a[b[i][1]];
		a[b[i][1]] = j;
	}

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

	return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int N; cin >> N;
	vector<int> cs(N - 1), ss(N - 1), fs(N - 1);
	for (int i = 0; i < N - 1; ++i) cin >> cs[i] >> ss[i] >> fs[i];
	for (int s = 0; s < N; ++s)
	{
		int ans = 0;
		for (int i = s; i < N - 1; ++i)
		{
			if (ans / fs[i] < ss[i] / fs[i])
			{
				ans = ss[i] + cs[i];
			}
			else
			{
				if (ans % fs[i] == 0)
				{
					ans = ans + cs[i];
				}
				else
				{
					ans = (ans / fs[i] + 1) * fs[i] + cs[i];
				}
			}
		}
		cout << ans << endl;
	}
}

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

int main(){
	long long n,m,v,p;
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	long long arr[n];
	for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
	sort(arr,arr+n);
	//for(int i=0;i<n;i++)printf("%lld ",arr[i]);
	int l=0,r=n-1;
	while(l<r){
		//printf("%d %d\n",l,r);
		int mid=(l+r)/2;
		if(arr[mid]>=arr[n-p])r=mid;
		else{
			if(arr[mid]+m<arr[n-p])l=mid+1;
			else{
				long long x=arr[mid]+m;
				long long curv=m*(v-p);
				//printf("%lld\n",curv);
				for(int i=0;i<mid;i++){
					curv-=m;
				//	printf("%lld a\n",curv);
				}
				for(int i=mid+1;i<=n-p;i++){
					curv-=x-arr[i];
				//	printf("%lld b\n",curv);
				}
				//printf("%lld %lld\n",x,curv);
				if(curv<=0)r=mid;
				else l=mid+1;
			}
		}
	}
	printf("%lld",n-l);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int N,K;
string s;

void input() {
  cin >>N >>K;
  cin >>s;
}

int main() {
  input();
  if (N == 1){
    cout <<0 <<endl; return 0;
  }

  char c; // 1文字目のchar
  vector<bool> change(N, false);

  rep(i, N){
    if (i == 0){
      c = s[i]; continue;
    }
    if (s[i] == c) continue;
    if (s[i] != c){
      if (s[i-1] == c) K--;
      if (K < 0) break;
      change[i] = true;
    }
  }
  rep(i, N) if (change[i]) s[i] = c;
  // cout <<s <<endl;

  int res = 0;
  rep(i, N){
    if (i == 0){
      if (s[0] == 'R' && s[1] == 'R') res++;
    }else if (i == N-1){
      if (s[i] == 'L' && s[i-1] == 'L') res++;
    }else{
      if (s[i] == 'L') if (s[i-1] == 'L') res++;
      if (s[i] == 'R') if (s[i+1] == 'R') res++;
    }
  }
  cout <<res <<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;



int main() {
	int n,m;
	cin>>n>>m;
	int dp[101][101]={};
	for(int i=0;i<101;++i){
		for(int j=0;j<101;++j){
			dp[i][j]=2000001;
		}
	}
	int a,b,c;
	int total=0;
	P2 d[1001];
	for(int i=0;i<m;++i){
		cin>>a>>b>>c;
		d[i]=P2(c,P(a,b));
		dp[a][b]=c;
		dp[b][a]=c;
	}
	for(int i=1;i<n+1;++i){
		for(int j=1;j<n+1;++j){
			for(int k=1;k<n+1;++k){
				dp[j][k]=min(dp[j][k],dp[j][i]+dp[i][k]);
			}
		}
	}
	for(int i=0;i<m;++i){
		c=d[i].first;
		a=d[i].second.first;
		b=d[i].second.second;
		if(dp[a][b]>=c){
			total++;
		}
	}
	cout<<m-total<<endl;
	return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]))cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = n - 1; i >= 0; i--)
		cout << a[i] << (i == 0 ? '\n' : ' ');
}


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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
// get decimal pert of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 998244353;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
/*string sentence = "And I feel fine...";
    istringstream iss(sentence);
*/  

double eps = .000000001;


int main ()
{
  prep();
  int n;
  cin >> n;
  int arr[n];
  int pref[n];
  int suf[n];
  for (int i=0; i<n; i++){
      cin >> arr[i];
  }
  pref[0] = arr[0];
  for (int i=1; i<n; i++){
      pref[i] = max(pref[i-1], arr[i]);
  }
  suf[n-1] = arr[n-1];
  for (int i=n-2; i>=0; i--){
      suf[i] = max(suf[i+1], arr[i]);
  }
  for (int i=0; i<n; i++){
      if (i == 0){
          cout << suf[i+1] << '\n';
      }else if (i == n-1){
          cout << pref[i-1] << '\n';
      }else{
          cout << max(pref[i-1], suf[i+1]) << '\n';
      }
  }
  return 0; 
}


Measured memory_bytes: 3968
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

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

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

class B2 {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll w,h,n;in>>w>>h>>n;
        vector<vector<bool >> vv(h,vector<bool> (w,0));
        rep(i,n){
            ll x,y,a;in>>x>>y>>a;
            --x;--y;
            if(a==1){
                for (int j = 0; j < h; ++j) {
                    for (int k = 0; k <= x; ++k) {
                        vv.at(j).at(k)=1;
                    }
                }
            } else if (a==2){
                for (int j = 0; j < h; ++j) {
                    for (int k = x+1; k < w; ++k) {
                        vv.at(j).at(k)=1;
                    }
                }
            } else if (a==3) {
                for (int j = 0; j <= y; ++j) {
                    for (int k = 0; k < w; ++k) {
                        vv.at(j).at(k)=1;
                    }
                }
            } else {
                for (int j = y+1; j < h; ++j) {
                    for (int k = 0; k < w; ++k) {
                        vv.at(j).at(k)=1;
                    }
                }
            }

        }
        ll cnt=0;
        rep(i,h){
            rep(j,w){
                if(!vv.at(i).at(j)) ++cnt;
            }
        }
        out<<cnt<<endl;
    }
};


int main() {
	B2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
         
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
const int N = 100001; 

int fexp(int a, int b,int m){int ans = 1;while(b){if(b&1)ans=(ans*a)%m; b/=2;a=(a*a)%m;}return ans;}
int inverse(int a, int p){return fexp(a, p-2,p);} 

int fac[2000001];

int nCrModPFermat(int n, int r,int p) { 
    if (r==0) return 1; 
    return (((fac[n]*((((inverse(fac[r],p)%p)*inverse(fac[n-r],p))%p))))%p); 
}
// int nCrModPFermat(int n, int r,int p) 
// { 
//     if (r==0) return 1; 
//     int fac[n+1]; 
//     fac[0] = 1; 
//     for (int i=1 ; i<=n; i++) fac[i] = fac[i-1]*i%p; 
  
//     return (fac[n]*inverse(fac[r],p)%p*inverse(fac[n-r],p)%p)%p; 
// } 

void solve(){
    int n;cin>>n;
    int ans=0;
    int num=n;
    rep(i,1,num){
        n-=3;
        if(n<0)break;
      //  ans+=fexp(i,n,mod);
        ans+=nCrModPFermat(n+i-1,i-1,mod);
        ans=(ans+mod)%mod;
        // ans*=fac[n-1]%mod;
        ans=(ans+mod)%mod;
       // cout<<ans<<endl;
        // ans+=((fac[n+i-1]/(fac[i-1]*fac[n]))%mod);
    }
    cout<<(ans+mod)%mod;
    return;
}
         
signed main(){
        IOS;    
  
        int t=1;
        // cin>>t;
        fac[0] = 1; 
        for (int i=1 ; i<=100001; i++) fac[i] = fac[i-1]*i%mod; 
        rep(i,0,t){
            // cout<<"Case #"<<i+1<<": ";
            solve();
            cout<<"\n";
        }
    //    return 0;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define mem(x,y) for(int i=0;i<x.size()i++){ x[i]=y; }
#define fo(i, l, r)  for((i) = (l); (i) < (r); (i)++)
#define fok(i,r,k)  for((i) = 0; (i) < (r); (i)=i+(k))
#define prnt(a,n)  { for(int i=0;i<n;i++){ cout<<a[i]<<" "; } cout<<endl; } 
#define mp make_pair
#define pb push_back
#define pi pair<int,int> 
#define pll pair<long long,long long>
#define vi vector<int> 
#define vl vector<long long>
#define vpl vector<pair<long long,long long>> 
#define vpi vector<pair<int,int>> 
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define br cout<<endl;
#define io { freopen("input.txt","r",stdin);  freopen("output.txt","w",stdout); }
ll modexpo(ll x,ll y,ll m){    x=x%m;if(y==0){return 1;}if(y%2==0){return modexpo(x*x,y/2,m); }else{    return  (x*modexpo(x*x,y/2,m))%m; }}
const int mod  = 1e9+7;
const int maxn = 1e5 + 10;

string s;int ans = 0; 
int main()
{
fastio; 
cin>>s;
int i,j;
fo(i,0,s.size())
{
    if(s[i]=='-'){ ans--; }
    else ans++;
}
cout<<ans;
return 0;
}
//g++ -g a.cpp -o a.exe

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

using namespace std;
using ll = long long;

int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> v(m);
  int am = 0;
  for (int i = 0; i < m; i++) {
    cin >> v[i];
    am += v[i];
  }
  int ans = n - am;
  if (ans >= 0) {
    cout << ans << endl;
  } else {
    cout << "-1" << endl;
  }
  return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <float.h>

int main(int argc, const char * argv[]) {
    int a, b =0;
    int x, y =0;
    double z = 0;
    scanf("%d %d",&a,&b);
    x = a/b;
    y = a%b;
    z = 1.0*a/b;
    printf("%d %d %.8f\n",x,y,z);
    return 0;
}

Measured memory_bytes: 640
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)]
N = n*(n-1)//2
index = {}
ind = 0
from collections import defaultdict
ns = defaultdict(list)
for i in range(n):
    for j in range(i+1,n):
        index[i,j] = ind
        index[j,i] = ind
        ind += 1
for i in range(n):
    for j in range(n-2):
        u = index[i,a[i][j]]
        v = index[i,a[i][j+1]]
        ns[u].append(v)
### サイクル検出 cycle detection
seen = [False] * N
done = [False] * N
vals = [None] * N
def dfs(u):
    # uからdfs
    seen[u] = True
    ans = 0
    for v in ns[u]:
        if done[v]:
            ans = max(ans, vals[v]+1)
            continue
        elif seen[v]:
            # サイクルを検出
            return 1
        else:
            pos = dfs(v)
            if pos>=0:
                return 1
            ans = max(ans, vals[v]+1)
    done[u] = True
    vals[u] = ans
    return -1
ans = -float("inf")
for u in range(N):
    if seen[u]:
        continue
    pos = dfs(u)
    if pos>=0:
        print(-1)
        break
else:
    print(max(vals)+1)

Measured memory_bytes: 306592
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    ll a;
    string b;
    cin>>a>>b;
    ll ans = a*(ll)(b[0]-'0');
    ll tmp1 = a*(ll)(b[2]-'0')*10;
    ll tmp2 = a*(ll)(b[3]-'0');
    ll tmp = tmp1+tmp2;
    string t = to_string(tmp);
    if(t.size()>2){
        string now = t.substr(0, t.size()-2);
        ans += stol(now);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3692
import copy
N, K = map(int, input().split())
A = list(map(int, input().split()))

money = 10 ** 12

for i in range(2 ** N):
  B = copy.copy(A)
  #print(B)
  count = 0
  money2 = 0
  for j in range(N):
    if ((i >> j) & 1):
      count += 1
      if j != 0:
        x = max(0, max(B[:j]) - B[j] + 1)
        if x != 0:
          B[j] = max(B[:j]) + 1
        money2 += x
        #print(i, j, x, money2, count)
  if count >= K:
    money = min(money, money2)
      
print(money)
      


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int check_digit(ll n){
  int keta=0;
  while(n>0){
    n/=10;
    keta++;
  }
  return keta;
}
int main() {
  ll n;
  cin>>n;
  ll res=(-1);
  for(ll i=1;i<=sqrt(n);i++){
    ll temp;
    if(n%i!=0) continue;
    else {
      temp=max(check_digit(i),check_digit(n/i));
      if(res<0 || res>temp) res=temp;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	int n;
	cin >> n;

	int score = 0;
	int k = 0;
	rep1(i, n) {
		score += i;
		if (score >= n) { k = i;break; }
	}

	rep1(i, k) {
		if (i == score - n)continue;
		cout << i << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
using namespace std;

struct obj 
{
	int l;
	int r;
};

vector<bool> createPrime()
{
	vector<bool> prime(100000, true);
	prime[0] = false;
	prime[1] = false;	

	double sqrtNum = sqrt(100000 * 1.0);
	for (int i = 2; i < sqrtNum; i++)
	{
		if (prime[i] == false)
		{
			continue;
		}

		for (int j = i * i; j < 100000; j+=i)
		{
			prime[j] = false;
		}
	}

	return prime;
}

int main(void) {
	
	int N;
	cin >> N;

	vector<obj> list(N);

	for (int i = 0; i < N; i++)
	{
		cin >> list[i].l >> list[i].r;
	}

	vector<bool> prime = createPrime();

	vector<int> a(100000, 0);
	for (int i = 0; i < 100000; i++)
	{
		if (i % 2 == 0)
		{
			continue;
		}

		if (prime[i] && prime[(i + 1) / 2])
		{
			a[i] = 1;
		}
	}

	vector<int> s(100001, 0);
	for (int i = 0; i < 100000; i++)
	{
		s[i + 1] = s[i] + a[i];
	}

	for (int i = 0; i < N; i++)
	{	
		cout << s[list[i].r + 1] - s[list[i].l] << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
from sys import stdin
#from collections import deque
from math import sqrt
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return [x for x in mi()]
def si(): return stdin.readline()
def dis(x, y, p, q):
    return sqrt((x-p)**2+(y-q)**2)
a=[]
s=0
n=ii()
fn=1
for i in range(1, n+1):
    fn*=i
fn//=2
for _ in range(n):
    x, y=mi()
    a.append([x, y])
for i in range(n-1):
    for j in range(i+1, n):
        s+=dis(a[i][0], a[i][1], a[j][0], a[j][1])
        #print(s)
print(2*s/n)

Measured memory_bytes: 3064
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
int du[5];
int main()
{
	int k=in(),a=in(),b=in();ll now=1;
	if(b-a<=2||k-1<a)return printf("%d\n",k+1),0;
	now=a,k-=a-1;now+=1ll*(b-a)*(k/2);now+=k&1;
	printf("%lld\n",now);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
struct UnionFind{
    vector<int> r;
    UnionFind(int n){
        r = vector<int>(n, -1);
    }

    int root(int x){
        if(r[x] < 0)
            return x;
        return r[x] = root(r[x]);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y)
            return false;
        if(r[x] > r[y])
            swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x){
        return -r[root(x)];
    }
};
int main(){
    int n, m;
    cin >> n >> m;
    UnionFind UF(n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        UF.unite(a, b);
    }
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans = max(ans, UF.size(i));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4032
// WA

package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	robs := make(Robots, n)
	for i := 0; i < n; i++ {
		X, L := int64(nextInt()), int64(nextInt())
		robs[i] = &Robot{l: X - L, r: X + L}
	}
	sort.Sort(robs)

	ans := 0
	end := int64(-1000000001)
	for i := 0; i < n; i++ {
		if end <= robs[i].l {
			end = robs[i].r
			ans++
		}
	}
	puts(ans)
	wt.Flush()
}

type Robot struct {
	l, r int64
}

type Robots []*Robot

func (rs Robots) Len() int {
	return len(rs)
}

func (rs Robots) Less(i, j int) bool {
	return rs[i].r <= rs[j].r
}

func (rs Robots) Swap(i, j int) {
	rs[i], rs[j] = rs[j], rs[i]
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 4736
<?php
while (true) {
    $cards = str_split(trim(fgets(STDIN)));
    if ($cards[0] == '-') {
        break;
    }
    $repeated_time = trim(fgets(STDIN));
    for ($i = 0; $i < $repeated_time; $i++) {
        $target_point = trim(fgets(STDIN));
        $placed_on_top = array_splice($cards, $target_point);
        $cards = array_merge($placed_on_top, $cards);
    }
    echo implode("", $cards) . PHP_EOL;
}


Measured memory_bytes: 9296
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans=0

for bit in range(1 << n):
    judge=True
    for i in range(m):
        cnt=0
        for j in range(1,s[i][0]+1):
            if bit&(1<<s[i][j]-1):
                cnt+=1
        if cnt%2!=p[i]:
            judge=False
    if judge:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/any.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto i:v)output(i);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
//#define sum(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
int main(){
    lint n;
    cin>>n;
    rep(i,n-1){
        repi(j,i+1,n){
            if(j!=i+1)cout<<" ";
            cout<<__builtin_ffsll(j-i);
        }
        cout<<endl;
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i_, __start, __end) for(ll i_=(ll)__start; i_<(ll)__end; i_++)
#define print(_a) cout << _a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");


int main(){
    ll n, a;
    cin >> n >> a;
    if (n%500 <= a){
      print("Yes");
    }else{
      print("No")
    }
   
  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);

        int n = sc.nextInt();
        double[] x = new double[n];
        boolean[] u = new boolean[n];

        double ans = 0;
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextDouble();
            u[i] = (sc.next().equals("JPY")) ? true : false;
            if (u[i]) {
                ans += x[i];
            } else {
                ans += x[i] * 380000.0;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
LL n,dp[1000006],tt,mod=1e9+7;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	dp[n]=n;
	tt=n;
	for(int i=n-1;i>=1;--i) {
		LL add;
		add=n-(n-i)+1;
		if(add==n) --add;
		dp[i]=((n-1)*(n-1)+tt+add+mod-dp[i+2])%mod;
		tt=(tt+dp[i])%mod;
	}
	cout<<dp[1]<<endl;
}

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

#define pi 3.141592654
#define fix(n) cout << fixed << setprecision(n)

#define rep(i,a,b) for(int i=a;i<b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)

#define si(d)  scanf("%d",&d)
#define sll(d) scanf("%lld",&d)
#define pin(d) printf("%d\n",d)
#define pln(d) printf("%lld\n",d)
#define nl 	   printf("\n")

#define ll long long
#define ull unsigned long long

#define mp make_pair
#define pb push_back
#define fi first
#define se second

#define chalne_de continue
int mod=1000000007;
const int N = 1000005;

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n , m ;
	cin >> n >> m ;
	int cnt[n+1];
	memset(cnt,0,sizeof(cnt));
	int flag = 0;
	for ( int i =0; i < m ; i++)
	{
		int x , y ;
		cin >> x >> y ;
		cnt[x]++;
		cnt[y]++;
	}
	for ( int i = 1 ; i <= n ; i++)
	{
		if ( cnt[i] %2 != 0)
		{
			flag = 1;
			break;
		}
	}
	if ( flag)
		cout << "NO";
	else
		cout << "YES";
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void){
	int x = 0, h1 = 0, h2 = 0, h;
	scanf("%d", &x);
	
	h1 += x / 500;
	h1 *= 1000;
	//printf("%d\n", h1);
	h2 += (x - h1 / 2) / 5;
	h2 *= 5;
	//printf("%d\n", h2);
	h = h1 + h2;
	printf("%d", h);
	
	return 0;
}


Measured memory_bytes: 128
#include <vector>

template<typename T>
struct edge {
    int to; T cost;
    edge (int to, T cost = 1) : to(to), cost(cost) { }
    bool operator< (const edge &r) const { return (cost < r.cost); }
};

template<typename T>
using graph = std::vector<std::vector<edge<T>>>;

#include <vector>
#include <queue>
#include <functional>
#include <tuple>

template <typename T>
std::vector<T> dijkstra(const graph<T> &g, int s){
    using P = std::pair<T, int>;
    std::vector<T> ret(g.size(), -1);
    std::priority_queue<P, std::vector<P>, std::greater<P>> que;
    que.emplace(ret[s], s); ret[s] = 0;
    while (not que.empty()) {
        int v; T c;
        std::tie(c, v) = que.top();
        que.pop();
        if (ret[v] < c) continue;
        for (const auto &e : g[v]) {
            if (ret[e.to] > ret[v] + e.cost or ret[e.to] == -1) {
                ret[e.to] = ret[v] + e.cost;
                que.emplace(ret[e.to], e.to);
            }
        }
    }
    return ret;
}

#include <iostream>

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

    graph<long long> g(n);
    for (int i = 0; i < m; i++) {
        int src, dst;
        long long cst;
        std::cin >> src >> dst >> cst;
        g[src].emplace_back(dst, cst);
    }

    for (long long cst : dijkstra(g, r)) {
        if (cst == -1) std::cout << "INF" << '\n';
        else std::cout << cst << '\n';
    }

    return 0;
}


Measured memory_bytes: 19348
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
        t: String,
        mut a: isize,
        mut b: isize,
        u: String,
    }
    if s == u {
        a -= 1;
    }
    if t == u {
        b -= 1;
    }
    println!("{} {}", a, b);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define MAXN 200005
using namespace std;
int a[MAXN],b[MAXN];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    if(n%2==0)
    {
        for(int i=0;i<n;i+=2)
        {
            b[i/2]=a[n-i-1];
            b[i/2+n/2]=a[i];
        }
    }
    else
    {
        for(int i=0;i<n;i+=2)
        {
            b[i/2]=a[n-i-1];
            if(i<n-1)
            b[i/2+n/2+1]=a[i+1];
        }
    }
    cout<<b[0];
    for(int i=1;i<n;i++)
        cout<<' '<<b[i];
    return 0;
}


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

int main() {
	int h, w;
	cin >> h >> w;
	int c[10][10];
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int a;
			cin >> a;
			if (a == -1) {
				continue;
			}
			ans += c[a][1];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	inc(i, n) { cin >> p[i]; }
	
	int c = n + 1, ans = 0;
	inc(i, n) { if(setmin(c, p[i])) { ans++; } }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024