akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int solve2(string& s,int& i);
int solve(string& s,int& i){
    int ret=solve2(s,i);
    while(s[i]=='*'||s[i]=='+'){
        if(s[i]=='*'){
            ret=min(ret,solve2(s,++i));
        }
        else {
            ret=max(ret,solve2(s,++i));
        }
    }
    return ret;
}

int solve2(string& s,int& i){
    if('0'<=s[i]&&s[i]<='2'){
        return s[i++]-'0';
    }
    if(s[i]=='-')return 2-solve2(s,++i);
    ++i;
    int ret=solve(s,i);
    ++i;
    return ret;
}


void solve3(string& s){
    int ans=0;
    rep(i1,3)rep(i2,3)rep(i3,3){
        string t=s;
        rep(j,s.size()){
            if(t[j]=='P')t[j]=i1+'0';
            if(t[j]=='Q')t[j]=i2+'0';
            if(t[j]=='R')t[j]=i3+'0';
        }
        int k=0;
        int ret=solve(t,k);
        if(ret==2)++ans;
    }
    cout<<ans<<endl;
}
int main(){
    string s;
    while(cin>>s,s!=".")solve3(s);
    return 0;
}


Measured memory_bytes: 3160
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, vector<long long> a) {
  int L[3] = {};
  int two = 0;

  REP(i, N) {
    ll b = 0;
    if (a[i] % 2 == 0) {
      if (a[i] % 4 == 0) {
        b = 2;
      } else {
        b = 1;
      }
    }
    L[b]++;
  }

  bool flag = false;
  if (L[1] > 0) {
    flag = L[0] <= L[2];
  } else {
    flag = L[0] - 1 <= L[2];
  }

  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> a(N - 1 + 1);
  for (int i = 0; i <= N - 1; i++) {
    cin >> a[i];
  }
  solve(N, a);
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int a[5000];
int b[5000];
int max(int a,int b){return a>b?a:b;}
int main(){
	int m,n;
	int i,j;
	scanf("%d %d",&m,&n);
	for(i=0;i<m;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);
	int ca;
	int ans=0;
	for(i=0;i<n;i++){
		ca=0;
		for(j=i;j<n;j++){
			while(ca<m&&a[ca]!=b[j])ca++;
			if(ca==m)break;
			ca++;
		}
		ans=max(ans,j-i);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 1064
N = int(input())
a = list(map(int, input().split()))

a1 = a[:]

for i in range(N-1):
    if a1[i] < 0:
        a1[i] *= -1
        a1[i+1] *= -1
    a[i] = abs(a[i])

a[N-1] = abs(a[N-1])

print(max(sum(a1), sum(a)-2*min(a)))


Measured memory_bytes: 14332
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include<stack>
#include <unordered_map>

using namespace std;

#define MAX(A,B) (A)>(B)?(A):(B)
#define MIN(A,B) (A)<(B)?(A):(B)

int main() {
	string S;
	cin >> S;
	if (S > "2019/04/30") {
		cout << "TBD";
	}
	else {
		cout << "Heisei";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	int n; cin>>n;
	vl a(n),b(n);
	ll cnt=0;
	rep(i,0,n)cin>>a[i]>>b[i];
	for(ll i=n-1;i>=0;--i){
		a[i]+=cnt;
		if(a[i]%b[i]==0)continue;
		ll add=b[i]-(a[i]%b[i])%b[i];
	//	cout<<i<<" "<<a[i]<<" "<<add<<endl;
		cnt+=add;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 4816
n,q=map(int,input().split())
s=input()
a=[0]
total=0
for i in range(1,len(s)):
    if s[i]=='C':
        if s[i-1]=='A':
            total+=1
    a.append(total)
a.append(total)

for _ in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])



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

int main(){
    int a, b;
    cin >> a >> b;
    if(a > b)
        cout << "a > b" << endl;
    if(a < b)
        cout << "a < b" << endl;
    if(a == b)
        cout << "a == b" << endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  int N = s.length();
  s.push_back('R');
  int rcount = 0;
  int lcount = 0;
  vector<int> v(N+1);
  rep(i,s.length()){
    v[i] = 0;
    if(s[i] == 'R'){
      if(lcount != 0){
        v[i-lcount] = (lcount+rcount)/2;
        v[i-lcount-1] = (lcount+rcount)/2;
        if((lcount+rcount)%2 == 1){
          bool lup = true;
          if(lcount>rcount) lup = !lup;
          if(max(lcount,rcount)%2 == 1) lup= !lup;
          if(lup)++v[i-lcount];
          else ++v[i-lcount-1];

          //if(lcount>rcount){
          //  if(lcount%2 == 1)++v[i-lcount];
          //  else ++v[i-lcount-1];
          //} else{
          //  if(rcount%2 == 1)++v[i-lcount-1];
          //  else ++v[i-lcount];
          //}

        }
        lcount = 0;
        rcount = 0;
      }
      ++rcount;
    }else ++lcount;
  }
  rep(i,N) cout << v[i] SPF;
  cout << endl;
  return 0;
}


Measured memory_bytes: 1104
#include<iostream>
#include<cmath>
#include<string>
#include<list>
#include<vector>
#include<algorithm>
#include<numeric>
#include<queue>
#include<utility>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
	/*
	cin>>x;
	cout<<x<<endl;
	*/
	int a,b,c,i,j,k,l,n,m,ans=0;

	cin>>a>>b;
	cout<<(a*3+b)/2<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict as dd

# お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*args):
    return tuple(p(v) for p, v in zip(args, input().split()))

# エントリーポイント
def main():
    N, M = parse(int, int)

    AB = dd(int)
    for _ in range(N):
        a, b = parse(int, int)
        AB[a] += b
    shops = sorted(AB.keys())

    m, cost = M, 0
    for price in shops:
        count = AB[price]
        if m <= count:
            cost += price * m
            break
        else:
            cost += price * count
            m -= count
    print(cost)

main()


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  set<int64_t> st;
  rep(i, 999) {
    st.insert((i + 1) * (i + 2) / 2);
  }
  int64_t a, b; cin >> a >> b;
  REP(i, 1, 499500) {
    auto it1 = st.find(i + a);
    auto it2 = st.find(i + b);
    if (it1 == st.end() || it2 == st.end()) continue;
    if (std::next(it1) != it2) continue;
    cout << i << "\n";
    exit(0);
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define prob "D"
#define N 100001
#define ii pair< int, int>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define io freopen(prob".inp","r",stdin); freopen(prob".out","w",stdout);
using namespace std;
int n,k;
string s;
int main()
{
//    io
    cin>>n>>k;
    cin>>s;
    int cur=0;
    for(int i=0;i<n;i++)
    {
        if(i>0&&s[i]=='L') cur+=(s[i-1]=='L');
        if(i<n-1&&s[i]=='R') cur+=(s[i+1]=='R');
    }
    cout<<min(n-1,cur+2*k);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,C;
   cin>>A>>B>>C;
  
  bool ans=false;
  for(int i=1; i<=B; i++){ // iはBまで増加すると、i=1の結果に
    if((A*i)%B==C){ans=true;} //ループするため、iの上限はBとする。
  }
  if(ans){cout<<"YES";}
  else{cout<<"NO";}
}


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

int main(){
    int64_t h ;
    cin >> h ;
    int64_t ans = 0 ;
    int64_t current = 1 ;
    while (h > 0)
    {
        ans += current ;
        h = h/2 ;
        current *= 2 ;
    }
    cout << ans << endl ;
}    

Measured memory_bytes: 256
#include <iostream>

#include <map>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

const ll MAX { 200010 };
int as[MAX];


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

    int N;
    cin >> N;

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

    sort(as, as + N);

    int ai = as[N - 1];
    int aj = -1, dist = 2000000010;

    for (int i = 0; i < N - 1; ++i)
    {
        int k = min(as[i], ai - as[i]);

        if (ai/2 - k < dist)
        {
            aj = as[i];
            dist = ai/2 - k;
        }
    }

    cout << ai << " " << aj << endl;

    return 0;
}


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

int main(){
    string s;
    int q;
    cin >> s >>q;
    bool toggle = false;
    string head="",tail="";
    rep(i,q){
        int t,f;
        string c;
        cin >> t;
        if(t == 1){
            toggle = !toggle;
        }else{
            cin >> f >> c;
            if(f == 1){
                if(toggle){
                    tail = tail + c;
                }else{
                    head = c + head;
                }
            }else{
                if(toggle){
                    head = c + head;
                }else{
                    tail = tail + c;
                }

            }
        }
    }
    s = head + s + tail;
    if(toggle)reverse(s.begin(),s.end());
    cout << s << endl;
}

Measured memory_bytes: 1512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	a, b := nextLine(), nextLine()
	var aBuffer bytes.Buffer
	bInt, _ := strconv.Atoi(b)
	for i := 0; i < bInt; i++ {
		aBuffer.WriteString(a)
	}

	var bBuffer bytes.Buffer
	aInt, _ := strconv.Atoi(a)
	for i := 0; i < aInt; i++ {
		bBuffer.WriteString(b)
	}

	if aBuffer.String() <= bBuffer.String() {
		fmt.Println(aBuffer.String())
	} else {
		fmt.Println(bBuffer.String())
	}
}

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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

typedef long long int ll;
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0;i < N;i++)cin >> A[i];
    ll ans = 0;
    for(int i = 0;i < N;i++){
     ans += A[i] - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

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

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
  fastio;
  int a;
  string s;
  cin >> a >> s;
  if(a < 3200) cout << "red" << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
const ll mod = 1e9 + 7;

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

ll f(ll x, ll c, ll d) {
    ll res = x;
    res -= x / c;
    res -= x / d;
    res += x / lcm(c, d);
    return res;
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = 0;

    ans = f(b, c, d) - f(a - 1, c, d);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isPossible(x) printf("%s\n",(x) ? "Possible" : "Impossible")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
// #define INF (1<<29)

const long long INF = 1LL<<50;

#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
// const int mod =(int)998244353;
const int mod =(int)1e9+7;

const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
  if(a<0)a=-a;
  if(b<0)b=-b;
    ll g;g=gcd(a,b);
    return b/g*a;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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() {
    ios::sync_with_stdio(false);
    int N,X,T;
    cin>>N>>X>>T;
    int ans=0;
    while(ans*X<N){
        ans++;
    }
    cout<<ans*T<<endl;
    return 0;
} 
 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int dp[100001];

int main(){
	int n;
	string s;
	cin >> s;
	n = (int)s.size();
	
	int p=0,g=0;
	int win=0;
	REP(i,n){
		if(s[i]=='g'){
			if(p < g){
				p++;
				win++;
			}else{
				g++;
			}
		}else{
			if(p < g){
				p++;
			}else{
				g++;
				win--;
			}
		}
	}
	
	cout << win << endl;
	
	return 0;
}

Measured memory_bytes: 3752
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;

int main(){
  int N, K;
  cin >> N >> K;
  ll ans=0;
  int start=K;
  if(!start)
    start++;
  for(int i=K+1; i<=N; i++){
    ans += (1+(N-start)/i)*(i-K)-max(start+(N-start)/i*i+(i-K-1)-N,0);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
import math

def resolve():
    import sys
    input = sys.stdin.readline
    n, d = [int(x) for x in input().rstrip().split(" ")]

    ans = 0
    points = []

    for i in range(n):
        current = [int(x) for x in input().rstrip().split(" ")]
        for point in points:
            dist = math.sqrt(sum([(a - b)**2 for a, b in zip(point, current)]))
            if dist.is_integer():
                ans += 1
        points.append(current)

    print(ans)



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 62472
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const long long MOD = 1000000007;

ll N, K, A[200010];

//f(x in [MIN, l]) = false, f(x in [r, MAX]) = true
long long binsearch(long long l, long long r, bool (*f)(long long)){
    if(f(l)) return l;
    while(r - l > 1){
        long long m = (l + r) / 2;
        if(f(m)) r = m;
        else l = m;
    }
    return r;
}

bool ok(long long x){
    if(x == 0) return false;
    ll cut = 0;
    REP(i, N) cut += (A[i] + x - 1) / x - 1;
    return cut <= K;
}

signed main(){
    cin >> N >> K;
    REP(i, N) cin >> A[i];
    PRINT(binsearch(0, LONG_LONG_MAX, ok));
    return 0;
}

Measured memory_bytes: 5140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderRegularContest069
{
    public class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(program1(new String[] { Console.ReadLine(), Console.ReadLine() }));
        }

        public static string program1(string[] args)
        {
            var n = int.Parse(args[0]);
            var s = args[1].ToCharArray();

            var animalPattern = new List<char>[] { new List<char>() { 'S', 'S' }, new List<char> { 'S', 'W' }, new List<char> { 'W', 'W' }, new List<char> { 'W', 'S' } };

            return string.Join("", animalPattern.Where(animals => {
                s.Skip(1).Aggregate(animals.First(), (ani, ans) =>
                {
                    var current = animals.Last();
                    if (ans == 'o' && current == 'S' || ans == 'x' && current == 'W')
                    {
                        animals.Add(ani);
                    }
                    else
                    {
                        animals.Add(ani == 'S' ? 'W' : 'S');
                    }
                    return current;
                });
                return animals.First() == animals.Last();
            })
            .Select(animals => animals.Take(n))
            .FirstOrDefault(animals => {
                if (s.First() == 'o' && animals.First() == 'S' || s.First() == 'x' && animals.First() == 'W')
                {
                    return animals.ElementAt(1) == animals.Last();
                }
                else
                {
                    return animals.ElementAt(1) != animals.Last();
                }
            }) ?? new List<char>() { '-', '1' }) ;
        }
    }
}


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

using namespace std;

int main() {
    int a,b;
    cin>>a;
    if(a<=9)
        cout<<"Yes";
    else if(a%2==0 && a/2<=9)    cout<<"Yes";
    else if(a%3==0 && a/3<=9)    cout<<"Yes";
    
    else if(a%4==0 && a/4<=9)    cout<<"Yes";
    else if(a%5==0 && a/5<=9)    cout<<"Yes";
    
    else if(a%6==0 && a/6<=9)    cout<<"Yes";
    else if(a%7==0 && a/7<=9)    cout<<"Yes";
    
    else if(a%8==0 && a/8<=9)    cout<<"Yes";
    else if(a%9==0 && a/9<=9)    cout<<"Yes";
    else    cout<<"No";
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace Abc138
{
    class QuestionD
    {
        private static List<int>[] edges;
        private static int[] counters;

        public static void Main(string[] args)
        {
            // 整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);

            //枝のリストを作る
            edges = new List<int>[n];

            for (int i = 0; i < n - 1; i++)
            {
                string[] edge = Console.ReadLine().Split(' ');
                int parent = int.Parse(edge[0]) - 1;
                if (edges[parent] == null)
                {
                    edges[parent] = new List<int>() { int.Parse(edge[1]) - 1 };
                }
                else
                {
                    edges[parent].Add(int.Parse(edge[1]) - 1);
                }
            }

            //カウンター
            counters = new int[n];

            for (int i = 0; i < q; i++)
            {
                string[] exec = Console.ReadLine().Split(' ');
                int node = int.Parse(exec[0]) - 1;
                counters[node] += int.Parse(exec[1]);
            }

            Check(0);

            Console.WriteLine(string.Join(" ", counters));
        }

        private static void Check(int node)
        {
            if(edges[node] == null)
            {
                return;
            }
            //子供のカウンターに自分の値を追加する
            foreach(var edge in edges[node])
            {
                counters[edge] += counters[node];
                Check(edge);
            }
        }
    }
}



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

using namespace std;

int main(){
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; ++i)cin >> arr[i];
    sort(arr, arr + n);
    int ans = 0;
    for(int i = 0; i < n - 1; ++i)ans += arr[i];
    if(ans > arr[n - 1])cout << "Yes";
    else cout << "No";
    return 0;

}


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

if N>0 and M>0:
    a=N*(N-1)/2
    b=M*(M-1)/2
    print(int(a+b))
    
elif N>0 and M==0:
    a=N*(N-1)/2
    print(int(a))

elif N==0 and M>0:
    b=M*(M-1)/2
    print(int(b))

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

using namespace std;

/* least common multiple */
template <typename T> // ll or int
T lcm(T x, T y) {
	T res = 0;
	T mod = x % y;
	if (mod == 0)
		res = y;
	else
		res = lcm(y, mod);

	return res;
}

/* greatest common divisor */
template <typename T> // ll or int
T gcd(T x, T y) {
	T res = 0;
	T lcm_v = lcm(x, y);

	res = x / lcm_v * y;

	return res;
}

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

	ll mod = 1e9 + 7;
	ll res = 1;
	map<int, int> mp = {};

	rep (i, 1, n + 1) {
		int tmp = i;
		int div = 2;
		while (tmp > 1) {
			if (tmp % div == 0) {
				mp[div]++;
				tmp /= div;
			} else {
				div++;
			}
		}
	}

	for (auto it = mp.begin(); it != mp.end(); it++) {
		res *= (it->second + 1);
		res %= mod;
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
C = [list(map(int,input().split())) for i in range(n)]

a = 2*10**9+5
b = -2*10**9+5
c = 2*10**9+5
d = -2*10**9+5

for i in range(n):
    a = min(a, C[i][0]+C[i][1])
    b = max(b, C[i][0]+C[i][1])
    c = min(c, C[i][0]-C[i][1])
    d = max(d, C[i][0]-C[i][1])

print(max(b-a,d-c))

Measured memory_bytes: 99148
#include<stdio.h>
int main(void)
{
	int a, b;
	a = 0;
	b = 0;
	scanf("%d %d", &a, &b);
	if (a < b) {
		printf("a < b\n");
	}
	if (a > b) {
		printf("a > b\n");
	}
	if (a == b) {
		printf("a == b\n");
	}
	return 0;
}



Measured memory_bytes: 2104
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from math import factorial

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    l = [0] * n
    for i in range(n):
        l[i] = abs(n-2*i-1)
    if sorted(v) != sorted(l):
        print(0)
        return
    c = dict(Counter(l))
    ans = 1
    d = 10**9 + 7
    for v in c.values():
        ans *= factorial(v) % d
    print(ans % d)

if __name__ == '__main__':
    main()


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

const int MAXN = 1011;
const int INF = 1000000;

int n;
int d[MAXN];

int main() {
  while (cin >> n) {
    for (int i = 0; i < n; ++i) {
      cin >> d[i];
    }
    set<int> s;
    for (int i = 0; i < n; ++i) {
      int x = 0;
      for (int j = i; j < n; ++j) {
        if (x > INF) break;
        x = x * 10 + d[j];
        s.insert(x);
      }
    }
    for (int x = 0; ; ++x) {
      if (!s.count(x)) {
        cout << x << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1404
while 1:
    n,k=map(int,input().split())
    if n==0:break
    a=[int(i) for i in input().split()]
    for _ in range(n):
        b=list(map(int,input().split()))
        for j,c in enumerate(b):
            a[j]-=c
    f=0
    for i in range(k):
        if a[i]<0:
            f=1
            break
    print('No' if f else 'Yes')

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

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            char lastword = 'a';
            int j = 1;
            for(int i = 0 ;i<N.Length;i++){
                if(i==0){
                    lastword = N[i];
                }else{
                    if(N[i]!=lastword){
                        lastword = N[i];
                        j=1;
                    }else{
                        j++;
                        if(j>=3){
                            break;
                        }
                    }
                }
            }
            Console.WriteLine(j>=3?"Yes":"No");
        }   
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}

Measured memory_bytes: 13140
import collections


def main():
    N = input_ints()
    S = []

    for _ in range(N):
        S.append(input())

    c = collections.Counter(S)

    print('AC x', c['AC'])
    print('WA x', c['WA'])
    print('TLE x', c['TLE'])
    print('RE x', c['RE'])


def input_ints():
    line_list = input().split()

    if len(line_list) == 1:
        return int(line_list[0])
    else:
        return map(int, line_list)


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()


Measured memory_bytes: 16616
//code written by a living bruh moment
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Random;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        long n = in.nextLong();
        long m = in.nextLong();
        long o = in.nextLong();
        if(n==m && m!=o){
            out.println("Yes");
        }
        else if(m==o && m!=n){
            out.println("Yes");
        }
        else if(o==n && o!=m){
            out.println("Yes");
        }
        else{
            out.println("No");
        }
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}

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

List = [0 for x in range(1000001)]
answer = 0

def main(a, List):
    if List[a] >= 1:
        List[a] = List[a] + 1
        return List
    else:
        for i in range(a, 1000001, a):
            List[i] = List[i] + 1
    return List

def Answer(A, List):
    answer = 0
    for a in A:
        if List[a] == 1:
            answer += 1
    return answer

for a in A:
    main(a, List)

print(Answer(A, List))

Measured memory_bytes: 33268
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
cnt = defaultdict(int)
S = sum(A)
for a in A:
    cnt[a] += 1

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    num_of_b = cnt[b]
    S += num_of_b * c - num_of_b * b
    cnt[c] += num_of_b
    cnt[b] -= num_of_b

    print(S)



Measured memory_bytes: 91100
from collections import Counter
from functools import reduce
N = int(input())
a = list(map(int, input().split()))

def print_yes():
    print('Yes')
    exit(0)

def print_no():
    print('No')
    exit(0)

if not any(a):
    print('Yes')
else:
    if N % 3 == 0:
        counter = Counter(a)
        # print(counter)
        if len(counter) == 3:
            for i in counter.values():
                if i != N / 3:
                    print_no()
            if reduce(lambda a,b: a^b, list(counter.keys())) == 0:
                print_yes()
            else:
                print_no()
        elif len(counter) == 2:
            if a.count(0) == N/3:
                print_yes()
            else:
                print_no()
        else:
            print_no()
    else:
        print_no()


Measured memory_bytes: 14708
n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6 + 10

one = a.count(1)
if one > 0:
  if one == 1:
    print(1)
  else:
    print(0)
  exit(0)

sieve = [True] * MAX
counts = [0] * MAX
a.sort()
ans = 0
sieve[0] = False
sieve[1] = False
for i in range(n):
  counts[a[i]] += 1
  if not sieve[a[i]]:
    continue
  for j in range(a[i]*2, MAX, a[i]):
    sieve[j] = False
  if counts[a[i]] == 1:
    ans += 1
  elif counts[a[i]] == 2:
    ans -= 1
    
print(ans)

Measured memory_bytes: 100808
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,k;
  cin>>n>>k;
  long long closest=0;
if(n%k==0){
  cout<<0;
  return 0;
}
  else
  {
    closest=n/k;
    
  }
  n=n-closest*k;
  cout<<min(n,abs(n-k));
  
  
  
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;

ll gcd(ll m, ll n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	// ユークリッドの方法
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}

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

	string s;
	cin >> s;
	int ans = 0;
	rep(i, 3) {
		if (s[i] == '1') {
			ans++;
		}
	}
	cout << ans << endl;


	return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a = n%10;
  int b = (n%100)/10;
  int c = (n%1000)/100;
  int d = (n%10000)/1000;
  if ((a == b && b == c) || (b == c && c == d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n, t;
  cin >> n >> t;
  int ans = INF;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if (b <= t) ans = min(ans, a);
  }
  if (ans == INF)
    cout << "TLE" << endl;
  else
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(int argc, char const *argv[]) {
    int h,w;
    string s;
    cin>>h>>w;
    vector<string> v;
    rep(i,h){
      cin>>s;
      v.push_back(s);
    }
    rep(i,h){
      cout<<v[i]<<endl;
      cout<<v[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        string S = NextString();
        int[] sc = new int[N + 1];
        int[] dc = new int[N + 1];
        for (int i = 1; i <= N; i++)
        {
            if (S[i - 1] == '#') sc[i] = sc[i - 1] + 1;
            else sc[i] = sc[i - 1];
        }
        for (int i = N; i > 0; i--)
        {
            if (S[i - 1] == '.') dc[i - 1] = dc[i] + 1;
            else dc[i - 1] = dc[i];
        }
        int ans = INF;
        for (int i = 0; i <= N; i++) ans = Math.Min(ans,dc[i]+sc[i]);
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 14176
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(), (a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int n; cin >> n;
    int ft = 0, fx = 0, fy = 0;
    bool jud = true;
    rep(i,n){
        int t, x, y; cin >> t >> x >> y;
        int timedist = t - ft;
        int manhdist = abs(x - fx) + abs(y - fy);

        if(timedist < manhdist || timedist%2 != manhdist%2){
            jud = false;
            break;
        }

    }

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

}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    string l;
    vector<string> s(n);
    map<string, long long> a;
    for(int i=0;i<n;i++){
        cin>>l;
        sort(l.begin(),l.end());
        s.at(i) = l;
        a[l]++;
    }
    long long ans = 0;
    for(int i=0;i<n;i++){
        l = s.at(i);
        if(a[l]!=0) ans += a[l]-1;
        a[l]--;
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int n;
char a[101],b[101];
int main()
{
	cin>>n;
	cin>>a;
	cin>>b;
	for(int i=0;i<n;i++)
	{
		cout<<a[i]<<b[i];
	}
	return 0;
}

Measured memory_bytes: 256
//temprates
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define LREP(i,n) LFOR(i,0,(ll)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)
#define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,n;
  cin >> n >> a >> b;
  cout << min(a*n,b) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long 
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mp make_pair
  #define pb push_back
  #define inf INT_MAX
  #define f first
  #define s second
  #define forn(i, n) for (int i = 0; i < int(n); i++)
  
  int32_t main()
  { 
     #ifndef ONLINE_JUDGE
       freopen("in.txt","r",stdin);
       freopen("out.txt","w",stdout);
     #endif
    
    IOS
    int n,m;
    cin >> n>>m;
    int sum=0;
    vector<int> v(m,0);
    
    for(int i=0;i<m;i++)
    {
      cin>>v[i];
      sum+=v[i];
    }
   //sum=accumulate(v.begin(), v.end(),0);
    //cout<<sum;
    if(n-sum>=0)
      cout<<n-sum;
    else
      cout<<"-1";
    return 0;
   
}



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

using namespace std;

int main()
{
	int h, a, b;
	cin >> h >> a >> b;
	int ans = 0;
	for (int i = a; i <= b; i++)
		if (h % i == 0)
			ans++;
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cins(int, n, a);
    a.insert(a.begin(), 0);
    a.push_back(0);
    int base = 0;
    For(i, n+1){
        base += abs(a[i+1] - a[i]);
    }

    For(i, n){
        Cout(base + abs(a[i+2] - a[i]) - abs(a[i+1] - a[i]) - abs(a[i+2] - a[i+1]));
    }
}


Measured memory_bytes: 1656