akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var arrayCount = array.Length;
            var distinctedCount = array.Distinct().Count();

            if (arrayCount == distinctedCount)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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

struct UnionFind{
    int num;
 
    vector<int> rs,ps;
 
    UnionFind(){}
 
    UnionFind(int n) : num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);}
 
    int find(int x){
        return ( x==ps[x] ? x: ps[x] = find(ps[x]));
    }
 
    bool same(int x, int y){
        return find(x) == find(y);
    }
 
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rs[x] < rs[y]) swap(x,y);
        rs[x] += rs[y];
        ps[y] = x;
        num--;
    }
 
    int size(int x){
        return rs[find(x)];
    }
 
    int count() const{
        return num;
    }
 
};

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> p(N);
    UnionFind U(N);
    for(int i=0; i<N; i++) cin>>p[i],p[i]--;

    for(int i=0; i<M; i++){
        int x,y;
        cin>>x>>y;
        x--,y--;
        U.unite(x,y);
    }

    int ans = 0;

    for(int i=0; i<N; i++){
        if(U.same(p[i],i)) ans++;
    }    

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4472
#include <cstdio>//C语言io
#include <cstring>//以下是c语言常用头文件
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <cmath>
#include <iostream>//c++IO
#include <sstream>
#include <string>
#include <list>//c++常用容器
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>//c++泛型的一些函数
#include <functional>//用来提供一些模版
#define fo0(i,n) for(int i = 0;i < n; ++i)
#define fo1(i,n) for(int i = 1;i <= n; ++i)
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
//......................................................
const int maxn = 60;
LL x[maxn];
LL y[maxn];
LL xx[maxn];
LL yy[maxn];
int main()
{
    int n,K;
    cin>>n>>K;
//    cout<<n<<k<<endl;
    for(int i = 0;i < n; ++i)
    {
        cin>>x[i]>>y[i];
        xx[i] = x[i];
        yy[i] = y[i];
    }
    sort(xx,xx+n);
    sort(yy,yy+n);
    LL ans = (yy[n-1]-yy[0])*(xx[n-1]-xx[0]);
//    cout<<ans<<endl;
    for(int i = 0;i < n; ++i)
    {
        for(int ii = i+1;ii < n; ++ii)
        {
            for(int k = 0;k < n; ++k)
            {
                for(int kk = k +1;kk < n; ++kk)
                {
                    LL minx = xx[i];
                    LL maxx = xx[ii];
                    LL miny = yy[k];
                    LL maxy = yy[kk];
                    LL num = 0;
                    for(int j = 0;j < n; ++j)
                    {
                        if(x[j]>=minx&&x[j]<=maxx&&y[j]>=miny&&y[j]<=maxy)
                            num++;
                    }
                    if(num>=K)
                    {
                        ans = min(ans,(maxy-miny)*(maxx-minx));
                    }
                }
            }
        }
    }
    cout<<ans<<endl;



    return 0;
}



//
//    return 0;
//}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/
 
//primes for hashing 937,991,1013,1409,1741

ll findTrailingZeros(ll n) 
{ 
    // Initialize result 
    ll count = 0; 
  
    // Keep dividing n by powers of  
    // 5 and update count 
    for (ll i = 5; n / i >= 1; i *= 5) 
        count += n / i; 
  
    return count; 
}

void solve() {
    ll n;
    cin>>n;
    if (n%2){
        cout<<0<<endl;
        return;
    }
    cout<<findTrailingZeros(n/2)<<endl;
}
 
signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a, b, c;

int abs(int x) {
  return x < 0 ? -x : x;
}

int main() {
  scanf("%d%d%d", &a, &b, &c);
  int ans = abs(a - b) + abs(c - a);
  ans = min(ans, abs(c - b) + abs(c - a));
  ans = min(ans, abs(b - a) + abs(c - b));
  ans = min(ans, abs(c - a) + abs(c - b));
  ans = min(ans, abs(b - c) + abs(b - a));
  ans = min(ans, abs(a - c) + abs(b - a));
  printf("%d\n", ans);
  return 0;
}


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

int main(){
    int N, M, cnt;
    cin >> N >> M;
    int L[M], R[M], l, r;
    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
        if(i == 0){
            l = L[i];
            r = R[i];
        } else {
            if(l < L[i]) l = L[i];
            if(r > R[i]) r = R[i];
        }
    }
    cnt = 0;
    for(int i = 1; i <= N; i++){
        if(l <= i && i <= r) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

string S;
int w;
bool f;
string hold;

int main(){
    cin>>S>>w;

    for(int i;i<S.size();i=i+w){
            hold+=S.at(i);
            
            }

    cout<<hold<<endl;

    return 0;
}


Measured memory_bytes: 256
#ABC142-C Go to School
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))#ここは簡略化できそう
ans =list(A.argsort() + 1)
print(' '.join(map(str,ans)))#listを 3 2 1 8 みたいな表記にする方法

