akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x); cout<<#x<<"="<<x<<endl;
#define watch2(x,y); cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define endl "\n"
#define int long long
using namespace std;    

int n,a,b,c;
string s[100005];
char ans[100005];
void print(){
    cout<<"Yes"<<endl;
    for(int i=1;i<=n;i++) cout<<ans[i]<<endl;
}
void check(){
    for(int i=1;i<=n;i++){
        if(s[i]=="AB"){
            if(a==1&&b==1&&i!=n&&s[i+1]=="AC"){
                ans[i]='A';
                a++;
                b--;
                continue;
            }
            if(a==1&&b==1&&i!=n&&s[i+1]=="BC"){
                ans[i]='B';
                b++;
                a--;
                continue;
            }
            if(a>b){
                ans[i]='B';
                b++;
                a--;
            }else{
                ans[i]='A';
                a++;
                b--;
            }
        }
        if(s[i]=="AC"){
            if(a==1&&c==1&&i!=n&&s[i+1]=="AB"){
                ans[i]='A';
                a++;
                c--;
                continue;
            }
            if(a==1&&c==1&&i!=n&&s[i+1]=="BC"){
                ans[i]='C';
                c++;
                a--;
                continue;
            }
            if(a>c){
                ans[i]='C';
                c++;
                a--;
            }else{
                ans[i]='A';
                a++;
                c--;
            }
        }
        if(s[i]=="BC"){
            if(b==1&&c==1&&i!=n&&s[i+1]=="AB"){
                ans[i]='B';
                b++;
                c--;
                continue;
            }
            if(b==1&&c==1&&i!=n&&s[i+1]=="AC"){
                ans[i]='C';
                c++;
                b--;
                continue;
            }
            if(b>c){
                ans[i]='C';
                c++;
                b--;
            }else{
                ans[i]='B';
                b++;
                c--;
            }
        }
        if(a<0 || b<0 || c<0){
            cout<<"No"<<endl;
            return ;
        }
    }
    print();
}
int32_t main(){
    cin>>n>>a>>b>>c;
    for(int i=1;i<=n;i++) cin>>s[i];
    check();
    return 0;
}



Measured memory_bytes: 6864
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>

using namespace std;
using llng = long long;
using vi = vector<int>;
using vll = vector<llng>;
using vs = vector<string>;

int main() {
    llng n; cin >> n;
    vll a(n), b(n);
    for (int i=0; i<n; i++) {
        cin >> a[i] >> b[i];
    }
    
    llng ans = 0;
    for (int i=n-1; i>=0; i--) {
        llng tmp = b[i] - ((a[i]+ans) % b[i]);
        if (tmp != b[i]) ans += tmp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1920
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

ll MOD = 1e9 + 7;

vector<ll> fact;

void init_fact(int n) {
    fact = vector<ll>(n);
    fact[0] = 1;
    for (int i = 1; i < n; i++) fact[i] = fact[i - 1] * i % MOD;
}

ll calc_pow(ll x, ll pow) {
    if (pow == 0) return 1;
    ll a = calc_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}

ll calc_div(ll a, ll b) {
    return a * calc_pow(b, MOD - 2) % MOD;
}

ll calc_comb(ll n, ll r) {
    if (n < r || n < 0 || r < 0)return 0;
    return calc_div(fact[n], fact[r] * fact[n - r] % MOD);
}

int main() {
    int n;
    cin >> n;
    n++;

    int fi = -1, se = -1;
    vector<int> v(n, -1);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (v[a] >= 0) fi = v[a], se = i;
        v[a] = i;
    }

    init_fact(300000);
    for (int i = 1; i <= n; i++) {
        ll ret = calc_comb(n, i) - calc_comb(fi + (n - 1 - se), i - 1);
        cout << (ret + MOD) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 3968
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    n = int(ipt())
    sl = []
    for i in range(n):
        si = input()
        si = [1 if i == "1" else 100000 for i in si]
        sl.append(si)

    cm = csr_matrix(sl)
    d = dijkstra(cm,directed=False)
    ma = 0
    for i in range(n):
        for j in range(n):
            if d[i][j] > ma:
                ma = d[i][j]
            if sl[i][j] == 1 and (d[i][0]%2+d[j][0]%2)%2 == 0:
                print(-1)
                exit()
    print(int(ma)+1)

    return None

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    map<int,ll> mp;
    rep(i,n)++mp[a[i]];
    ll res=0;
    for(auto x:mp){
    	res+=x.second*(x.second-1)/2;
    }
    rep(i,n){
    	cout<<res-(mp[a[i]]*(mp[a[i]]-1)/2)+((mp[a[i]]-1)*(mp[a[i]]-2)/2)<<endl;
    }
}

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

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    h = [i for i in map(int, input().split())]

    for i in range(0, n - 1):
        if h[i] < h[i + 1]:
            h[i + 1] -= 1

    ans = False
    for i in range(0, n - 1):
        if h[i] > h[i + 1]:
            ans = True
            break

    if not ans:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 14684
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#include<map>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){

  int n; cin >> n;
  vector<int> l(n); rep(i,n){ cin >> l[i]; }
  
  sort(l.begin(),l.end());
  int ans=0;
  
  rep(i,n){
    for (int j=i+1; j<n; j++){
      for (int k=j+1; k<n; k++){
        if (l[i]+l[j]>l[k]){ans++;}
        else {break;}
      }
    }
  }
  
  cout << ans;
  
  return 0;
}


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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;

        int n;
        cin>>n;
        vector<pll> v;
        for(int i=0;i<n;i++)
        {
            ll a,b;
            cin>>a>>b;
            v.pb({b,a});
        }
        sort(v.begin(),v.end());
        ll t=0;
        string ans="Yes";
        for(auto j : v)
        {   
               t+=j.ss;
               if(t>j.ff)
                ans="No";
        }
        cout<<ans<<endl;
    }

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

