akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define MAX 9

int main(int argc, char *argv[]) {

    int i = 0, j = 0;

    for(i=0; i<MAX; i++) {
        for(j=0; j<MAX; j++) {
            printf("%dx%d=%d\n", i+1, j+1, (i+1)*(j+1));
        }
    }

    return 0;

}

Measured memory_bytes: 524
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll H,W,K;
string c[10];
int main(){
    cin>>H>>W>>K;
    ll ans=0;
    for(ll i=0;i<H;i++) cin>>c[i];
    for(ll hState=0;hState<(1<<H);hState++){
        for(ll wState=0;wState<(1<<W);wState++){
            ll cnt=0;
            for(ll i=0;i<H;i++){
                for(ll j=0;j<W;j++){
                    if(hState & (1<<i))continue;
                    if(wState & (1<<j))continue;
                    if(c[i][j]=='#')cnt++;
                }
            }
            if(cnt==K)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

H,W = map(int,input().split())
A = list(list(input()) for _ in range(H))
dirc = [(0,1),(1,0),(0,-1),(-1,0)]
q = deque()
for i in range(H):
    for j in range(W):
        if A[i][j] =="#":
            A[i][j] = 0
            q.append((i,j))
ans = 0
while q:
    y,x = q.popleft()
    for dy,dx in dirc:
        if 0<=dy+y<H and 0<=dx+x<W and A[dy+y][dx+x]==".":
            A[dy+y][dx+x] = A[y][x]+1
            ans = max(ans,A[dy+y][dx+x])
            q.append((dy+y,dx+x))

print(ans)

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

typedef pair<int, int> P;

int main() {

    ll n,k,q;
    cin >> n >> k >> q;

    vector<ll> p(n,0);
    vector<ll> A(q);
    rep(i,q){
        cin >> A[i];
        A[i]--;
    }
    rep(i,q){
        p[A[i]]++;
    }
    rep(i,n){
        if(p[i]-q+k>0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

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

int main() {
  int h, w;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      break;
    }
    int i, j;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3116
#!/usr/bin/python3

from bisect import bisect_left, bisect_right


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    B = sorted(list(map(int, input().split())))
    C = sorted(list(map(int, input().split())))

    res = 0
    for b in B:
        res += bisect_left(A, b) * (N - bisect_right(C, b))

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 22720
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		String line1 = scanner.nextLine();
		String line2 = scanner.nextLine();
		scanner.close();
		String diff = line2.substring(0, line2.length() - 1);
		if (line1.equals(diff)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35772
// D - ModSum

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

	ll ans = 0;
	for (int i=1; i<=N-1; i++) {
		ans += i;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
using namespace std;
vector<unsigned int> p,j;
unsigned int f(unsigned int,int,unsigned int,bool);
int main(void)
{
	int n;
	unsigned int money,l=0;
	deque<int> deque;

	while(1){
		cin >> n;
		if(n==0) break;
		p.resize(n);
		j.resize(n-1);
		for(int i=0;i<n;i++){
			cin >> p[i];
			l+=p[i];
		}
		for(int i=0;i<n-1;i++) cin >> j[i];
		for(int i=0;i<n-1;i++) deque.push_back(j[i]);
		sort(deque.begin(),deque.end());
		for(int i=0;i<n-1;i++){
			if(1<=i) j[i]=deque[n-i-2]+j[i-1];
			else j[i]=deque[n-i-2];
		}
		deque.clear();
		money=l*n;
		for(int jn=0;jn<n-1;jn++) money=max(money,(l+j[jn])*(unsigned int)(n-jn-1));

		cout << money << endl;
		p.clear();
		j.clear();
		l=0;
	}
	return 0;
}

Measured memory_bytes: 2004
#include <bits/stdc++.h>
using namespace std;
int main() {
 string a;
 cin >> a;
  int c = 1;
  int b = a.size();
 for(int i=0;i<b;i++){
   if(a.at(i)!=a.at(b-i-1))c=0;
}
   for(int i=0;i<(b-1)/2;i++){
   if(a.at(i)!=a.at((b-1)/2-i-1))c=0;
}

   for(int i = (b+3)/2;i<b;i++){
   if(a.at(i)!=a.at(b-i-1))c=0;
}
  if(c==1)cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

ll dp[101010][3] = {0};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<char> op(n);
  ll INF = 1LL << 50;
  op[0] = '+';
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i < n - 1)
      cin >> op[i + 1];
  }
  for (int i = 0; i <= n; i++) dp[i][0] = dp[i][1] = dp[i][2] = -INF;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    if (op[i] == '+') {
      dp[i + 1][0] = max(a[i] + dp[i][0], max(a[i] + dp[i][1], a[i] + dp[i][2]));
      dp[i + 1][1] = max(-a[i] + dp[i][1], -a[i] + dp[i][2]);
      dp[i + 1][2] = a[i] + dp[i][2];
    } else {
      dp[i + 1][0] = max(-a[i] + dp[i][0], max(-a[i] + dp[i][1], -a[i] + dp[i][2]));
      dp[i + 1][1] = max(-a[i] + dp[i][0], max(a[i] + dp[i][1], a[i] + dp[i][2]));
      dp[i + 1][2] = max(a[i] + dp[i][1], a[i] + dp[i][2]);
    }
  }

  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
  return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n,greater<>());
  int ans=0;
  rep(i,0,k) ans+=a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
#(x,y,h)
r=sorted([list(map(int,input().split()))[::-1] for _ in range(n)])[::-1]

for i in range(101):
  for j in range(101):
    h1=r[0][0]+abs(r[0][1]-i)+abs(r[0][2]-j)
    flag=0
    for item in r[1:]:
      if item[0]>0:
        if item[0]+abs(item[1]-i)+abs(item[2]-j)!=h1:
          flag=1
          break
      else:
        if h1-abs(item[1]-i)-abs(item[2]-j)>0:
          flag=1
          break
    if flag==0:
      print(j,i,h1)
      exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define All(x) (x).begin(), (x).end()
#define lowbit(x) ((x) & -(x))
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const ll mod = 1e9 + 7;
const int N = 4e6 + 10;
const db pi = acos(-1);
//int a[N];
int main()
{
	int n = read();
	vi a(n);
	rep0(i, n) a[i] = read();
	int q = read();
	while(q --)
	{
		int x = read();
		int y = read();
		int z = read();
		rotate(a.begin() + x, a.begin() + y, a.begin() + z);
	} 
	rep0(i, n)
	{
		if(i) cout << " ";
		cout << a[i];
	}
	puts("");
	return 0;
}



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

// #include "debug.h"
#define debug(...) 42


using ll = long long;

const int N = 1e5 + 5;
int ans[N];

void pre() {
   vector <bool> isPrime(N, true);

   isPrime[0] = isPrime[1] = false;
   for(int i = 2; i < N; i++) {
      if(isPrime[i] == true) {
         for(int j = i + i; j < N; j += i) {
            isPrime[j] = false;
         }
      }
   }
   for(int i = 3; i < N; i++) {
      if(isPrime[i] && isPrime[(i + 1) / 2]) {
         ans[i] = 1;
      }
      ans[i] += ans[i - 1];
   }
}
void solve() {
   int l, r;
   cin >> l >> r;
   cout << ans[r] - ans[l - 1] << endl;
} 

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   pre();
   int testcase = 1;
   cin >> testcase;

   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    string s, t;
    cin >> s >> t;
    bool ok = 0;
    forn(i, sz(t)) {
        char last = t[sz(t) - 1];
        t.erase(t.end() - 1);
        t = last + t;
        if (s == t) {
            ok = 1;
            break;
        }
    }
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int wa = a + b + c;
  if (wa >= 22){
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
}



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

n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1)) + 1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    
    if arr ==[]:
        arr.append([n, 1])
    
    return arr

from collections import defaultdict

d = defaultdict(int)

for i in range(2, n + 1):
    arr = factorization(i)
    for j in arr:
        d[j[0]] += j[1]
v = d.values()

from collections import Counter

c = Counter(v)
li = [0]*5

for i in c.keys():
    if i >= 2:
        li[0] += c[i] # 2
    if i >= 4:
        li[1] += c[i] # 4
    if i >= 14:
        li[2] += c[i] # 14
    if i >= 24:
        li[3] += c[i] # 24
    if i >= 74:
        li[4] += c[i] # 74

ans = 0
ans += li[1] * (li[1] - 1) // 2 * (li[0] - 2)
ans += li[2] * (li[1] - 1)
ans += li[3] * (li[0] - 1)
ans += li[4]

print(ans)

Measured memory_bytes: 38384
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = B[:] + [0]

for i in range(N)[::-1]:
    remain = A[i + 1] - ans[i + 1]
    if remain > 0:
        ans[i], ans[i + 1] = max(0, ans[i] - remain), min(ans[i + 1] + ans[i], A[i + 1])
    else:
        ans[i + 1] = A[i + 1]
        
if A[0] < ans[0]:
    ans[0] = A[0]
    
print(sum(ans))



Measured memory_bytes: 18476
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
main()
{
	fast();
	int r;
	cin>>r;
	double ar=2*acos(-1.0)*r;
	cout<<ar<<endl;	
}





Measured memory_bytes: 3804
IDENTIFICATION DIVISION.
 PROGRAM-ID. TEST149.

 DATA DIVISION.
 WORKING-STORAGE SECTION.

  01 INP  PIC X(300).
  01 S    PIC X(100).
  01 T    PIC X(100).
  01 ANS  PIC X(200).

 PROCEDURE DIVISION.
 
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO S T.

  STRING T S DELIMITED BY ALL ' '
      INTO ANS.

  DISPLAY ANS.

 STOP RUN.

Measured memory_bytes: 636
using System;
using System.Collections.Generic;
namespace alds18b
{
    class node{
        public int key;
        public node parent;
        public node left;
        public node right;

        public node(int key)
        {
            this.key = key;
        }
        public void writein()
        {
            if (left != null) left.writein();
            Console.Write(" ");
            Console.Write(key);
            if (right != null) right.writein();
        }
        public void writepre()
        {
            Console.Write(" ");
            Console.Write(key);
            if (left != null) left.writepre();
            if (right != null) right.writepre();
        }


    }
    class main
    {
        static void Main()
        {
            node root = null; ;
            int no = int.Parse(Console.ReadLine());
            for (int i = 0; i < no; i++)
            {
                string[] oder = Console.ReadLine().Split(' ');
                if (oder[0] == "insert")
                {
                    node x = root;
                    node y = null;
                    node z = new node(int.Parse(oder[1]));
                    while (x != null)
                    {
                        y = x;
                        if (z.key < x.key)
                            x = x.left;
                        else x = x.right;
                    }
                    z.parent = y;
                    if (y == null)
                    {
                        root = z;
                    }
                    else
                    {
                        if (z.key < y.key) y.left = z;
                        else y.right = z;
                    }
                }
                else if (oder[0] == "find")
                {
                    int target = int.Parse(oder[1]);
                    node cur = root;
                    while (true)
                    {
                        if (cur.key == target)
                        {
                            Console.WriteLine("yes");
                            break;
                        }
                        else if (cur.key > target)
                        {
                            cur = cur.left;
                        }
                        else
                        {
                            cur = cur.right;
                        }
                        if (cur == null)
                        {
                            Console.WriteLine("no");
                            break;
                        }

                    }
                }
                else
                {
                    root.writein();
                    Console.WriteLine();
                    root.writepre();
                    Console.WriteLine();
                }
            }
        }
    }
}

Measured memory_bytes: 36456
import java.util.Scanner;

public class Main {

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

        int ans = Integer.MAX_VALUE;
        for (int i = 3; i <= s.length(); i++) {
            String subStr = s.substring(i - 3, i);
            int candidate = Integer.parseInt(subStr);
            int candidate2 = Math.abs(candidate - 753);
            if (candidate2 < ans) {
                ans = candidate2;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 23508
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<deque>
#include<sstream>
#include<iomanip>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<list>
#include<cassert>
#include<deque>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<27
#define all(n) n.begin(),n.end()
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef pair<string,int> SI;
typedef long long ll;
typedef unsigned long long ull;
const int d[4] = {-2,-8,+2,+8};

string::size_type zero_finder(string s){
  string::size_type index = s.find("0");
  return index == string::npos?-1:index;
}

inline
bool range_check(string s,int dir,int pos){
  int new_pos = pos+d[dir];
  assert(new_pos%2 == 0);
  assert(pos%2 == 0);
  if(!(0<= new_pos && new_pos <= 14))return false;
  bool pis_top,npis_top;
  if(0<= pos && pos <=6)pis_top = true;
  else if(8<= pos && pos <=14)pis_top = false;
  else assert(false);

  if(0<= new_pos && new_pos <= 6)npis_top = true;
  else if(8<= new_pos && new_pos <= 14)npis_top = false;
  else assert(false);

  if(pis_top != npis_top && (dir == 0 || dir == 2))return false;
  return true;
}

inline
void s_swap(string &s,int a,int b){
  char store = s[a];
  s[a] = s[b];
  s[b] = store;
}

int main(){
  string input;
  map<string,int> ans;

  ans["0 1 2 3 4 5 6 7"] = 0;

  queue<SI> que;

  que.push(SI("0 1 2 3 4 5 6 7",0));

  bool first_time = true;

  while(!que.empty()){
    SI si = que.front(); que.pop();
    if(ans[si.F] != 0 && !first_time)continue;

    ans[si.F] = si.S;
    first_time = false;    
    rep(i,4)
      {
	
	int pos = zero_finder(si.F);
	int n_pos = pos+d[i];

	assert(pos != -1);

	if(!range_check(si.F,i,pos))continue;

	string next_s = si.F;
	s_swap(next_s,pos,n_pos);    
	que.push(SI(next_s,si.S+1));
      }
  }
  
 while(getline(cin,input))
  {
    cout << ans[input] << endl;
  }
  return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;

int N, M;
map<int, PII> Y;
map<int, int> P;

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

  int p, y;
  rep(i, M) {
    cin >> p >> y;
    Y[y] = PII(i + 1, p);
  }

  int c;
  vector<ll> cities(M + 1, 0);
  for (auto &e: Y) {
    tie(c, p) = e.second;
    P[p]++;
    cities[c] = p * 1000000ll + P[p];
  }

  REP(i, 1, M + 1) {
    printf("%012lld\n", cities[i]);
  }
  return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;
int t[111111];
int dp[111111];
const int INF=1010000001;

int main() {
    cin>>n;
    rep(i,n)cin>>t[i];
    int ans=0;
    int r=0;
    rep(i,n)dp[i]=INF;

    for(int i=0;i<n;i++){
        int index=lower_bound(dp,dp+n,t[i])-dp;
        dp[index]=t[i];
    }

    cout<<lower_bound(dp,dp+n,INF)-dp<<endl;
    return 0;
}



Measured memory_bytes: 3896
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
int gcd(int a, int b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = res * a;
      a = a * a;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("ip.txt","r",stdin);
  freopen("op.txt","w",stdout);
  #endif
}

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


int main() 
{ 
    fast_io
    go();
    int n;cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    for0(i,n)
    {
      string s;
      cin>>s;
      if(s=="AC")
        ac++;
      else if(s=="TLE")
        tle++;
      else if(s=="WA")
        wa++;
      else
        re++;
    }
    cout << "AC x " << ac <<"\n";
    cout << "WA x " << wa <<"\n";
    cout << "TLE x " << tle <<"\n";
    cout << "RE x " << re <<"\n";

}

/*!
    You are under no obligation to be the same person you were a minute ago,
    You have the right to grow !
*/




















Measured memory_bytes: 3656
#include<stdio.h>

void trace(int a[], int n){
    int i;
    for(i = 0; i < n;i++){
        if(i>0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
}

void insertionSort(int a[], int n){
    int j,i,v;
    for(i = 1;i<n;i++){
        v = a[i];
        j = i - 1;
        while(j>=0 && a[j] > v){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]= v;
        trace(a,n);
    }
}

int main(){
    int n,i,j;
    int a[100];
    
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%d", &a[i]);
    
    trace(a,n);
    insertionSort(a,n);
    
    return 0;
}


Measured memory_bytes: 2032
#include<iostream>
using namespace std;
#define max 500000
#define infty 2000000000



struct Card{
	char key;
	int value;
};

int partition(Card A[], int p, int r){
	Card x;
	int j = p-1;
	x = A[r];
	for(int i = p; i < r; i++){
		if(A[i].value <= x.value){
			j++;
			swap(A[j], A[i]);
		}
	}
	swap(A[j+1], A[r]);
	return j+1;
}

void q_sort(Card A[], int p, int r){
	int qs;
	if(p < r){
		qs = partition(A, p, r);
		q_sort(A, p, qs-1);
		q_sort(A, qs+1, r);
	}

}

void merge(Card A[], int left, int mid, int right){
	int nl = mid - left;
	int nr = right - mid;
	Card L[nl + 1], R[nr + 1];
	for(int i = 0; i < nl; i++) L[i] = A[left + i];
	for(int i = 0; i < nr; i++) R[i] = A[mid + i];
	L[nl].value = R[nr].value = infty;

	int j = 0, k = 0;
	for(int i = left; i < right; i++){
		if(L[j].value <= R[k].value){
			A[i] = L[j++];
		} 
		else{
			A[i] = R[k++];
		}
	}
}

void mergeSort(Card A[], int left, int right){
	if(left+1 < right){
		int mid = (left + right)/2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int main(void){
	int n, v;
	char k;
	cin >> n;
	Card A[n], B[n];
	for(int i = 0; i < n; i++){
		cin >> k >> v;
		A[i].key = B[i].key = k;
		A[i].value = B[i].value = v;
	}

	q_sort(A, 0, n-1);
	mergeSort(B, 0, n);
	int judge = 1;
	for(int i = 0; i < n; i++){
		if(B[i].key != A[i].key || B[i].value != A[i].value){
			judge = 0;
		}
	}
	if(judge == 1){
		cout << "Stable" << endl;
	}
	else{
		cout << "Not stable" << endl;
	}
	for(int i = 0; i < n; i++){
		cout << A[i].key << ' ' << A[i].value << endl;

	}
	return 0;
}


Measured memory_bytes: 5456
#include<iostream>
#include<stack>
#include<deque>
#include<list>
#define MAX 100002
#define REP(i,n) for(int i=0;i<(n);i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define NULL -1
using namespace std;

list<int> lst[MAX];
//int M[MAX][MAX] = {};
int parent[MAX] = {};
int color[MAX] = {};

//0:root
void func()
{
	int Color[MAX];
	REP(i, MAX)
	{
		Color[i] = WHITE;
		parent[i] = NULL;
	}

	parent[1] = 1;

	stack<int> stk;
	stk.push(1);
	while (!stk.empty())
	{
		int top = stk.top();
		stk.pop();
		for (auto itr : lst[top])
		{
			if (itr == top)continue;
			else
			{
				if (Color[itr] == WHITE)
				{
					stk.push(itr);
					parent[itr] = top;
					Color[itr] = GRAY;
				}
			}
		}
		Color[top] = BLACK;
	}
}
void func2()
{
	int Color[MAX];
	REP(i, MAX)
	{
		Color[i] = WHITE;
	}
	stack<int> stk;
	stk.push(1);
	while (!stk.empty())
	{
		int top = stk.top();
		stk.pop();
		for (auto itr : lst[top])
		{
			if (itr == top)continue;
			else
			{
				if (Color[itr] != BLACK)
				{
					if (color[itr] == GRAY)
					{
						color[itr] = color[top];
						stk.push(itr);
						Color[itr] = GRAY;
					}
					else
					{
						stk.push(itr);
						Color[itr] = GRAY;
					}
				}
			}
		}
		Color[top] = BLACK;
	}
}

int main()
{
	int N;
	cin >> N;
	//7->index1先手黒7後手白
	REP(i, N-1)
	{
		int t1, t2;
		cin >> t1 >> t2;
		lst[t2].push_back(t1);
		lst[t1].push_back(t2);
	}
	REP(i, MAX)
	{
		color[i] = GRAY;
	}

	color[1] = BLACK;
	color[N] = WHITE;

	func();

	deque<int> deq;

	int p = parent[N];
	//cout << N << "->";
	while (true)
	{
		if (p == 1)
		{
		//	cout << p << endl;
			break;
		}
		deq.push_back(p);
		//cout << p << "->";
		p = parent[p];
	}
	/*
	for (auto itr : deq)
	{
		cout << itr << " ";
	}
	cout <<"tes" <<endl;
	*/

	while (true)
	{
		//1
		if (deq.empty())break;
		int back = deq.back();
		deq.pop_back();
		color[back] = BLACK;
		
		//N
		if (deq.empty())break;
		int front = deq.front();
		deq.pop_front();
		color[front] = WHITE;
	}
	func2();
	int S = 0;
	int F = 0;
	REP(i, N+1)
	{
		if (i == 0)continue;
		else
		{
			if (color[i] == BLACK)
			{
				//cout << i << "B" << endl;
				F++;
			 }
			else
			{
				//cout << i << "W" << endl;
				S++;
			}
		}
	}
	if (S >= F)cout << "Snuke" << endl;
	else cout << "Fennec" << endl;
	//cout << "F:S=" << F << ":" << S << endl;
	return 0;
}

Measured memory_bytes: 9600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    deque<int> dq;
    for (int i = 0; i < N; i++) {
        auto it = lower_bound(dq.begin(), dq.end(), A[i]);
        if (it == dq.begin()) {
            dq.push_front(A[i]);
        } else {
            *(it - 1) = A[i];
        }
    }

    cout << dq.size() << endl;

}

































Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
    int price;
    int c;
    int s;
    int i;

    s = 0;
    price = 1;
    for (i = 0; i < 6; i++){
        scanf("%d", &c);
        s += price * c;
        if (i % 2 == 0){
            price *= 5;
        }
        else {
            price *= 2;
        }
    }

    if (s < 1000){
        printf("0\n");
    }
    else {
        printf("1\n");
    }

    return (0);
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    ll A,B;
    cin >> A >> B;
    if((A * B) & 1)cout << "Odd" << endl;
    else cout << "Even" << endl;
}

Measured memory_bytes: 256
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#ifdef PERVEEVM_LOCAL
    #define debug(x) std::cerr << (#x) << ":\t" << (x) << std::endl
#else
    #define debug(x) 238;
#endif

#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define NAME "File"

using ll = long long;
using ld = long double;

#ifdef PERVEEVM_LOCAL
    std::mt19937 rnd(238);
#else
    std::mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const double PI = atan2(0.0, -1.0);
const int INF = 0x3f3f3f3f;
const ll LINF = (ll)2e18;
const int N = 100100;

std::vector<int> g[N];
bool used[N];
std::vector<int> order;
int dp[N];

void topSort(int v) {
    used[v] = true;

    for (auto to : g[v]) {
        if (!used[to]) {
            topSort(to);
        }
    }

    order.push_back(v);
}

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

    while (m--) {
        int from, to;
        scanf("%d%d", &from, &to);

        g[from - 1].push_back(to - 1);
    }

    for (int i = 0; i < n; ++i) {
        if (!used[i]) {
            topSort(i);
        }
    }

    std::reverse(order.begin(), order.end());

    for (auto from : order) {
        for (auto to : g[from]) {
            dp[to] = std::max(dp[to], dp[from] + 1);
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans = std::max(ans, dp[i]);
    }

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

int main(void) {
    // freopen(NAME".in", "r", stdin);
    // freopen(NAME".out", "w", stdout);

    auto start = std::chrono::high_resolution_clock::now();
    run();
    auto end = std::chrono::high_resolution_clock::now();

    #ifdef PERVEEVM_LOCAL
        std::cerr << "Execution time: "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
                  << " ms" << std::endl;
    #endif

    return 0;
}


Measured memory_bytes: 8824
#include <bits/stdc++.h>
using namespace std;
string s1,s2;
int cnt;
int main(){
	cin>>s1>>s2;
	for(int i=0;i<3;i++){
		if(s1[i]==s2[i])
			cnt++; 
	}
	cout<<cnt;
	return 0;
}
/*
模拟只会猜题意
贪心只能过样例
数学上来先打表
DP一般看规律
组合数学靠运气
计算几何瞎暴力
图论强行套模板
数论只会GCD
递归递推伤不起
搜索茫然TLE
分治做得像枚举
暴力枚举数第一
数据结构干瞪眼
怒刷水题找信心
涨姿势也不容易
考试一来全懵逼
*/

 

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n, h = map(int, input().strip().split())
    p = []
    for i in range(n):
        a, b = map(int, input().strip().split())
        p.append((a, 0))
        p.append((b, 1))
    p.sort(reverse=True)
    s = 0
    i = 0
    ans = 0
    while s < h:
        s += p[i][0]
        ans += 1
        if p[i][1] == 1:
            i += 1
        else:
            ans += (h - s + p[i][0]-1) // p[i][0]
            break
    print(ans)
if __name__ == '__main__':
    main()


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

int main(){
    int d,n;
    cin >> d >> n;
    int a=1;
    for(int i=1;i<=d;i++){
        a*=100;
    }
    int m;
    if(n==100){
        m=101*a;
    }else{
         m=n*a;
    }
    cout << m << endl;
}

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

$sum = 0;
for($i=0;$i<$n;++$i) {
  fscanf(STDIN, '%f %s',$money,$str);
  // echo $str;

  if($str == "BTC"){
    $money = $money * 380000;
  }

  $sum += $money;
}

echo $sum;


Measured memory_bytes: 4732
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<=ll(b);++i)
#define ALL(f,x,...) ([&](decltype((x)) xxxx) { return (f)(begin(xxxx), end(xxxx), ## __VA_ARGS__); })(x)
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template <class T> T 
gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T 
lcm(T a, T b){return a * b / gcd(a, b);}
vector<char> 
string_to_vector_char(const string& input){vector<char> out(input.length());rep(i,input.length()){out[i]=input[i];}return out;}
map<char,int> 
count_same_elements(const vector<char>& v){map<char,int>cmap; for_each(v.begin(),v.end(),[&cmap](int x){cmap[x]++;}); return cmap; }
template<class A,class B> vector<B> 
mapf(const vector<A>& v,const function<B(A)>& func){vector<B> v_(v.size());rep(i,v.size()){ v_[i]=func(v[i]); }return v_;}
template<class A,class B> vector<B> 
adjacent_map(const vector<A>& v,const function<B(A,A)>& func){vector<B> v_(v.size()-1);rep(i,v.size()-1){ v_[i]=func(v[i+1],v[i]); }return v_;}
template<class A> bool
all_of(const vector<A>& v){bool flag=true;rep(i,v.size()){ if(v[i]<1){flag=false;}; }return flag;}
template<class A> bool
any_of(const vector<A>& v){bool flag=false;rep(i,v.size()){ if(v[i]>0){flag=true; break;}; }return flag;}
template<class A> bool
none_of(const vector<A>& v){bool flag=true;rep(i,v.size()){ if(v[i]>0){flag=false;}; }return flag;}
template<class T,class U>
void msg_with_compare(T A,T B,U A_greater_B,U A_eq_B,U A_less_B){
    if(A==B){cout<<A_eq_B<<"\n";}else if(A>B){cout<<A_greater_B<<"\n";}else{cout<<A_less_B<<"\n";}}
template<class B,class T>
void msg_with_boolean(B A,T true_msg,T false_msg){cout<< ( A? true_msg:false_msg);}
template<class B,class T>
void msg_with_boolean(B A1,B A2,T both_true_msg,T true_false_msg,T false_true_msg,T both_false_msg){
    if(A1){if(A2){cout<<both_true_msg;}else{cout<<true_false_msg;}
    }else{if(A2){cout<<false_true_msg;}else{cout<<both_false_msg;}}
}
template<class T>
void scan_vector(long long size,vector<T>& vector){
    vector.resize(size);
    for(long long i=0;i<size;++i){
        cin>>vector[i];
    }
}

ll a,b;
vector<ll> v;
string s;
void input(){
    cin>>a>>b;
}
void src(){
    if(b==100){
        cout<<(ll)(pow(100,a))*(b+1);
    }else{
        cout<<(ll)(pow(100,a))*b;
    }
}   

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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

int main()
{
	long long a, b, k;
	cin >> a >> b >> k;

	auto i = a;
	for (; i < a + k; i++)
	{
		if (i > b)
		{
			return 0;
		}
		cout << i << endl;
	}

	if (i < b - k + 1)
	{
		i = b - k + 1;
	}
	for (; i <= b; i++)
	{
		cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
const int MOD = 1e9 + 7;
int n, a[21][21], dp[1 << 21];
int calc(int matched) {
	int i = __builtin_popcount(matched);
	if (i == n) return 1;
	if (dp[matched] != -1) return dp[matched];
	int res = 0;
	for (int j = 0; j < n; j++) {
		if ((matched & (1 << j)) > 0 || a[i][j] == 0) continue;
		res = (res + calc(matched | (1 << j))) % MOD;
	}
	return dp[matched] = res;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
	}
	memset(dp, -1, sizeof(dp));
	int ans = calc(0);
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,M;
  cin>>N>>M;
  vector<int>L(M),R(M);
  for(int i=0;i<M;i++)cin>>L[i]>>R[i];
  for(int i=0;i<M;i++)L[i]--,R[i]--;
  vector<bool>b(N,true);
  int MaxL=0,MinR=N;
  for(int i=0;i<M;i++){
    MaxL=max(MaxL,L[i]);
    MinR=min(MinR,R[i]);
  }
  int ans=max(0,MinR-MaxL+1);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
class Main{
        public static void main(String [] args){
                Scanner in = new Scanner(System.in);
                while(in.hasNext()){
                        int a = in.nextInt();
                        int b = in.nextInt();
                        if(a==0 && b==0){
                                break;
                        }
                        for(int j=0; j<a; j++){
                                for(int k=0; k<b-1; k++){
                                System.out.print("#");
                                }
                                System.out.println("#");
                        }
                                System.out.println("");
                }
        }
}

Measured memory_bytes: 26764
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
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();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

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

  for (int i = 0; i + 1 < s.size(); i++) {
    if (s.substr(i, 2) == "AC") {
      cout << "Yes" << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	int c = n * a;
	if (c > b) cout << b;
	else cout << c;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define re register
#define ll long long
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int main()
{
	int n=gi(),m=gi();
	printf("%d\n",n*(n-1)/2+m*(m-1)/2);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    ll n,a;
    cin>>n>>a;
    if(n%500<=a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n+1);
	for(int i=1;i<=n;++i){
		int A; cin>>A;
		a.at(i)=A;
	}
	vector<bool>v(n+1,false);
	int i=1,ans=0;
	while(i!=2&&v.at(i)==false){
		v.at(i)=true;
		i=a.at(i);
		++ans;
	}
	cout<<(i==2?ans:-1)<<"\n"s;
}

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

int main() {
  int n, k, x;
  int dist = 0;
  
  cin >> n >> k;

  for(int i = 0; i < n; i++) {
    cin >> x;
    dist += (k - x < x ? k - x : x) * 2;
  }

  cout << dist << 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 ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    vector<vector<ll>> one(3,vector<ll>(10,0)),two(3,vector<ll>(10,0)),three(3,vector<ll>(10,0)),four(3,vector<ll>(10,0));
    rep(i,n){
        ll b,f,r,v;
        cin>>b>>f>>r>>v;
        f--; r--;
        switch (b)
        {
        case 1:
            one[f][r]+=v;
            if(one[f][r]<0) one[f][r]=0;
            else if(one[f][r]>9) one[f][r]=9;
            break;
        case 2:
            two[f][r]+=v;
            if(two[f][r]<0) two[f][r]=0;
            else if(two[f][r]>9) two[f][r]=9;
            break;
        case 3:
            three[f][r]+=v;
            if(three[f][r]<0) three[f][r]=0;
            else if(three[f][r]>9) three[f][r]=9;
            break;
        case 4:
            four[f][r]+=v;
            if(four[f][r]<0) four[f][r]=0;
            else if(four[f][r]>9) four[f][r]=9;
            break;
        default:
            break;
        }
    }
    rep(i,3)rep(j,10){
        if(j==0) cout<<" ";
        cout<<one[i][j];
        if(j!=9) cout<<" ";
        else cout<<endl;
    }
    rep(i,20) cout<<"#";
    cout<<endl;

    rep(i,3)rep(j,10){
        if(j==0) cout<<" ";
        cout<<two[i][j];
        if(j!=9) cout<<" ";
        else cout<<endl;
    }
    rep(i,20) cout<<"#";
    cout<<endl;

    rep(i,3)rep(j,10){
        if(j==0) cout<<" ";
        cout<<three[i][j];
        if(j!=9) cout<<" ";
        else cout<<endl;
    }
    rep(i,20) cout<<"#";
    cout<<endl;

    rep(i,3)rep(j,10){
        if(j==0) cout<<" ";
        cout<<four[i][j];
        if(j!=9) cout<<" ";
        else cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3168
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

ll good_mod(ll value, ll base) {
    return (value % base + base) % base;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> init;
    vector<ll> target;
    for (ll i = 0; i < N; i++) {
        ll Ai;
        cin >> Ai;
        init.push_back(Ai);
    }
    for (ll i = 0; i < N; i++) {
        ll Bi;
        cin >> Bi;
        target.push_back(Bi);
    }
    struct NumInfo {
        ll idx;
        ll number;
    };
    auto comp = [](NumInfo lhs, NumInfo rhs){ return lhs.number < rhs.number; };
    priority_queue<NumInfo, vector<NumInfo>, decltype(comp)> queue(comp);
    for (ll i = 0; i < N; i++) {
        if (init[i] > target[i]) {
            cout << -1 << endl;
            return 0;
        } else if (init[i] < target[i]) {
            queue.push(NumInfo{i, target[i]});
        }
    }
    ll cnt = 0;
    while (!queue.empty()) {
        NumInfo info = queue.top();
        queue.pop();
        ll neighbour = target[good_mod(info.idx - 1, N)] + target[good_mod(info.idx + 1, N)];
        if (target[info.idx] - init[info.idx] < neighbour) {
            cout << -1 << endl;
            return 0;
        }
        ll cnt_local = (target[info.idx] - init[info.idx]) / neighbour;
        cnt += cnt_local;
        target[info.idx] -= cnt_local * neighbour;
        if (target[info.idx] > init[info.idx]) {
            queue.push(NumInfo{info.idx, target[info.idx]});
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 9200