Measured memory_bytes: 23740
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;
int main() {
   int a, b, c;
   cin >> a >> b >> c;
   if (a < b && b < c)
      printf("Yes\n");
   else
      printf("No\n");
   return 0;
}


Measured memory_bytes: 3064
n = int(input())
p = list(map(int, input().split()))

def count(l, n):
    ans = 0
    for i in l:
        if i >= n:
            ans += 1
    return ans

for i in reversed(range(max(p)+1)):
    if count(p, i) >= i:
        print(i)
        break


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

constexpr int INF = 1e9;

int main() {
    int H, W; cin >> H >> W;
    vector<string> fld(H);
    for(int i = 0; i < H; ++i) {
        cin >> fld[i];
    }
    vector<vector<int>> ans(H, vector<int>(W, INF));
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            if(fld[i][j] == 'c') {
                for(int k = j; k < W; ++k) {
                    ans[i][k] = k - j;
                }
            }
            cout << (ans[i][j] == INF ? -1 : ans[i][j]) << " \n"[j + 1 == W];
        }
    }
}



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

int main(){
    string s;
    cin >> s;
    if(s.find('a') != string::npos && s.find('b') != string::npos && s.find('c') != string::npos){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>

class Baseball {

	std::array<bool, 3> base;//base[0]:first, base[1]:second, base[2]:third
	int point,outcount,inning;

public:
	/*construtor*/
	Baseball(int ing) {
		for (int i = 0; i < (int)base.size(); ++i){
			base[i] = false;
		}
		point = 0;
		outcount = 0;
		inning = ing;
	}

	int inning_result(std::string res);

private:
	void clear();
	void hit();
	void homerun();
	void out();
};

/*Clear method*/
void Baseball::clear() {

	for (int i = 0; i < (int)base.size(); ++i){
		base[i] = false;
	}

	point = 0;
	outcount = 0;

}

/*The case of hit*/
void Baseball::hit() {

	if (base[2] == true) {
		++point;
		base[2] = false;
	}

	if (base[1] == true){
		base[2] = true;
		base[1] = false;
	}

	if (base[0] == true) {
		base[1] = true;
		base[0] = false;
	}

	base[0] = true;

}

/*The case of homerun*/
void Baseball::homerun() {

	++point;//butter runner point

	for (int i = 0; i < (int)base.size(); ++i){
		if (base[i] == true){
			++point;
		}
		base[i] = false;
	}

}

/*The case of out*/
void Baseball::out() {

	++outcount;

	if (outcount == 3){
		std::cout << point << std::endl;
		clear();
		--inning;
	}

}

/*Judgement of inning*/
int Baseball::inning_result(std::string res) {

	if (res == "HIT") {
		hit();
	}
	else if (res == "HOMERUN") {
		homerun();
	}
	else if (res == "OUT") {
		out();
	}
	else {
		std::perror(NULL);
	}

	return inning;
}

int main() {

	int n;//the number of ining
	std::string result;

	std::cin >> n;

	Baseball game(n);

	while (n > 0) {
		std::cin >> result;
		n = game.inning_result(result);
	}

	return 0;
}

Measured memory_bytes: 3152
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	vint odd,even;
	int N;
	cin>>N;
	int alpha[2][SIZE]={};
	int num[2]={};
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		alpha[i%2][a]++;
		num[i%2]++;
	}
	int ans[2]={INF,INF};
	vpint v[2];
	for(int i=0;i<2;i++){
		for(int j=0;j<SIZE;j++){
			v[i].eb(num[i]-alpha[i][j],j);
		}
	}
	for(int i=0;i<2;i++)
		sort(v[i].begin(),v[i].end());
	if(v[0][0].second!=v[1][0].second)
		cout<<v[0][0].first+v[1][0].first<<endl;
	else
		cout<<min(v[0][0].first+v[1][1].first,v[0][1].first+v[1][0].first)<<endl;
	return 0;
}

Measured memory_bytes: 3316
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