int main()
{
    int n;
    long long x, c, d = 0;

    scanf("%d %lld", &n, &x);
    for(int i = 0; i < n; i++)
    {
        scanf("%lld", &c);
        d = __gcd(d, abs(c - x));
    }
    printf("%lld\n", d);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>n; lld a[n]; for(i=0;i<n;i++) cin>>a[i];
        a[0]--;
        for(i=1;i<n;i++)
        {
            if(a[i]<a[i-1])
            {
                flag=true;
                break;
            }
            else
            {
                if(a[i]==a[i-1])
                    continue;
                else
                    a[i]--;
            }
        }
        if(flag)
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;

    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 4392
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,n) for(i=a;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x),greater<int>())
#define pi 3.1415926535897932384626
 
typedef pair<int,int> pii;
typedef pair<ll, ll> pl;
typedef vector<int>	vi;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;
typedef vector<double> vd;
 
 
const int mod = 1000000007;
const int inf = 100000005;
const int N = 200005, M = N;
int i,j,n,m;
 
ll cnt , idx;
 
bool cal(ll n , unordered_map<int,int>mp) {
    for(int i=2;i*i<=n;i++) {
        if(n%i==0) {
            if(mp[i] || mp[n/i]) return 0;
           
        }
    }
    return 1;
}
 
void solve() {
  ll n;
  cin>>n;
 
  vi vec(n);
  unordered_map<int,int>mp;
  
  fo(i,0,n) cin>>vec[i];
  
  sortall(vec);
  fo(i,1,n) {
      if(vec[i] == vec[i-1]) mp[vec[i]] = 1;
  }
 
  ll ans = 0;
  
  fo(i,0,n) {
    if(!mp[vec[i]]) ans++;
    if(i == 0 || vec[i]!=vec[i-1]) {
        for(int j=vec[i];j<=1000005;j+=vec[i]) {
            mp[j] = 1;
        }
    }
    
  }
  cout<<ans<<"\n";
}
 
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }
 
    return 0;
}
 
 

