akhauriyash/Code-Regression huggingface dataset:
#------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
import math 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
#-------------------game starts now----------------------------------------------------
# n,q=map(int,input().split())
# l=list(map(int,input().split()))
k=(int)(input())
n=(input())
# print(len(n))
if(k>=len(n)):
    print(n)
else:
    print(n[0:k],end='')
    print('...')

Measured memory_bytes: 9400
x, n = [int(k) for k in input().split()]

try:
    p = [None if k is None else int(k) for k in input().split()]
except:
    p = []
i = 0
while True:
    if not x - i in p:
        print(x - i)
        break
    if not x + i in p:
        print(x + i)
        break
    i += 1

Measured memory_bytes: 9080
#include<stdio.h>
#include<iostream>
#include<vector>
using namespace std;

int main(){
    int k,x;
    cin >>  k >>  x ;
    for(int i = -k+1;i <k ; i++){
        if ((x+i >= -1000000) && (x+i <= 1000000)){
           // printf("%d",i);
            if (i == k-1){
                cout <<x+i << endl;
           }
            else{
                cout <<x+i << ' ';
        }
    }
}   
}

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

using namespace std;

int main() {
    int n;
    map<string,int> mp;
    string str;
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin>>str;
        mp[str]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define N 100010
using namespace std;
int sum[N],ans,n;
int main()
{
	scanf ("%d",&n);
	for (int i=1,a;i<=n;i++) scanf("%d",&a),sum[a]++;
	for (int i=1;i<=100000;i++) ans=max(ans,sum[i]+sum[i-1]+sum[i+1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
//const ll MOD = 1e9+7;
const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

const int MAX_N = 2e5;
ll fac[MAX_N+1], ifac[MAX_N+1], inv[MAX_N+1];

//mpow(x,n)で(x^n)をO(log(n))で計算
ll mpow(ll x, ll n){
    ll res = 1, now = x;
    while(n > 0){
        if(n & 1) res *= now, res %= MOD;
        now *= now, now %= MOD;
        n >>= 1;
    }
    return res;
}

//setcomb()でfac,ifac,invを全て計算
void setcomb(){
    rep2(i, 1, MAX_N){
        inv[i] = mpow(i, MOD-2);
    }
    //i!とi!の逆元
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, MAX_N){
        fac[i] = (fac[i-1]*i) % MOD;
        ifac[i] = (ifac[i-1]*inv[i]) % MOD;
    }
}

//comb(n, k)でnCk
ll comb(int n, int k){
    ll c = fac[n];
    c *= ifac[n-k], c %= MOD;
    c *= ifac[k], c %= MOD;
    return c;
}

//perm(n, k)でnPk
ll perm(int n, int k){
    return(fac[n]*ifac[n-k])%MOD;
}

int main(){
    setcomb();
    int K, N;
    cin >> K >> N;
    //dp[i][j]:=i個のペアからj個を取り出す方法の数
    ll dp[K+1][N+1];
    fill(dp[0], dp[0]+N+1, 0);
    dp[0][0] = 1;
    rep2(i, 1, K){
        ll sum = 0;
        rep(j, N+1){
            dp[i][j] = (dp[i-1][j]+2*sum)%MOD;
            sum += dp[i-1][j];
        }
    }
    rep(i, 2*K-1){
        //ペアの数
        int n = min((i+1)/2, (2*K-i-1)/2);
        //cout << n << ' ';
        ll ans = 0;
        if(i&1){
            //ペアからj個取る場合
            rep(j, N+1){
                //p個をq種類のどれかに分ける
                int p = N-j, q = K-2*n;
                ll tmp;
                if(p == 0 && q == 0) tmp = dp[n][j];
                elif(q == 0) continue;
                else tmp = (dp[n][j] * comb(p+q-1, q-1)) % MOD;
                ans += tmp, ans %= MOD;
            }
            cout << ans << endl;
        }
        else{
            //i/2を使う場合
            rep(j, N){
                //p個をq種類のどれかに分ける
                int p = N-1-j, q = K-2*n-1;
                ll tmp;
                if(p == 0 && q == 0) tmp = dp[n][j];
                elif(q == 0) continue;
                else tmp = (dp[n][j] * comb(p+q-1, q-1)) % MOD;
                ans += tmp, ans %= MOD;
            }
            //i/2を使わない場合
            rep(j, N+1){
                //p個をq種類のどれかに分ける
                int p = N-j, q = K-2*n-1;
                ll tmp;
                if(p == 0 && q == 0) tmp = dp[n][j];
                elif(q == 0) continue;
                else tmp = (dp[n][j] * comb(p+q-1, q-1)) % MOD;
                ans += tmp, ans %= MOD;
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 36224
#include <stdio.h>

int main() {
    int N;
    int i;
    int flag = 1;
    int j;
    int tmp;
    int counter=0;
    
    scanf("%d",&N);
    int A[N];
    
    for(i=0; i<N; i++){
        scanf("%d",&A[i]);
    }
    
    while(flag==1){
        flag = 0;
        for(j=N-1; j>0; j--){
            if(A[j]<A[j-1]){
                tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = 1;
                counter++;
            }
        }
    }
    for(i=0; i<N; i++){
        printf("%d",A[i]);
        if(i<N-1) printf(" ");
    }
    printf("\n%d\n",counter);
    
    
    return 0;
}

Measured memory_bytes: 604
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s = sc.next();
		Deque<Character> deque = new ArrayDeque<Character>();
		boolean isDirectedForward = true;
		for (int i = 0, f = s.length(); i < f; ++i) {
			deque.addLast(s.charAt(i));
		}

		int q = Integer.parseInt(sc.next());
		for (int i = 0; i < q; ++i) {
			int t = Integer.parseInt(sc.next());
			if (t == 1) {
				isDirectedForward = !isDirectedForward;
				continue;
			}

			int f = Integer.parseInt(sc.next());
			char c = sc.next().charAt(0);
			if (f == 1) {
				if (isDirectedForward) {
					deque.addFirst(c);
				} else {
					deque.addLast(c);
				}
			} else {
				if (isDirectedForward) {
					deque.addLast(c);
				} else {
					deque.addFirst(c);
				}
			}
		}

		while (deque.size() > 0) {
			if (isDirectedForward) {
				System.out.print(deque.pollFirst());
			} else {
				System.out.print(deque.pollLast());
			}
		}
		System.out.println();
	}
}


Measured memory_bytes: 97372
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, s1, s2, s3, d;
    cin >> a >> b;
    int s = min(a, b);
    if (a % 3 == 0 || b % 3 == 0)
    {
        cout << '0';
        return 0;
    }
    if (a % 2 == 0) s = min(s, a / 2);
    if (b % 2 == 0) s = min(s, b / 2);
    if (a % 2 == 1 && b % 2 == 1)
    {
        for (int c = 1; c < b; c++)
        {
            s1 = a * (b - c);
            s2 = (a + 1) / 2 * c;
            s3 = (a - 1) / 2 * c;
            d = max(s1, s2) - min(s1, s3);
            s = min(s, d);
        }
        for (int c = 1; c < a; c++)
        {
            s1 = b * (a - c);
            s2 = (b + 1) / 2 * c;
            s3 = (b - 1) / 2 * c;
            d = max(s1, s2) - min(s1, s3);
            s = min(s, d);
        }
    }
    cout << s;
}

Measured memory_bytes: 3624
package main

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

func main() {

	switch nextInt() {
	case 3, 5, 7:
		fmt.Println("YES")
	default:
		fmt.Println("NO")
	}
}

func lcm(a, b int64) int64 {
	return (a / gcd(a, b)) * b
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

const size = 1000000

var reader = bufio.NewReaderSize(os.Stdin, size)

func nextLine() string {
	var line, buffer []byte
	isPrefix := true
	var err error
	for isPrefix {
		line, isPrefix, err = reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
	}
	return string(buffer)
}
func nextStringArray() []string {
	return strings.Split(nextLine(), " ")
}
func nextInt() int {
	n, _ := strconv.Atoi(nextLine())
	return n
}

func nextIntArray() []int {
	s := strings.Split(nextLine(), " ")
	n := len(s)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}

func min(i, j int) int {
	if i > j {
		return j
	}
	return i
}

func max(i, j int) int {
	if i < j {
		return j
	}
	return i
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std; 
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define sc(x) scanf("%d",&x)
#define sd(x) scanf("%lf",&x)



int main(int argc, char** argv) {
	string T;
	cin>>T;
	rep(i,0,T.length()-1)
	{
		if(T[i]=='?')
		{
			printf("D");
		}
		else cout<<T[i];
	}
	return 0;
}


Measured memory_bytes: 3708
#include <stdio.h>
#define MAXN 200000
#define MAX(x, y) (x > y ? x : y)
#define MIN(x, y) (x < y ? x : y)

int profit(int *R, int N) {
  int j, minv = R[0], maxv = R[1] - R[0];
  for(j = 1; j < N; j++) {
    maxv = MAX(maxv, R[j]-minv);
    minv = MIN(minv, R[j]);
  }
  return maxv;
}

int main() {
  int n, i, r[MAXN];
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &r[i]);
  }
  printf("%d\n", profit(r, n));
}



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

class Cube{
public:
 int f[6];
 Cube(){}
 void roll_z(){ roll(1,2,4,3);} //
 void roll_y(){ roll(0,2,5,3);} // to W
 void roll_x(){ roll(0,1,5,4);} // to N
 void roll(int i, int j, int k, int l){
  int t=f[i]; f[i]=f[j]; f[j]=f[k]; f[k]=f[l]; f[l]=t;
 }
};

bool eq(Cube c1,Cube c2){
 for(int i=0;i<6;i++)
  if(c1.f[i]!=c2.f[i]) return false;
 return true;
}

bool equal(Cube c1,Cube c2){
 for(int i=0;i<6;i++){
  for(int j=0;j<4;j++){
   if(eq(c1,c2)) return true;
   c1.roll_z();
  }
  if(i%2==0)c1.roll_y();
  else c1.roll_x();
 }
 return false;
}

Cube C[100]; int n;

bool check(){
 for(int i=0;i<n-1;i++)
  for(int j=i+1;j<n;j++) if(equal(C[i],C[j])) return false;
 return true;
}

int main(){
 cin >>n;
  for(int j=0;j<n;j++)
   for(int i=0;i<6;i++) cin >> C[j].f[i];

 if(check()) cout << "Yes" << endl;
 else cout << "No" << endl;

 return 0;
}

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

int main(){
    int N; cin >> N;
    vector<ll> T(N);
    for(int i = 0; i < N; i++) cin >> T[i];
    ll pre = T[0];
    for(int i = 1; i < N; i++){
        pre = pre / __gcd(pre, T[i]) * T[i];
    }
    cout << pre << endl;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	printf("%d\n",n*n*n);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,k,i,sum;
	scanf("%d %d",&n,&k);
	sum=1;
	for(i=1;i<=n;i++){
		if(sum*2<sum+k){
			sum=sum*2;
		}
		else{
			sum=sum+k;
		}
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-9;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int a,b;cin>>a>>b;
    int m;cin>>m;
    int f[a],g[b];
    int ans=0;
    rep(i,0,a)cin>>f[i];
    rep(i,0,b)cin>>g[i];
    int mi=1000000000,mi2=1000000000;
    rep(i,0,a)Min(mi,f[i]);
    rep(i,0,b)Min(mi2,g[i]);
    ans=mi+mi2;
    rep(i,0,m){
        int s,y,c;cin>>s>>y>>c;
        s--;
        y--;
        Min(ans,f[s]+g[y]-c);
    }
    cout<<ans<<endl;
}









Measured memory_bytes: 1024
// Author : Abhinav Jain
// Institution: Jaypee Institute of information Technology
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define lli long long int
#define pb push_back
#define mp make_pair
#define cases lli testcases;cin>>testcases; while(testcases--)
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << x << endl;
#define trace2(x,y) cerr<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;
#define trace3(x,y,z) cerr<< '>' << #x << ':' << x << " | " << #y << ':' << y <<  " | " << #z << ':' << z << endl;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef map<int,int> mii;
int MOD= 1000000007LL;
#define all(v) v.begin(), v.end()
 lli fastpow(lli base, lli exp) {lli res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}


template<typename T>
T mult(T x,T y,T mod){
    return(((x%mod)*(y%mod))%mod);
}

template<typename T>
T add(T x,T y,T mod){
    return(((x%mod)+(y%mod))%mod);
}

template<typename T>
T gcd(T x,T y){
    return(!y?x:gcd(y,x%y));
}

template<typename T>
T lcm(T x,T y){
    return((x*y)/gcd(x,y));
}

int32_t main()
{
    map<string, lli> freq;
    vector<string > keys({"AC", "WA", "TLE", "RE"});
    
    cases
    {
        string str; cin >> str;
        freq[str]++;
        
    }
        for(auto it: keys)
        {
            cout << it <<" x "<< freq[it]<<endl;
        }
 
 
    
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
#define ll long long
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define rrep(i,a,b) for(ll i=a;i>b;i-=1)
#define vi vector<ll>
#define vii vector<vector<ll> >
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define tr(c,i) for( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mp make_pair
#define hell 1000000007
#define F first
#define S second
//debug
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
ll t=1;
void solve()
{
    int n;
    cin>>n;
    int v[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>v[i][j];
        }
    }
    int dp[n][3];
    dp[0][1]=v[0][1];
    dp[0][2]=v[0][2];
    dp[0][0]=v[0][0];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            dp[i][j]=v[i][j]+max(dp[i-1][1],dp[i-1][2]);
            else if(j==1)
            dp[i][j]=v[i][j]+max(dp[i-1][0],dp[i-1][2]);
            else
                dp[i][j]=v[i][j]+max(dp[i-1][0],dp[i-1][1]);
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}
int main()
{
    int i;
  	ios_base::sync_with_stdio(false);
	cin.tie(0);
    cout.tie(0);
  	//cin>>t;
  	while(t--)
	solve();
	return 0;
}


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

long long extgcd(long long a, long long b, long long &x, long long &y){
  long long d = a;
  if(b){
    d = extgcd(b, a%b, y, x);
    y -= (a / b)*x;
  }else{
    x = 1;
    y = 0;
  }
  return d;    
}

int main(){
  long long N;
  cin >> N;
  long long ans = 2*N;
  for(long long p = 1; p*p <= 2*N; ++p){
    if((2*N)%p) continue;
    long long q = 2*N/p;
    if(gcd(p,q) > 1) continue;
    for(int j = 0; j < 2; ++j){
      long long x, y;
      long long g = extgcd(p,q,x,y);
      // cerr << p << "*" << x << "+" << q << "*" << y << endl;
      y *= -1;
      if(x <= 0){
        long long d = (1-x+q-1)/abs(q), dx = d*q, dy = d*p;
        x += dx;
        y += dy;
      }
      if(y <= 0){
        long long d = (1-y+p-1)/abs(p), dx = d*q, dy = d*p;
        x += dx;
        y += dy;
      }
      // cerr << p << "*" << x << "-" << q << "*" << y << endl;
      ans = min(ans,q*y);
      swap(p,q);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3652
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

int main() {
	
	int n, a;
	cin >> n >> a;

	int r = n % 500;
	if (a >= r)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  long long numR = count(S.begin(),S.end(),'R');
  long long numG = count(S.begin(),S.end(),'G');
  long long numB = count(S.begin(),S.end(),'B');
  
  long long ans = numR*numG*numB;
  
  int diff_max = N/2 - 1 + N%2;
  
  long long cnt = 0;
  for (int l=0;l<N;l++){
    for (int i=1;i<=diff_max;i++){
      if ((l+2*i)<N){
        if (S[l] != S[l+i] && S[l+i] != S[l+2*i] && S[l] != S[l+2*i]){
          cnt += 1;
        }
      }
    }
  }
  
  ans -= cnt;
  
  cout << ans << endl;
  
  return 0;
}



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

int main(){
  int n, m; cin >> n >> m;
  int arr[n];
  double tot = 0;
  for(int i = 0; i<n; i++){
    cin >> arr[i];
    tot += arr[i];
  }
  sort(arr, arr+n);
  reverse(arr, arr+n);
  int mi = arr[m-1];
  if(tot/(4*m) <= mi) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a; long long b,n; cin >>a >>b >>n;
  int x=floor(a*(b-1)*1.0/b);
  int y=floor(a*n*1.0/b);
  if(n>=b-1) cout <<x;
  else cout <<y;
return 0;}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e6 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a,b;
   cin >> a >> b;
   f(i,1,N){
      int ff = (i*0.08),ss = i*0.1;
      if(ff == a and ss == b){
         cout << i << '\n';
         return 0;
      }
   }
   // int ff = a/0.08,ss = b/0.1;
   // if(ff == ss){
   //    cout << ff << '\n';
   //    return 0;
   // }
   cout << "-1\n";
   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 repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);
//桁数に注意 long long　にする

int main() {
  long long n;
  cin >> n;
  
  vector<int> p = {1,2,0,4,0,0,7,8,0,0,11,0,13,14,0};
  
  long long ans = 60*(n/15);
  
  ans+=60*(n/15)*(n/15-1);
  
  rep(i,n%15) {
  ans+=p[i];
  if(p[i]!=0)ans+=(n/15)*15;
  }
  
  cout << ans << endl;
  
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,k;
	cin>>n>>k;
	vector<int> h(n);
	rep(i,n)cin>>h[i];

	vector<int> dp(n,INF);
	dp[0] = 0;
	repi(i,1,n) repi(j,max(0,i-k),i) dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <math.h>
#define SQ(x) ((x) * (x))

typedef struct{
	double x;
	double y;
} POINT;


double intersept(POINT p1, POINT p2, POINT p3, POINT p4){
	return(((p1.x - p2.x) * (p3.y - p1.y) + (p1.y - p2.y) * (p1.x - p3.x)) * ((p1.x - p2.x) * (p4.y - p1.y) + (p1.y - p2.y) * (p1.x - p4.x)));
}

int main(void)
{
	POINT A, B, C, G, P;
	
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &P.x, &P.y) != EOF){
		
		G.x = (A.x + B.x + C.x) / 3;
		G.y = (A.y + B.y + C.y) / 3;
		
		if (intersept(A, B, G, P) > 0 && intersept(B, C, G, P) > 0 && intersept(C, A, G, P) > 0){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N);
  REP(i, N)
  cin >> A[i];
  ll ans = 0; // fの最大値
  ll ret = 0; // fが最大となるXの値
  for (int i = 40; i >= 0; i--)
  {
    ll mask = 1LL << i;
    ll cnt = 0;
    REP(j, N)
    {
      if (A[j] & mask)
        cnt++;
    }
    if (cnt > N - cnt) // X_i = 0
      ans += mask * cnt;
    else
    {
      if (mask + ret <= K) // X_i = 1
      {
        ans += mask * (N - cnt);
        ret += mask;
      }
      else // X_i = 0
        ans += mask * cnt;
    }
  }
  cout << ans << endl;
  return 0;
}

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

template<class T> struct edge { int to; T cost;};


void solve(string &s, string &t, vector<vector<int>> &alphabets){
  vector<ll> tindex(t.size(), 1000000000000000);
  rep(i, t.size()){
    if (alphabets[t[i] - 'a'].size() == 0){
      cout <<-1 <<endl; return;
    }
  }
  tindex[0] = alphabets[t[0] - 'a'][0];
  ll m = s.size();

  for (int i=1; i<t.size(); i++){
    auto &e = alphabets[t[i]-'a'];
    // eの中の各々のindexにmの倍数を足したもののうち、
    // tindex[i-1] より大きいものの最小値をtindex[i] とする
    // tindex[i-1]%m より大きいもののうち最小のものをまず探す
    // なければ最初のやつで
    ll a = 0;
    if (upper_bound(all(e), tindex[i-1]%m) == e.end()){
      a = e[0];
      a += tindex[i-1]/m*m;
      a += m;
    }else{
      a = *upper_bound(all(e), tindex[i-1]%m);
      a += tindex[i-1]/m*m;
    }
    // aにmの倍数を足してtindex[i-1]を超えるようにする
    tindex[i] = a;
  }
  ll res = tindex[t.size()-1] + 1;
  cout <<res <<endl;
}

int main() {
  string s,t; cin >>s >>t;
  vector<vector<int>> alphabets(26);
  rep(i, s.size()) alphabets[s[i]-'a'].push_back(i);
  // sの中のアルファベットがどのindexで現れたかを二次元配列で格納
  solve(s, t, alphabets);
  return 0;

  vector<int> abindex(26, 0);
  vector<ll> tindex(t.size(), -1);
  rep(i, t.size()){
    int alphb = t[i] - 'a';
    if (alphabets[alphb].size() == 0){
      cout <<-1 <<endl; return 0;
    }
    tindex[i] = alphabets[alphb][abindex[alphb]];
    abindex[alphb]++;
    abindex[alphb] %= alphabets[alphb].size();
  }

  ll m = s.size();

  for (int i=0; i<t.size()-1; i++){
    // tindex[i] と tindex[i+1] を比較。
    // 後者が小さければ m の倍数を足してでかくする
    tindex[i+1] += tindex[i]/m*m;
    while (tindex[i] >= tindex[i+1]){
      tindex[i+1] += m;
    }
  }
  ll res = tindex[t.size()-1] + 1;
  cout <<res <<endl;
}


Measured memory_bytes: 1852
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  int n, m, v, p;
  cin >> n >> m >> v >> p;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int l = 0, r = n - 1, ans = n - 1;
  while (l <= r) {
    int mid = (l + r) / 2;
    int ch = v - (mid + 1);
    vector<int> b(n, 0);
    int kol = ch * m;
    int cnt = 0;
    for (int i = mid + 1; i < n; i++) {
      if (a[i] > a[mid] + m) {
        cnt++;
        b[i] = m;
      } else {
        b[i] = max(0ll, m - (a[i] - a[mid]));
      }
      kol -= b[i];
    }
    for (int i = n - 1; i > mid; i--) {
      if (kol <= 0) break;
      if (b[i] < m) {
        kol -= m - b[i];
        cnt++;
      }
    }
    if (cnt < p) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << n - ans << "\n";
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    
    vector<vector<pair<int,int>>> v(n);
    rep(i,n){
        int a;
        cin>>a;
        rep(j,a){
            int x,y;
            cin>>x>>y;
            x--;
            v[i].push_back({x,y});
        }
    }

    int ans=0;
    rep(bit,1<<n){
        bool ok=true;
        int tmp=0;
        rep(i,n){
            if(bit & 1<<i){
                tmp++;
                rep(j,v[i].size()){
                    int x=v[i][j].first;
                    int y=v[i][j].second;
                    if(y==1 && !(bit & 1<<x)) ok=false;
                    if(y==0 && bit & 1<<x) ok=false;
                }
            }
        }
        if(ok) ans=max(ans,tmp);
    }

    cout<<ans<<endl;
    
}


Measured memory_bytes: 3580
#include<stdio.h>
int main(){
	int n[4],i,j,x;
	for(i=0;i<3;i++)scanf("%d",&n[i]);
	for(i=0;i<2;i++){
		for(j=1;j<3;j++){
			if(n[i]>n[j]){
				x=n[i];
				n[i]=n[j];
				n[j]=x;
			}
		}
	}
	printf("%d %d %d\n",n[0],n[1],n[2]);
	return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  char a,b;cin>>a>>b;
  if(a=='H'&&b=='H')cout<<'H'<<endl;
  else if(a=='H'&&b=='D')cout<<'D'<<endl;
  else if(a=='D'&&b=='H')cout<<'D'<<endl;
  else if(a=='D'&&b=='D')cout<<'H'<<endl;
}

  
   





Measured memory_bytes: 256
s = gets.chomp
a= s[0].to_i
b= s[1].to_i
c= s[2].to_i
d= s[3].to_i

bit = [1,-1]

bit.each do |i|
  bit.each do |j|
    bit.each do |k|
      if a + i*b + j*c + k*d == 7
        answer = "#{s[0]}#{i > 0 ? '+' : '-'}#{s[1]}#{j > 0 ? '+' : '-'}#{s[2]}#{k > 0 ? '+' : '-'}#{s[3]}=7"
        puts answer
        exit 0
      end
    end
  end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 3005;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

bool comp( const pll &a, const pll &b )
{
    if( a.S - a.F > b.S - b.F )
        return 1;
    return 0;
}

ll dp[MAXN], n,t;
bitset<3005> mask[MAXN];

int main() 
{
    fastio();

    cin>>n>>t;

    vector<pll>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i].F>>v[i].S;
    }
    sort(all(v), comp);

    // dp[i] = max happiness at time = i
    dp[0] = 0;
    for(int i=0;i<n;i++)
    {
        for(int tim=t;tim>=v[i].F;tim--)
        {
            if( dp[tim] < dp[tim-1] )
            {
                dp[tim] = dp[tim-1];
                mask[tim] = mask[tim-1];
            }
            if( dp[tim] < dp[tim-v[i].F] + v[i].S )
            {
                dp[tim] = dp[tim-v[i].F] + v[i].S;
                mask[tim] = mask[tim-v[i].F];
                mask[tim][i] = 1;
            }
        }
    }

    ll ans = dp[t];
    for(int i=0;i<n;i++)
    {
        if( mask[t-1][i] == 0 )
            ans = max(ans, dp[t-1] + v[i].S );
    }
    cout<<ans,nl;

    return 0;
}

Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

//https://qiita.com/keymoon/items/11fac5627672a6d6a9f6から
ll base=0;
class Rollinghash{
    ll MASK30 = (1LL << 30) - 1;
    ll MASK31 = (1LL << 31) - 1;
    ll MD = (1LL << 61) - 1;
    ll MASK61 = MD;
    //a*b mod 2^61-1を返す関数(最後にModを取る)
    ll Mul(ll a, ll b){
        ll au = a >> 31;
        ll ad = a & MASK31;
        ll bu = b >> 31;
        ll bd = b & MASK31;
        ll mid = ad * bu + au * bd;
        ll midu = mid >> 30;
        ll midd = mid & MASK30;
        return CalcMod(au * bu * 2 + midu + (midd << 31) + ad * bd);
    }

    //mod 2^61-1を計算する関数
    ll CalcMod(ll x)
    {
        ll xu = x >> 61;
        ll xd = x & MASK61;
        ll res = xu + xd;
        if (res >= MD) res -= MD;
        return res;
    }
    static inline ll generate_base() {
        mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
        uniform_int_distribution<ll> rand(2,(1LL<<61)-3);
        return rand(mt);
    }
    vl hash,power;

public:
    Rollinghash(vl &s){
        if(base==0){
            base=generate_base();
        }
        ll n=s.size();
        hash.assign(n+1,0);
        power.assign(n+1,1);
        rep(i,n){
            power[i+1]=Mul(power[i],base)%MD;
            hash[i+1]=(Mul(hash[i],base)+s[i])%MD;
        }
    }
    ll get(int l,int r){
        return (hash[r]+MD-Mul(hash[l],power[r-l])%MD)%MD;
    }
    int LCP(int l0,int r0,int l1,int r1){
        int ok=0,ng=min(r0-l0,r1-l1);
        while(abs(ok-ng)>1){
            int rh_mid=(ok+ng)/2;
            if(get(l0,l0+rh_mid)==get(l1,l1+rh_mid)) ok=rh_mid;
            else ng=rh_mid;
        }
        return ok;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    vl A(N),B(N);
    rep(i,N){
        cin >> A[i];
    }
    rep(i,N){
        cin >> B[i];
    }
    vl C(2*N),D(N);
    rep(i,N){
        C[i]=C[N+i]=A[i]^A[(i+1)%N];
        D[i]=B[i]^B[(i+1)%N];
    }
    Rollinghash rh0(C);
    Rollinghash rh1(D);
    rep(K,N){
        if(rh0.get(K,K+N)==rh1.get(0,N)){
            cout << K << ' ' << (A[K]^B[0]) << endl;
        }
    }
}

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

int main(){
    for(int i = 0; ; i++){
        int n,x;
        cin >> n >> x;
        if(n == 0 && x == 0){
            break;
        }

        int count = 0;
        for(int p = 1; p < n-1; p++){
            for(int q = p+1; q < n; q++){
                for(int r = q+1; r < n+1; r++){
                    if(p+q+r == x){
                        count++;
                    }
                }
            }
        }
        cout << count << endl;
    }

    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
    int r;
    cin>>r;
    double pi=acos(-1);
    printf("%.10lf",2*pi*r);
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
using namespace std;
int main()
{
    int X,A;
    cin >> X >> A;
    if(X<A)
    {
        cout << 0 << endl;
    }
    else if (X>=A)
    {
        cout << 10 <<endl;
    }
    return 0;
    
    
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H,A;cin>>H>>A;
    cout<<(H+A-1)/A<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

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

// const int MAX = 1010;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    ll a_sum = 0;
    ll b_sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        a_sum += a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
        b_sum += b[i];
    }
    ll req = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] < b[i])
        {
            req += (b[i] - a[i] + 1) / 2;
        }
    }
    if (req <= b_sum - a_sum)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3784
#include<stdio.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(i=0; i<n; i++)

int main(void)
{
	int k, x;
	scanf("%d%d", &k, &x);
	if(500*k >= x) puts("Yes");
	else puts("No");
	return 0;
}

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

int main()
{
    int num;
    cin >> num;
    vector<double> array;
    for (int i = 0; i < num; i++)
    {
        int input;
        cin >> input;
        array.push_back(input);
    }

    sort(array.begin(), array.end());
    double value = array[0];
    for (int i = 1; i < num; i++)
    {
        double a = (value + array[i]) / 2;
        value = a;
    }
    cout << value << endl;
}


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

flag = False
for x in range(N+1):
    for y in range(N+1-x):
        z = N-x-y
        if x*10000 + y*5000 + z*1000 == Y:
            print(x,y,z, sep=' ')
            flag = True
            break
    if flag:
        break
if not flag:
    print("-1 -1 -1")


Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
struct point{ll start,rest,color;};

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

int main() {
    ll N,M;
    cin >> N >> M;
    vector<vector<ll>> G(N);
    rep(i,M){
        ll a,b;
        cin >> a >> b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ll Q;
    cin >> Q;
    vector<ll> v(Q),d(Q),c(Q);
    rep(i,Q){
        cin >> v[i] >> d[i] >> c[i];
        v[i]--;
    }
    queue<point> que;
    vector<ll> ans(N,0),range(N,0);
    for (ll i=Q-1;i>=0;i--){
        if (d[i]!=0){
            que.push(point{v[i],d[i],c[i]});
        }
        chmax(range[v[i]],d[i]);
        if (ans[v[i]]==0){
            ans[v[i]]=c[i];
        }
        while(!que.empty()){
            point p=que.front();
            que.pop();
            for (auto x:G[p.start]){
                if (ans[x]==0){
                    ans[x]=p.color;
                }
                if (p.rest>1&&chmax(range[x],p.rest-1)){
                    que.push(point{x,p.rest-1,p.color});
                }
            }
        }
    }
    rep(i,N){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 13300
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k,q,i,temp;
    cin>>n>>k>>q;
    ll arr[n+5]={};
    for(i=0;i<q;i++){
        cin>>temp;
        arr[temp]+=1;
    }
    for(i=1;i<=n;i++){
        temp=k-q+arr[i];
        if(temp>0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


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

const int inf = 1e9;

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

    vector<int> w(n), e(n);
    w[0] = 0; e[n-1] = 0;
    for (int i = 1; i < n; i++) {
        w[i] = w[i-1] + (s[i-1] == 'W');
        e[n-i-1] = e[n-i] + (s[n-i] == 'E');
    }

    int ans = inf;
    for (int i = 0; i < n; i++) {
        ans = min(ans, w[i] + e[i]);
    }
    cout << ans << endl;
    return 0;
}

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


using namespace std;

int main()
{ int n;

  cin>>n;
  
  
  
  
  int a[n+1],b[n+1];
  for(int i=1;i<=n;i++)
  {
  cin>>a[i];
  b[a[i]]=i;
  
  
}
  
  for(int i=1;i<=n;i++)
  cout<<b[i]<<" ";
  
  
  
	
	
	
	return 0;
	
}

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

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

    if(a==0) {
        if(a == b) cout << 1 << endl;
        else cout << b/x + 1 << endl;
    }
    else {
        if(a == b) {
            if(b == x) cout << 1 << endl;
            else cout << 0 << endl;
        }
        else cout << b/x - (a+x-1)/x + 1 << endl;
    }

    return 0;
}

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



int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='9'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>

using namespace std;

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

int N;
ll a[100100], b[101100];
P c[100100];

int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i] >> b[i];
        c[i].first = a[i] + b[i];
        c[i].second = i;
    }
    sort(c, c+N);

    ll t = 0, o = 0;
    int xx = 0;
    for(int i = N-1; i >= 0; i--){
        ll index = c[i].second;
        if(xx % 2 == 0){
            t += a[index];
        }
        else{
            o += b[index];
        }
        xx++;
    }

    cout << t - o << endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}
 
ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}
 
ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N,K,C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    vector<int> L(K);
    int cnt = 0;
    for(int i = 0;i < K;i++) {
        while(S.at(cnt) == 'x' && cnt < N) {
            cnt++;
        }
        L.at(i) = cnt;
        cnt += C + 1;
    }
    vector<int> R(K);
    reverse(S.begin(),S.end());
    cnt = 0;
    for(int i = 0;i < K;i++) {
        while(S.at(cnt) == 'x' && cnt < N) {
            cnt++;
        }
        R.at(i) = N - 1 - cnt;
        cnt += C + 1;
    }
    reverse(R.begin(),R.end());
    for(int i = 0;i < K;i++) {
        if(L.at(i) == R.at(i)) {
            cout << L.at(i) + 1 << endl;
        }
    }
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if(n == 1)
    {
        cout << "Hello World" << endl;
    }
    else if(n == 2)
    {
        int b, c;
        cin >> b >> c;
        cout << b+c << endl;
    }
}



Measured memory_bytes: 256
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N, K = ZZ()
    output = 0
    for b in range(1, N+1):
        output += N//b * max(0, b-K)
        output += max(0, N%b-K+1)
        if K == 0: output -= 1
    print(output)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060