def era(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

Q = i()
primes = []
l1 = era(100000)
for l in range(len(l1)):
    if l1[l] == 1:
        primes.append(l)
l2 = []
for l in primes:
    if (l+1)//2 in primes:
        l2.append(l)
for i in range(Q):
    l,r = I()
    print(bisect.bisect_right(l2,r)-bisect.bisect_left(l2,l))

Measured memory_bytes: 82172
import itertools

n = int(input())
l = [i + 1 for i in range(n)]

p = tuple([int(i) for i in input().split()])
q = tuple([int(i) for i in input().split()])

a = b = i = 0
for v in itertools.permutations(l, n):
    i += 1
    if v == p:
        a = i

    if v == q:
        b = i

print(abs(a - b))


Measured memory_bytes: 3060
t = input()
while t:
    b = [map(int, raw_input().split()) for i in xrange(9)]
    for i in xrange(9):
        pnt = ""
        for j in xrange(9):
            error = False
            # tate
            for k in xrange(9):
                if k==i:
                    continue
                if b[k][j] == b[i][j]:
                    error = True
                    break
            # yoko
            if not error:
                for k in xrange(9):
                    if k==j:
                        continue
                    if b[i][k] == b[i][j]:
                        error = True
                        break
            # 3 kake 3
            if not error:
                ix = j//3*3; iy = i//3*3
                for y in xrange(3):
                    if error:
                        break
                    for x in xrange(3):
                        if ix+x==j and iy+y==i:
                            continue
                        if b[iy+y][ix+x] == b[i][j]:
                            error = True
                            break

            pnt += "*%d"%b[i][j] if error else " %d"%b[i][j]
        print pnt
    if t>1:
        print
    t -= 1

Measured memory_bytes: 4288
#include <bits/stdc++.h>
using namespace std; 
    
int main(){
  int N,A;
  cin >> N;
  A=N%10;
  if(A==3){
    cout << "bon" << endl;
  }
  else if(A==0 || A==1 || A==6 || A==8){
    cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }
}
  
  

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
    public static void main(String[] arg){
        int a, b;
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();
        b = scan.nextInt();
        if(a > b){
        	System.out.println("a > b");
        }else if(a < b){
        	System.out.println("a < b");
        }else if(a == b){
        	System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26052
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d, e;
    int ans = 0;

    cin >> a >> b >> c >> d >> e;

    if (a < 0) {
        ans = (-1*a) * c;
        a = 0;
    }
    if (a == 0) {
        ans += d;
    }

    ans += (b - a) * e;

    cout << ans << endl;
}



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

const int mod = 1000000007;

int H, W;
int dp[2][1009];

int main() {
    cin >> H >> W;
    dp[0][0] = 1;
    char c;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> c;
            if(i || j) dp[i & 1][j] = 0; // 初期化
            if(c == '.') {
                if(i) dp[i & 1][j] += dp[i - 1 & 1][j];
                if(j) dp[i & 1][j] += dp[i & 1][j - 1];
                dp[i & 1][j] %= mod;
            }
        }
    }

    cout << dp[H - 1 & 1][W - 1] << endl;
}

Measured memory_bytes: 256
s=input()
t=input()
n=len(s)
k=len(t)
ans=10**18
for i in range(n-k+1):
    cnt=0
    for j in range(i,i+k):
        if s[j]!=t[j-i]:
            cnt+=1
    ans=min(ans,cnt)
print(ans)


Measured memory_bytes: 9108
def solve(a, x):
    i = 0
    total = 0
    res = 0
    for j in range(n):
        total += a[j]
        while total > x:
            total -= a[i]
            i += 1

        res +=  j - i + 1
    return res


n, q = map(int, input().split())
a = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]


for x_i in x:
    print(solve(a, x_i))


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

int N;
vector<ll> A;

void agc012a() {
  ll res = 0;
  sort(A.rbegin(), A.rend());
  for (int i = 1; i < 2 * N; i += 2) {
    res += A[i];
  }
  cout << res << "\n";
  return;
}

int main() {
  cin >> N;
  A.resize(3 * N);
  for (int i = 0; i < 3 * N; i++) {
    cin >> A[i];
  }
  agc012a();
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);
const int MAX=200010;


struct UnionFind {
    vector<int> par;
    vector<int> siz;
    UnionFind(int N) : par(N), siz(N, 1) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
    }

    bool issame(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) {
        return siz[root(x)];
    }
};