Measured memory_bytes: 43364
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    //↑
    for (size_t i = 0; i < ty - sy; ++i) {
        std::cout << "U";
    }
    //→
    for (size_t i = 0; i < tx - sx; ++i) {
        std::cout << "R";
    }

    //↓
    for (size_t i = 0; i < ty - sy; ++i) {
        std::cout << "D";
    }

    //←
    for (size_t i = 0; i < tx - sx; ++i) {
        std::cout << "L";
    }

    //← 1
    std::cout << "L";

    //↑ +1
    for (size_t i = 0; i < ty - sy; ++i) {
        std::cout << "U";
    }
    std::cout << "U";

    //→ +1
    //↓ 1
    //→ 1
    for (size_t i = 0; i < tx - sx; ++i) {
        std::cout << "R";
    }
    std::cout << "RDR";

    //↓ + 1
    for (size_t i = 0; i < ty - sy; ++i) {
        std::cout << "D";
    }
    std::cout << "D";

    //← +1
    for (size_t i = 0; i < tx - sx; ++i) {
        std::cout << "L";
    }
    std::cout << "L";

    //↑ 1
    std::cout << "U";

    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 256
#AGC016 A
S = input()
ABC = [chr(i) for i in range(ord('a'),ord('z')+1)]
ans = len(S)
for abc in ABC:
    cnt = 0
    max_cnt = 0
    for s in S:
        if s == abc:
            max_cnt = max(max_cnt,cnt)
            cnt = 0
        else:
            cnt += 1
    max_cnt = max(max_cnt,cnt)
    ans = min(ans,max_cnt)
print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a, Ts... ts) {return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v){ t = v; }

template<typename T,typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x, a;
    cin >> x >> a;
    cout << (x < a ? 0 : 10) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m,mas[100005],rez[100005],sum;
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> n;
    i=0;
    while (i<n)
    {
        cin >> mas[i+1];
        if (i>0)
        {
            sum+=abs(mas[i+1]-mas[i]);
        }
        else
        {
            sum=abs(mas[i+1]);
        }
        i++;
    }
    sum+=abs(mas[n]);
    mas[0]=0;
    mas[n+1]=0;
    i=1;
    while (i<=n)
    {
        if ((mas[i]>mas[i-1]&&mas[i]<mas[i+1])||(mas[i]<mas[i-1]&&mas[i]>mas[i+1]))
        {
            rez[i]=0;
        }
        else
        {
            rez[i]=abs(mas[i]-mas[i-1])+abs(mas[i]-mas[i+1])-abs(mas[i-1]-mas[i+1]);
        }
        i++;
    }
    i=1;
    while (i<=n)
    {
        cout << sum-rez[i] << "\n";
        i++;
    }
    return 0;
}


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

A = [B[0]]

for i in range(1, N-1):
    if B[i] >= B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])

A.append(B[-1])

print(sum(A))

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

while True:
    m, f, r = list(map(int, input().split()))
    if m == -1 and f == -1 and r == -1:
        break

    grade = None
    if m < 0 or f < 0:
        grade = "F"
    elif m + f >= 80:
        grade = "A"
    elif m + f >= 65:
        grade = "B" 
    elif m + f >= 50:
        grade = "C"
    elif m + f >= 30:
        grade = "D"
        if r >= 50:
            grade = "C"
    else:
        grade = "F"
    print(grade)


Measured memory_bytes: 5600
N = int(input())
txy = [[0,0,0]]+[list(map(int,input().split())) for _ in range(N)]
for i in range(N):
    t = txy[i+1][0] - txy[i][0]
    move = abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])
    if t < move or (t - move)%2 != 0:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 28068
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  vector<int> v(n); REP(i, n) cin >> v[i];
  vector<vector<long long> > dpl(n + 1, vector<long long>(k + 1, -LINF));
  dpl[0][0] = 0;
  vector<int> tmp;
  REP(i, n) {
    if (v[i] < 0) tmp.emplace_back(v[i]);
    sort(ALL(tmp));
    FOR(j, i + 1, k + 1) {
      dpl[i + 1][j] = 0;
      int cnt = 0;
      for (int l = 0; cnt < j && l <= i; ++l, ++cnt) dpl[i + 1][j] += v[l];
      for (int l = 0; cnt < j && l < tmp.size(); ++l, ++cnt) dpl[i + 1][j] -= tmp[l];
    }
  }
  reverse(ALL(v));
  vector<vector<long long> > dpr(n + 1, vector<long long>(k + 1, -LINF));
  dpr[0][0] = 0;
  tmp.clear();
  REP(i, n) {
    if (v[i] < 0) tmp.emplace_back(v[i]);
    sort(ALL(tmp));
    FOR(j, i + 1, k + 1) {
      dpr[i + 1][j] = 0;
      int cnt = 0;
      for (int l = 0; cnt < j && l <= i; ++l, ++cnt) dpr[i + 1][j] += v[l];
      for (int l = 0; cnt < j && l < tmp.size(); ++l, ++cnt) dpr[i + 1][j] -= tmp[l];
    }
  }
  long long ans = 0;
  REP(i, n + 1) REP(j, k + 1) {
    REP(l, n - i + 1) REP(m, k - j + 1) {
      ans = max(ans, dpl[i][j] + dpr[l][m]);
      // if (dpl[i][j] + dpr[l][m] == 23) cout << i << ' ' << j << '|' << l << ' ' << m << '\n';
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        WriteLine(ar.Sum() - num);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13396
//11
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    long long total[4001]={};
    bool out=false;
    for(int i=0;i<n;i++){
      int id;
      long long t,ns;
      cin>>id>>t>>ns;
      if(total[id]<1000000){
	total[id]+=t*ns;
	if(total[id]>=1000000){
	  cout<<id<<endl;
	  out=true;
	}
      }
    }
    if(!out){
      cout<<"NA"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String args[]) {
            Stack<Integer> stack = new Stack<Integer>();
            int a, b;
            try (Scanner in = new Scanner(System.in)) {
                    while (in.hasNext()) {
                            String input = in.next();
                            if (input.charAt(0) == '+') {
                                    a = stack.pop().intValue();
                                    b = stack.pop().intValue();
                                    stack.push(a + b);
                            } else if(input.charAt(0) == '*'){
                            	a = stack.pop().intValue();
                                b = stack.pop().intValue();
                                stack.push(a * b);
                            } else if(input.charAt(0) == '-'){
                            	a = stack.pop().intValue();
                                b = stack.pop().intValue();
                                stack.push(b - a);
                            } else {
                                    stack.push(Integer.parseInt(input));
                            }
                    }
            }
            System.out.println(stack.peek());
    }
}


Measured memory_bytes: 26196
# -*- coding: utf-8 -*-
n = int(input())  
s = input() 

c = s[0:1]
x = 1

for i in range(1,len(s)):
    # print(i,c,s[i:i+1],x)
    if s[i:i+1] != c:
        x = x + 1
        c = s[i:i+1]
print(x)

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;
#define ll long long
int main(){
    ll n;
    ll tmp;
    set<ll> s;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> tmp;
        if (s.find(tmp)  == s.end()){
            s.insert(tmp);
        }else{ 
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 9600
package main

import (
	"fmt"
	"math"
)

func main() {
	var a,b,c,x,y int
	fmt.Scan(&a,&b,&c,&x,&y)


	m := a * x + b * y
	for i := 1; i < x + y + 1; i++ {
		n := 2*c * i + max(0, x - i) *a +max(0, y -i) * b
		m = min(n, m)
	}
	fmt.Println(m)
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}
func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 1860
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int i;
  i = 0;
  for(int j=0; j<3; j++){
    if(S.at(j) == 'o'){
    i++;
    }
  }
  cout << 700 + i*100 << endl;
}


Measured memory_bytes: 3516
def replaceInt(N, M):
    N = abs(N-M)
    return N
    
N, M = [int(i) for i in input().split()]

if N == M :
    output = 0
elif N < M :
    if N <= M / 2:
        output = N
    else:
        output = abs(M-N)
else :
    if M == 1:
        output = 0
    else :
        N = N % M
        output_candidates = []
        while True:
            N = replaceInt(N,M)
            if N in output_candidates:
                break
            output_candidates.append(N)
        output = min(output_candidates)
        
print(output)


Measured memory_bytes: 3064
#include <iostream>

int rep(int k){
  if(k == 1){
    return 9;
  }else{
    return 1;
  }
}

int main(){
  int n;
  std::cin>>n;

  int a = n / 100;
  int b = (n - 100 * a) / 10;
  int c = n - 100 * a - 10 * b;

  a = rep(a);
  b = rep(b);
  c = rep(c);
  std::cout<<(100 * a + 10 * b + c)<<std::endl;
  return 0;
}

Measured memory_bytes: 768
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t;
map<string, int> x;
map<string, int> y;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

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

ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

int main() {
  fast();
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    ++x[s];
  }
  cin >> m;
  while (m--) {
    string s;
    cin >> s;
    ++y[s];
  }
  map<string, int> pos;
  for (auto s : x) {
    if (y.find(s.f) != y.end())
      pos[s.f] = s.s - y[s.f];
    else
      pos[s.f] = s.s;
  }
  int mx = 0;
  for (auto x : pos) {
    mx = max(mx, x.s);
  }
  cout << mx;

  return 0;
}



Measured memory_bytes: 3652
k=int(input())
if k==4 or k==6 or k==9 or k==10 or k==14 or k==21 or k==22 or k==25 or k==26:
  print(2)
elif k==8 or k==12 or k==18 or k==20 or k==27:
  print(5)
elif k==16:
  print(14)
elif k==24:
  print(15)
elif k==32:
  print(51)
elif k==28 or k==30:
  print(4)
else:
  print(1)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
H, W = [int(n) for n in input().split()]
S = []

if (H%3 == 0) or (W%3 == 0):
    print(0)
else:
    H_ = [(H//3), (H//3)+1, H, H]
    W_ = [W, W, W//3, (W//3) + 1]

    for h, w in zip(H_, W_):
        a = h * w
        if H != h:
            hs = H - h
        else:
            hs = H
        
        if W != w:
            ws = W - w
        else:
            ws = W

        B_ = [(hs//2)*ws, hs*(ws//2)]
        C_ = [hs*ws - b for b in B_]

        for b, c in zip(B_, C_):
            S_max = max(a, b, c)
            S_min = min(a, b, c)
            S.append(S_max - S_min)

    print(min(S))

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

int main()
{
    string s;
    cin >> s;
    ll ans = 0LL;
    ll cnt = 0LL;
    rep(i, s.length() - 1)
    {
        if (s[i] == 'A')
            cnt++;
        else if (s[i] == 'B' && s[i + 1] == 'C')
        {
            ans += cnt;
            i++;
        }
        else
        {
            cnt = 0LL;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
void Main()
{
  int n;
  cin >> n;
  
  if(n % 1000 != 0)
  printf("%d", 1000 - (n % 1000));
  
  else
    printf("%d", 0);
}
 
int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3752
data = input().split()

w = int(data[0])
h = int(data[1])
x = int(data[2])
y = int(data[3])
r = int(data[4])

if y + r > h:
  print("No")
elif y - r < 0:
  print("No")
elif x + r > w:
  print("No")
elif x - r < 0:
  print("No")
else:
  print("Yes")



Measured memory_bytes: 5596
#include <stdio.h>
 
int main() {
	int L, R, d, ctr = 0;
	scanf("%d %d %d", &L, &R, &d);
	while (L <= R) {
		if (L % d == 0) {
			ctr++;
		}
		L++;
	}
	printf("%d\n", ctr);
	return 0;
}

Measured memory_bytes: 1696
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{//manpreet
int a,b,c,x,d;
int wry =78;
    cin>>a>>b>>c>>x;
    for(int i = 0;i <= a;i ++)
    {
        for(int j = 0;j <= b;j ++)
        {
            for(int k = 0;k <= c;k ++)
                if(i * 500 + j * 100 + k * 50 == x)d ++;
        }
    }
    cout<<d<<endl;
}

Measured memory_bytes: 256
import sys

file_input = sys.stdin

n = int(file_input.readline())
m = int(file_input.readline())

adj_list = [[] for i in range(n + 1)]

indeg = [0] * (n + 1)

for line in file_input:
    i, j = map(int, line.split())
    adj_list[i].append(j)
    indeg[j] += 1

unvisited = [True] * (n + 1)

from collections import deque
q = deque()

ans = []

def bfs(s):
    q.append(s)
    unvisited[s] = False
    while q:
        u = q.popleft()
        ans.append(u)
        for v in adj_list[u]:
            indeg[v] -= 1
            if indeg[v] == 0 and unvisited[v]:
                unvisited[v] = False
                q.append(v)

# Topological Sort
for s in range(1, n + 1):
    if indeg[s] == 0 and unvisited[s]:
        bfs(s)

print(*ans, sep = '\n')

# Check whether there is a Hamilton path
for s, t in zip(ans, ans[1:]):
    if t not in adj_list[s]:
        print(1)
        break
else:
    print(0)


Measured memory_bytes: 10856
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    int INF = 1e9 + 7;
    long long ans = 1;
    for(int i = 2; i < n+1; i++) {
        ans = (ans*i)%INF;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define cases long long test;cin>>test;while(test--)
#define f_io ios::sync_with_stdio(false); cin.tie(0)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000009
#define INF 1000000000
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main()
{
    f_io;
    ll n;
    cin >> n;
    vector<double> arr(n);
    foi(0,n)
        cin >> arr[i];
    vector<double> dp(n+1);
    dp[0] = 1;
    foi(0,n)
    {
        for(ll j = i+1;j>0;j--)
            dp[j] = dp[j]*(1-arr[i]) + dp[j-1]*arr[i];
        dp[0]*=(1-arr[i]);
    }
    double ans = 0.0;
    foi(n/2+1,n+1)
        ans += dp[i];
    cout << setprecision(12) << ans;
    return 0;
}


Measured memory_bytes: 3888
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  long long N,A,B;
  cin>>N>>A>>B;
  if(A>B){
    cout<<0<<endl;
  }else if(N==1&&A!=B){
    cout<<0<<endl;
  }else{
    cout<<(B-A)*(N-2)+1<<endl;
  }

  
}





  
  


  




Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int n;
  string s;
  while(1){
    int c=0,m;
    cin>>s>>n;
    if(s=="-") break;
    int x=s.size();
    rep(i,0,n){
      cin>>m;
      c+=m;
    }
    s+=s;
    c%=x;
    string t="";
    rep(i,c,c+x) t+=s[i];
    co(t);
  }
  
  return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <string>

using namespace std;
 
int max(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}

int min(int a,int b){
	if(a<b){
		return a;
	}else{
		return b;
	}
}
int main() {
	int a,b,c,d,x;
	cin >> a>>b>>c>>d;
	x = min(b,d)-max(a,c);
	if(x>=0){
		cout << x<<endl;
	}else{
		cout << "0"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	VLL A(N);
	ll sum = 0;
	for (ll n = 0; n < N; n++) {
		cin >> A[n];
		sum += A[n];
	}
	ll pre = 0;
	ll ans = LLONG_MAX;
	for (ll n = 0; n < N - 1; n++) {
		pre += A[n];
		ans = min(ans, abs(sum - 2 * pre));
	}
	cout << ans << "\n";
	return 0;
}

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

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

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

const long long MOD = 1e9+7;

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

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

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

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

int main() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

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

    int N;
    cin >> N;
    vector<int> a(N + 1);
    int ans = 0;
    REP(i, 1, N + 1)
    {
        cin >> a[i];
        if (i % 2 == 1 && a[i] % 2 == 1)
            ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
# -*- coding: utf-8 -*-

dic = {}
pat = ['S', 'H', 'C', 'D']
rank = [k for k in range(1, 14)]

#   dic?????????
for p in pat:
    for r in rank:
        dic[(p, r)] = 0

n = input()
for i in range(n):
    l = map(str, raw_input().split())
    p = l[0]
    r = int(l[1])
    dic[(p, r)] += 1

for p in pat:
    for r in rank:
        if dic[(p, r)] == 0:
            print "%s %d" %(p, r)

Measured memory_bytes: 6464
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

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

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s,t;
    cin>>s>>t;
    if(s==t.substr(0,s.size())){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

int main(void)
{
    int n;
    cin>>n;
    stringstream os;
    os<<n;
    string x;
    os>>x;
    int cnt=0;
    for(int i=0;i<x.length();++i)
    {
        cnt+=(x[i]-'0');
    }
    if(n%cnt==0)
    {
        cout <<"Yes"<<endl;
    }
    else
    {
        cout <<"No"<<endl;
    }
    return 0;
}


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

bool solve()
{
	int N;
	scanf("%d", &N);
	std::map<int64_t, int> hat;
	int64_t xor_sum{};
	for (int i{}; i < N; i++)
	{
		int64_t tmp;
		scanf("%lld", &tmp);
		hat[tmp]++;
		xor_sum ^= tmp;
	}
	std::vector<int64_t> a(N);
	
	if (N % 3) return hat[xor_sum] == N;
	if (xor_sum != 0) return false;
	xor_sum = 0;
	for (auto& e: hat)
	{
		if (e.second % (N / 3) != 0)
			return false;
		for (int i{}; i < e.second; i += N / 3)
			xor_sum ^= e.first;
	}
	return xor_sum == 0;
}

int main()
{
	if (solve()) puts("Yes");
	else puts("No");

	return 0;
}

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

int main() {
  
  int n;
  cin >> n;
  
  int s = 1;
  int ans;
  
  if (n == 1){
    cout << 1;
  }
  
  for (int i = 0; i < n; i++) {
    ans = s*s;
    if (ans > n){
      cout << (s-1)*(s-1);
      break;
    }
    s++;
  }
  
}


Measured memory_bytes: 3620
N, L= map(int, input().split())
if L<0 and L+N-1>0:
    print(int((2*L+N-1)*N/2))
elif L>=0:
    print(int((2*L+N)*(N-1)/2))
else:
    print(int((2*L+N-2)*(N-1)/2))

Measured memory_bytes: 3060
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0; string s;
	cin >> n;
	cin >> s;
	int ct = 0;
	for (auto &i : s)
		if (i == 'R')
			++ct;
	int res = 0;
	for (int i = 0; i < ct; ++i)
		if (s[i] == 'W')
			++res;
	cout << res << endl;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}

int main()
{
	puts((read()%500<=read())?"Yes":"No");
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N, M;

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

  ll S = 1900 * M + 100 * (N - M);

  ll ans = 0;
  ans = ((pow(2, N) - 1) * pow(0.5, N) * S + pow(0.5, N) * S) * pow(2, M);

  cout << ans << endl;

  return 0;
}


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

int n;
vector<pair<int, int>> G[100005];

int color[100005];
ll d[100005];

void dfs(int v) {
    for (int i = 0; i < G[v].size(); i++) {
        if (color[G[v][i].first] == -1) {
            d[G[v][i].first] = d[v] + G[v][i].second;
            if (d[G[v][i].first] % 2 == 0) color[G[v][i].first] = 0;
            else color[G[v][i].first] = 1;
            dfs(G[v][i].first);
        }
    }
    return;
}

int main() {
    int u, v, w;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }
    for (int i = 0; i < n; i++) color[i] = -1;
    color[0] = 0;
    dfs(0);
    for (int i = 0; i < n; i++) cout << color[i] << endl;
    return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans,sum=0;

    int a,b,m;
    cin >>a>>b>>m;

    vector<int>aa(a);
    vector<int>bb(b);
    vector<pair<int,pair<int,int>>>dis;

    int mna=INF,mnb=INF;

    rep(i,a){cin>>aa[i];chmin(mna,aa[i]);}
    rep(i,b){cin>>bb[i];chmin(mnb,bb[i]);}
    ans = mna+mnb;

    rep(i,m){
        int x,y,c;
        cin>>x>>y>>c;
        --x;--y;

        int pay = aa[x]+bb[y]-c;
        chmin(ans,pay);
        pair<int,pair<int,int>> disi = {c,{x,y}};
        dis.emplace_back(disi);
    }



    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<ans<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int main(){
  string str1,str2,str4,str6;
  cin >> str1;
  int x=0;
  for(int i=0;i<str1.size();i++){
    str2.append(1,str1[(str1.size()-1)-i]);
  }
  if(str2==str1){
    x++;
  }
  
  string str3=str1.substr(0,(str1.size()-1)/2);
  for(int i=0;i<str3.size();i++){
    str4.append(1,str3[(str3.size()-1)-i]);
  }
  if(str4==str3){
    x++;
  }
  
  string str5=str1.substr((str1.size()+3)/2-1);
  for(int i=0;i<str5.size();i++){
    str6.append(1,str5[(str5.size()-1)-i]);
  }
  if(str6==str5){
    x++;
  }
  if(x==3){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}
  
    

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()
# template


def main():
    A = ii()
    B = ii()
    print(6 - A - B)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060