int main() {
    ios_base::sync_with_stdio(false);

    int n,m,k;
    cin >> n >> m >> k;
    vector<vector<int>> fri(n);
    UnionFind tree(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        --a; --b;
        tree.unite(a,b);
        fri[a].push_back(b);
        fri[b].push_back(a);
    }
    vector<int> blo(n);
    rep(i,k) {
        int c,d;
        cin >> c >> d;
        --c; --d;
        if (tree.issame(c,d)) {
            ++blo[c]; ++blo[d];
        }
    }
    rep(i,n) cout << tree.size(i)-fri[i].size()-blo[i]-1 << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 10360
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = 100000000+7;
const ll MAX_N = 100000;

ll n,ans,x,y,z;
ll a[MAX_N];
string s;
int main(){
  cin>>x>>y;
  ans=y;
  REP(i,x-1){
    ans*=(y-1);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
typedef complex<double> Point;
#define X real()
#define Y imag()
const double EPS = 1e-9;

double dot(Point a, Point b) {
	return a.X*b.X + a.Y*b.Y;
}

double cross(Point a, Point b) {
	return a.X*b.Y - a.Y*b.X;
}

string ccw(Point a, Point b, Point c) {
	b -= a;  c -= a;
	if (cross(b,c) >  EPS) return "COUNTER_CLOCKWISE";
	if (cross(b,c) < -EPS) return "CLOCKWISE";
	if (dot(b,c)   < -EPS) return "ONLINE_BACK";  // c--a--b on line
	if (norm(b) < norm(c)) return "ONLINE_FRONT"; // a--b--c on line or a==b
	return "ON_SEGMENT";                          // a--c--b on line or a==c or b==c
}

int main(void){
	double x1,y1,x2,y2,x,y;
	int q;
	cin>>x1>>y1>>x2>>y2>>q;
	rep(i,q){
		cin>>x>>y;
		cout<<ccw({x1,y1},{x2,y2},{x,y})<<endl;
	}
	return 0;
}

Measured memory_bytes: 3312
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    string s, t;
    cin >> s >> t;

    int ans = 0, ro = s.size();
    for (int i = 0; i < ro; i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

def solve():
    N = int(input())
    K = int(input())

    ans = 1
    for i in range(N):
        if (ans*2) < (ans+K):
            ans *= 2
        else:
            ans += K
    
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 998244353;
int main() {
//	freopen(".in","r",stdin);freopen(".out","w",stdout);
	string s,t;
	cin >> s >> t;
	bool check=true;
	for(int i = 0; i < s.size(); i++) check&=(s[i]==t[i]);
	if(check) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main() => new Program().Solve();

	void Solve()
	{
		var n = ReadLong();
		var a = ReadLongArray();
		var b = new bool[1000001];
		var h1 = new HashSet<long>();
		var h2 = new HashSet<long>();
		Array.Sort(a);

		foreach (var t in a) {
			if (b[t]) {
			} else if (h1.Add(t)) {
				for (var i = t << 1; i <= 1000000; i += t) {
					b[i] = true;
				}
			} else {
				h2.Add(t);
			}
		}

		Console.WriteLine((from t in a where !b[t] && !h2.Contains(t) select 1).Count());
	}

	#region Console.Read 関係
	long[] ReadLongArray() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	long ReadLong() => long.Parse(Console.ReadLine());
	#endregion
}


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

typedef long long ll;
ll n, k;
string a[110];

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

    cin>>n>>k;
    for(ll i=1; i<=n; i++) cin>>a[i];
    sort(a+1,a+1+n);
    for(ll i=1; i<=n; i++) cout<<a[i];


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int ans = (n - 1) / 2 + 1;

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


Measured memory_bytes: 256
n = int(input())

def prime_factor(n):
    prime_list = []
    
    for i in range(2,int(n**0.5)+1):
        repeat = 0
        while n % i == 0:
            n /= i
            repeat += 1
        if repeat > 0:
            prime_list.append([i,repeat])
        if n == 1:
            break
    if n > 1:
        prime_list.append([n,1])
    return prime_list

p = prime_factor(n)

count = 0
for prime in p:
    power = prime[1]
    time = 1
    while power > 0 and power >= time:
        power -= time
        time += 1
        count+=1
print(count)

Measured memory_bytes: 9476
import numpy as np

N = int(input())
P = list(map(float, input().split()))

dp = np.zeros(N+1)
dp[0] = 1

for i in range(1, N+1):
  dp[1:] = dp[:-1]*P[i-1] + dp[1:]*(1-P[i-1])

print(dp[(N+1)//2])



Measured memory_bytes: 14520
def countingSort(a,m):
    m += 100
    cnt = [0]*m
    for i in a:
        cnt[i] += 1
    i = 0
    for b in range(m):
        for c in range(cnt[b]):
            a[i] = b
            i+=1
    return a
n = int(input())
a = countingSort(list(map(int,input().split())),n)
print(*a)


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

using namespace std;
using ll = long long;
using ii = pair < int , int >;
using i3 = pair < int , ii >;
using vi = vector < int >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n , m;

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

    int diff = abs(n - m);
    if(diff & 1){
        printf("IMPOSSIBLE\n");
        return;
    }

    printf("%d\n" , diff/2 + min(n , m));

}

main(){

    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
        solve();
    }

    return 0;
}


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

using namespace std;

struct Rect {
	int w, h;

	Rect() {}
	Rect(int w, int h) : w(w), h(h) {}
	int D() { return w*w + h*h; }
};
bool operator <( Rect& r1,  Rect& r2) {
	return r1.D() == r2.D() ? r1.h < r2.h : r1.D() < r2.D();
}

int main() {
	Rect base;
	while ( cin >> base.h >> base.w, base.h || base.w ) {
		Rect ans = Rect(200, 200);
		for (int w = 1; w <= 150; ++w) {
			for (int h = 1; h < w; ++h) {
				Rect r(w, h);
				if (base < r && r < ans) ans = r;
			}
		}
		cout << ans.h << " " << ans.w << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;


int main() {
    int n, k;

    cin >> n >> k;

    vector<int> v(n);

    for(int i = 0; i < n; ++i) cin >> v[i];

    sort(v.begin(), v.end(), [=](int a, int b) { return a > b; });

    int ans {};

    for(int i = 0; i < k; ++i) ans += v[i];

    cout << ans << endl;

    return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MX 105
#define ll long long int
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x,y,sizeof(x))
using namespace std;
ll n,a,vis[10],x=0;
int main()
{
    scanf("%lld",&n);
    for(ll i=0;i<n;i++)
    {
        scanf("%lld",&a);
        if(a>=1&&a<=399)
            vis[1]=1;
        else if(a>=400&&a<=799)
            vis[2]=1;
        else if(a>=800&&a<=1199)
            vis[3]=1;
        else if(a>=1200&&a<=1599)
            vis[4]=1;
        else if(a>=1600&&a<=1999)
            vis[5]=1;
        else if(a>=2000&&a<=2399)
            vis[6]=1;
        else if(a>=2400&&a<=2799)
            vis[7]=1;
        else if(a>=2800&&a<=3199)
            vis[8]=1;
        else x++;
    }
    ll mn=0,mx=0;
    for(ll i=1;i<=8;i++)
    {
        if(vis[i])
        {
            mn++;
        }
    }
    mx=mn+x;
    if(mn==0)mn=1;
    printf("%lld %lld\n",mn,mx);
}


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

int main() {
  int a, b;
  cin >> a >> b;
  a--;
  // 1 + ac >= b
  // ac >= b - 1
  // c >= (b - 1) / a
  int c = (b + a - 2) / a;
  if (c < 0) c = 0;
  cout << c << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;

int ans=0;

int main()
{
	int n;
	scanf("%d",&n);
	while(n!=0)
	{
		int x=n%10;
		if(x==2)
		ans++;
		n/=10;
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

type Position = []int

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		h := nextInt()
		w := nextInt()

		if h == 0 && w == 0 {
			break
		}
		positions := map[string]Position{}
		for i := 0; i < h; i++ {
			row := nextString()
			for j := 0; j < w; j++ {
				pos := []int{i, j}
				positions[row[j:(j+1)]] = pos
			}
		}
		// fmt.Println(positions)

		x := 0
		y := 0
		totalDistance := 0

		queryRow := nextString()
		for i := 0; i < len(queryRow); i++ {
			q := queryRow[i:(i + 1)]

			nextPos := positions[q]
			xNext := nextPos[0]
			yNext := nextPos[1]

			totalDistance += abs(xNext-x) + abs(yNext-y) + 1
			x = xNext
			y = yNext
			// fmt.Println(nextPos, totalDistance)
		}
		fmt.Println(totalDistance)
	}
}



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

int main()
{
  long long n, k;
  cin >> n >> k;
  cout << min((n % k), (k-n%k)) << endl;
  return 0;
}


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

#include <bits/stdc++.h>
#include <atcoder/dsu>
/*#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
    struct dsu {
    public:
        dsu() : _n(0) {}
        dsu(int n) : _n(n), parent_or_size(n, -1) {}

        int merge(int a, int b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            int x = leader(a), y = leader(b);
            if (x == y) return x;
            if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
            parent_or_size[x] += parent_or_size[y];
            parent_or_size[y] = x;
            return x;
        }

        bool same(int a, int b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            return leader(a) == leader(b);
        }

        int leader(int a) {
            assert(0 <= a && a < _n);
            if (parent_or_size[a] < 0) return a;
            return parent_or_size[a] = leader(parent_or_size[a]);
        }

        int size(int a) {
            assert(0 <= a && a < _n);
            return -parent_or_size[leader(a)];
        }

        std::vector<std::vector<int>> groups() {
            std::vector<int> leader_buf(_n), group_size(_n);
            for (int i = 0; i < _n; i++) {
                leader_buf[i] = leader(i);
                group_size[leader_buf[i]]++;
            }
            std::vector<std::vector<int>> result(_n);
            for (int i = 0; i < _n; i++) {
                result[i].reserve(group_size[i]);
            }
            for (int i = 0; i < _n; i++) {
                result[leader_buf[i]].push_back(i);
            }
            result.erase(
                    std::remove_if(result.begin(), result.end(),
                                   [&](const std::vector<int>& v) { return v.empty(); }),
                    result.end());
            return result;
        }

    private:
        int _n;
        // root node: -1 * component size
        // otherwise: parent
        std::vector<int> parent_or_size;
    };

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP*/


using namespace std;
using namespace atcoder;

class ADisjointSetUnion {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, q;
        in >> n >> q;
        dsu ds(n);
        while (q--) {
            int t, u, v;
            in >> t >> u >> v;
            if (t) out << ds.same(u, v) << '\n';
            else ds.merge(u, v);
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ADisjointSetUnion solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3976
#include <atcoder/convolution>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(m);
  for (int& x : a) cin >> x;
  for (int& x : b) cin >> x;
  for (int& x : atcoder::convolution(a, b)) cout << x << '\n';
  return 0;
}

Measured memory_bytes: 19020
A, B, C, X, Y = [int(i) for i in input().split()]

ans1 = 0
ans2 = 0
if (A+B) <= 2*C:
    print(A*X + B*Y)
else:
    ans1 = A*(X-min(X, Y)) + B*(Y-min(X, Y)) + 2*C*min(X, Y)
    ans2 = 2*C*max(X, Y)
    print(min(ans1, ans2))


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

int main() {
  int a, b, c, d, e, aa, bb, cc, dd, ee, m, n, o, p, i;
  cin >> a >> b >> c >> d >> e;
  
  aa = a % 10;
  bb = b % 10;
  cc = c % 10;
  dd = d % 10;
  ee = e % 10;
  
  if(aa == 0){
    aa += 10;
  }
  
  if(bb == 0){
    bb += 10;
  }
  
  if(cc == 0){
    cc += 10;
  }
  
  if(dd == 0){
    dd += 10;
  }
  
  if(ee == 0){
    ee += 10;
  }
  
  m = min(aa, bb);
  n = min(cc, dd);
  o = min(m, n);
  p = min(o, ee);
  
  for(i = 1; i < 10; i++){
    if(aa == i){
      a += 10 - i;
      break;
    }
  }
  
    for(i = 1; i < 10; i++){
    if(bb == i){
      b += 10 - i;
      break;
    }
  }
  
    for(i = 1; i < 10; i++){
    if(cc == i){
      c += 10 - i;
      break;
    }
  }
  
    for(i = 1; i < 10; i++){
    if(dd == i){
      d += 10 - i;
      break;
    }
  }
  
    for(i = 1; i < 10; i++){
    if(ee == i){
      e += 10 - i;
      break;
    }
  }
  
  cout << a + b + c + d + e - 10 + p << endl;
}


Measured memory_bytes: 256
use proconio::{input, marker::Usize1};

fn chmax(a: &mut Option<i32>, b: i32) {
    *a = Some(if let Some(v) = *a {
        v.max(b)
    } else {
        b
    });
}
fn rotate(x: &mut usize, y: &mut usize, z: &mut usize) {
    let w = *x;
    *x = *y;
    *y = *z;
    *z = w;
}

struct DP {
    l12: Vec<Vec<Option<i32>>>,
    l1_max: Vec<Option<i32>>,
    l2_max: Vec<Option<i32>>,
    max: Option<i32>,
    n: usize,
}

impl DP {
    fn new(n: usize) -> DP {
        DP {
            l12: vec![vec![None; n + 1]; n + 1],
            l1_max: vec![None; n],
            l2_max: vec![None; n],
            max: Some(0),
            n: n,
        }
    }
    fn set(&mut self, l1: usize, l2: usize, v: i32) {
        if l2 != self.n {
            chmax(&mut self.l12[l1][l2], v);
            chmax(&mut self.l12[l2][l1], v);
            chmax(&mut self.l1_max[l2], v);
            chmax(&mut self.l2_max[l2], v);
        }
        chmax(&mut self.l1_max[l1], v);
        chmax(&mut self.l2_max[l1], v);
        chmax(&mut self.max, v);
    }
}

fn main() {
    input! {
        n: usize,
        a: [Usize1; n * 3],
    }

    let mut dp = DP::new(n);
    dp.set(a[0], a[1], 0);
    let mut mc = 0;
    for i in 1..n {
        let (mut x, mut y, mut z) = (a[i * 3 - 1], a[i * 3], a[i * 3 + 1]);
        if x == y && x == z {
            mc += 1;
        } else {
            let mut q = vec![];
            for _ in 0..3 {
                for l in 0..n {
                    if let Some(l1_max) = dp.l1_max[l] {
                        let mut v = l1_max;
                        if y == z {
                            if let Some(l12) = dp.l12[l][y] {
                                v = v.max(l12 + 1);
                            }
                        }
                        q.push((l, x, v));
                    }
                }
                let mut v = dp.max.unwrap();
                if y == z {
                    if let Some(l1_max) = dp.l1_max[y] {
                        v = v.max(l1_max + 1);
                    }
                }
                q.push((x, n, v));

                let mut v = dp.max.unwrap();
                if let Some(l12) = dp.l12[z][z] {
                    v = v.max(l12 + 1);
                }
                q.push((x, y, v));
                rotate(&mut x, &mut y, &mut z);
            }
            for (x, y, v) in q {
                dp.set(x, y, v);
            }
        }
    }
    let l = a[3 * n - 1];
    let mut v = dp.max.unwrap();
    if let Some(l12) = dp.l12[l][l] {
        v = v.max(l12 + 1);
    }
    println!("{}", v + mc);
}


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

int main (){
    string a,b;
    cin >> a >>b;
    if(a[0]==b[2] && b[0] == a[2] && a[1] == b[1]){
        cout << "YES";
    }else{
        cout << "NO";
    }
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    ans = 10**5 * 2
    A, B, M = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = sorted(a)[0] + sorted(b)[0]
    
    for i in range(M):
        x, y, c =  map(int, input().split())
        cost = a[x-1] + b[y-1] - c
        ans = min(ans, cost)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 18616
def sum_base10to(n, b):
    if n // b:
        return sum_base10to(n // b, b) + n % b
    return n % b


n = int(input())
i = 0
res = n
for i in range(n + 1):
    cc = sum_base10to(i, 6) + sum_base10to(n - i, 9)
    if cc < res:
        res = cc
print(res)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,d=0;
	cin>>n;
	long long int a[n];
	for(long long int i=0;i<n;++i)
	{
		
	cin>>a[i];
	}
	for(long long int i=1;i<n-1;++i)
	{
		
		if((a[i-1]<a[i] && a[i+1]>a[i]) || (a[i-1]>a[i] && a[i+1]<a[i]))
		{
			++d;
		}
	}
	cout<<d;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PA;
int main(){
  int n,k,a,from,to,cost;
  int min_cost[101];
  priority_queue<PA,vector<PA>,greater<PA> > pq;
  while(scanf("%d %d",&n,&k) && n!=0&&k!=0){
    vector<PA> vec[101];
    for(int i=0;i<k;i++){
      scanf("%d %d %d",&a,&from,&to);
      if(a == 0){
	fill(min_cost,min_cost+101,INT_MAX);
	pq.push(PA(0,from));
	min_cost[from] = 0;
	while(!pq.empty()){
	  PA p = pq.top();
	  pq.pop();
	  for(int j=0;j<vec[p.second].size();j++){
	    int next_cost = p.first + vec[p.second][j].first;
	    int next_to = vec[p.second][j].second;
	    if(min_cost[next_to] > next_cost){
	      min_cost[next_to] = next_cost;
	      pq.push(PA(next_cost,next_to));
	    }
	  }
	}
	printf("%d\n",min_cost[to]==INT_MAX?-1:min_cost[to]);
      }
      if(a == 1){
	scanf("%d",&cost);
	vec[from].push_back(PA(cost,to));
	vec[to].push_back(PA(cost,from));
      }
    }
  }
  return (0);
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;

ll sum(ll p, ll q){
    // qをp進法表示した時の桁の和
    if(q<p) return q;
    else{
        return sum(p,(q/p))+(q%p);
    }
}



void solve(){

    ll n,s;
    cin >> n >> s;
    /*
    if(s>(n+2)/2){
        cout << -1 << endl;
        return;
    }
    */

    if(s==n) {
        cout << s+1 << endl;
        return;
    }

    ll root = ll(sqrt(n))+1;
    for(ll i=2; i<=root; i++){
        if(sum(i,n)==s){
            cout << i << endl;
            return;
        }
    }
    
    for(ll x=root; x>=1; x--){
        if((n-s)%x==0){
            ll y = s-x;
            ll b = (n-s)/x + 1;
            //cout << x << " " << y << " " << b << endl;
            if(1<=x&&x<b&&0<=y&&y<b){
                cout << b << endl;
                //cout << "x:" << x << " n-s:" << n-s << endl;
                return;
            }
        }
    }

    cout << -1 << endl;

}

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


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

bool check(long a, long b, long c) {
	if (c - a - b < 0) {
		return false;
	}
	return (c - a - b) * (c - a - b) > 4 * a * b;
}

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

	cout << (check(a, b, c) ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m  = sc.nextInt();
        int d = sc.nextInt();

        if (d == 0) {
            System.out.println((double) (m- 1) / (double) n);
        } else {
            System.out.println((double) 2 * (n - d) * (m - 1)/ (double) Math.pow(n, 2));
        }


        System.out.println();
    }

}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>

using namespace std;

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

#define REP(var,n) for(int var=0;var<(n);var++)
#define REPP(var,n) for(int var=1;var<(n);var++)
#define ALL(c) (c).begin(),(c).end()

int main(){
    int D;
    ll G,c,p;

    cin >> D >> G;

    vector<P> x(D);
    REP(i,D){
        cin >> p >> c;
        x[i] = make_pair(p,c);
    }

    ll res = 1 << 29;

    for(int bit = 0; bit < (1<<D); ++bit){
        ll sum = 0;
        ll num = 0;
        for(int i=0; i< D; ++i){
            if(bit & (1<<i)){
                sum += x[i].second + x[i].first*100*(i+1), num += x[i].first;
            }
        }
        if(sum >= G) res = min(res, num);
        else{
            for(int i=D-1; i>=0; i--){
                if(bit & (1<<i)) continue;
                for(int j=0; j<x[i].first; ++j){
                    if(sum >= G) break;
                    sum += 100*(i+1);
                    ++num;
                }
            }
            if(sum >= G) res = min(res, num);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
n=int(input())
txy=[list(map(int,input().split())) for i in range(n)]
txy.insert(0,[0,0,0])

ans=0
for i in range(len(txy)-1):
    time=txy[i+1][0]-txy[i][0]
    dis=txy[i+1][1]-txy[i][1]+txy[i+1][2]-txy[i][2]
    if time>=dis and time%2==dis%2:
        ans+=0
    else:
        ans+=1

if ans==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 27300
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable long MOD = 998244353;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    s = readln.split.map!(to!int);
    auto R = s[0];
    auto S = s[1];
    auto P = s[2];
    auto T = readln.chomp;

    int[dchar] score;
    score['r'] = P;
    score['s'] = R;
    score['p'] = S;
    auto past = new dchar[](N);
    int ans = 0;

    foreach (i; 0..N) {
        if (i < K) {
            ans += score[T[i]];
            past[i] = T[i];
        } else if (past[i-K] != T[i]) {
            ans += score[T[i]];
            past[i] = T[i];
        } else {
            past[i] = '.';
        }
    }

    ans.writeln;
}

Measured memory_bytes: 2812
# 2019/06/05
# AtCoder Beginner Contest 113 - C

from operator import itemgetter

# Input
n, m = map(int, input().split())

citylist = list()

for i in range(m):
    p, y = map(int, input().split())
    wlist = [i, p, y, 0]
    citylist.append(wlist)

# Sort(Pref, Year)
citylist.sort(key=itemgetter(2))
citylist.sort(key=itemgetter(1))

# Add Number & Output
wp = ""
for i in range(m):
    if wp != citylist[i][1]:
        ycnt = 1
        wp = citylist[i][1]
    else:
        ycnt += 1
    citylist[i][3] = ycnt

citylist.sort(key=itemgetter(0))

for i in range(m):
    ans1 = str(citylist[i][1]).zfill(6)
    ans2 = str(citylist[i][3]).zfill(6)
    print(ans1+ans2)


Measured memory_bytes: 28980
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


int main() {
	ll a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	ll K;
	cin >> K;
	cout << a[K - 1];
	

	system("PAUSE");

}





Measured memory_bytes: 504
/**
 * Created by kaki on 2017/04/17.
 */

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int S = Integer.parseInt(scan.next());
        int m = 0;
        int h = 0;
        while (S > 59) {
            S -= 60;
            m += 1;
        }
        while (m > 59) {
            m -= 60;
            h += 1;
        }
        System.out.println(h + ":" + m + ":" + S);
    }
}

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

int main()
{
  double a, b, C;
  cin >> a >> b >> C;
  double pi = 3.14159265358979;
  double rad = C * pi / 180;
  double c = sqrt(a * a + b * b - 2 * a * b * cos(rad));
  cout << fixed << setprecision(10) << a * b * sin(rad) * 1/2 << endl;;
  cout << fixed << setprecision(10) << a + b + c << endl;
  cout << 2 * (a * b * sin(rad) * 1/2) / a << endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(i,x,y) for(int (i)=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second

typedef long long int lli;
typedef pair<int,int> Pi;

const int INF=100000000;
const long long int INF_=1000000000000000000;

class UnionFind{
	private:
	vector<int> parent,rank;
	int _n_;
	public:
	void Init(int n){
		_n_=n;
		parent.resize(n);
		rank.resize(n);
		REP(i,0,n){
			parent[i]=i;
			rank[i]=0;
		}
	}
	
	int Find(int x){
		if(parent[x]==x) return x;
		else return parent[x]=Find(parent[x]);
	}
	
	void Unite(int x,int y){
		x=Find(x);
		y=Find(y);
		if(x==y) return;
		if(rank[x]<rank[y]){
			parent[x]=y;
		} else {
			parent[y]=x;
			if(rank[x]==rank[y]) ++rank[x];
		}
	}
	
	bool IsSame(int x,int y){
		return Find(x)==Find(y);
	}
	
	int Count(){
		int result=0;
		for(int i=0; i<_n_; ++i) if(Find(i)==i) ++result;
		return result;
	}
};

int main(){
	int V,D;
	UnionFind uf;
	vector<int> f(1002);
	f[0]=1; f[1]=2;
	REP(i,2,1002){
		f[i]=(f[i-1]+f[i-2])%1001;
	}
	while(cin >> V >> D){
		uf.Init(V+1);
		REP(i,1,V+1){
			REP(j,1,V+1){
				if(abs(f[i]-f[j])<D) uf.Unite(i,j);
			}
		}
		int ans=0;
		REP(i,1,V+1) if(uf.Find(i)==i) ++ans;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1248
//
// Created by zono on 18/10/27.
//

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

int main() {
	string s;
	cin >> s;
	if (s.size() == 2) cout << s << endl;
	else {
		reverse(s.begin(), s.end());
		cout << s << endl;
	}
	return 0;
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

long double ans;
long double n,m,d;

int main(){
  cin>>n>>m>>d;
  cout<<setprecision(1000);
  if(d==0)cout<<((m-1)/n)<<endl;
  else cout<<(2*(n-d)*(m-1)/(n*n))<<endl;
  return 0;
}



Measured memory_bytes: 256