akhauriyash/Code-Regression huggingface dataset:
#include <functional>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
#include <type_traits>
namespace loquat {
template <int MOD>
class modulus_integer {
public:
	typedef modulus_integer<MOD> self_type;
private:
	int m_value;
	static self_type unsafe_construct(int x) noexcept {
		self_type y;
		y.m_value = x;
		return y;
	}
public:
	modulus_integer() noexcept
		: m_value(0)
	{ }
	modulus_integer(int x) noexcept
		: m_value(x % MOD)
	{
		if(m_value < 0){ m_value += MOD; }
	}
	int operator*() const noexcept { return m_value; }
	self_type& operator=(const self_type& x) noexcept {
		m_value = x.m_value;
		return *this;
	}
	self_type operator-(const self_type& x) const noexcept {
		const int y = m_value - x.m_value;
		return unsafe_construct(y < 0 ? y + MOD : y);
	}
	self_type operator*(const self_type& x) const noexcept {
		return unsafe_construct(
			static_cast<long long>(m_value) * x.m_value % MOD);
	}
	self_type& operator-=(const self_type &x) noexcept {
		return (*this = *this - x);
	}
	self_type& operator*=(const self_type& x) noexcept {
		return (*this = *this * x);
	}
};
template <int MOD>
inline std::ostream& operator<<(
	std::ostream& os, const modulus_integer<MOD>& x)
{
	os << *x;
	return os;
}
}
using namespace std;
static const int MOD = 1000000007;
using mint = loquat::modulus_integer<MOD>;
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	vector<int> h(26);
	for(const int c : s){ ++h[c - 'a']; }
	mint answer = 1;
	for(int c = 0; c < 26; ++c){
		answer *= mint(h[c] + 1);
	}
	answer -= 1;
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n,a,b,c,d,e,f,g,h;
	while(cin>>n,n){
		rep(i,n){
			cin>>a>>b>>c>>d>>e>>f>>g>>h;
			cout<<(a*e-b*f-c*g-d*h)<<" "<<(a*f+b*e+c*h-d*g)<<" "<<(a*g-b*h+c*e+d*f)<<" "<<(a*h+b*g-c*f+d*e)<<endl;
		}
	}
	return 0;
}

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

string reverse(int start, int end, string str){
    char tmp;
    for(int i=start; i < start + (end + 1 - start)/2; i++){
        tmp = str[i];
        str[i] = str[end-i+start];
        str[end-i+start] = tmp;
    }
    
    return str;
}

void print(int start, int end, string str){
    for(int i = start; i<=end; i++){
                if(i-end) cout << str[i];
                else cout << str[i] << endl;
            }
}

string replace(int start, int end, string str, string alt){
    str = str.erase(start, end - start +1);
    str = str.insert(start, alt);
    return str;
}

int main(){
    string str, proc, alt;
    int n, start, end;
    cin >> str >> n;
    for (int i = 0; i < n; i++){
        cin >> proc;
        if(proc == "print"){
            cin >> start >> end;
            print(start, end, str);
        } else if (proc == "reverse"){
            cin >> start >> end;
            str = reverse(start, end, str);
        } else if(proc == "replace"){
            cin >> start >> end >> alt;
            str = replace(start, end, str, alt);
        }
    }
    return 0;
}


Measured memory_bytes: 3216
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        

        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String list[] = S.split("");
        
        int price=700;
        
        for(int i=0;i<S.length();i++){
            if(list[i].equals("o")){
                price+=100;
                
                
            }
        }
        System.out.println(price);
    }
    
} 

Measured memory_bytes: 35584
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
c = int(inputs[2])
d = int(inputs[3])

if abs(a - c) <= d:
	print("Yes")
elif abs(a - b) <= d and abs(b - c) <= d:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    int N;
    cin>>N;
    int odd=0;
    rep(i,N+1){
        if(i==0) continue;
        if(i%2) odd++;
    }
    printf("%.9lf",(double)odd/N);
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, q;
  string s;
  cin >> n >> s >> q;
  
  while (q--) {
    int k;
    cin >> k;
    
    vector<ll> d(n), m(n), dm(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        if (s.at(i) == 'D') d.at(i)++;
        if (s.at(i) == 'M') m.at(i)++;
        continue;
      }
      
      d.at(i) = d.at(i - 1);
      m.at(i) = m.at(i - 1);
      dm.at(i) = dm.at(i - 1);
      
      if (i >= k) {
        if (s.at(i - k) == 'D') {
          d.at(i)--;
          dm.at(i) -= m.at(i - 1);
        }
        if (s.at(i - k) == 'M') {
          m.at(i)--;
        }
      }
      
      if (s.at(i) == 'D') {
        d.at(i)++;
      }
      if (s.at(i) == 'M') {
        m.at(i)++;
        dm.at(i) += d.at(i);
      }
      if (s.at(i) == 'C') {
        ans += dm.at(i);
      }
    }
    
    cout << ans << '\n';
  }
}

Measured memory_bytes: 24860
using System;

namespace ITP1_7_A {
    class Program {
        static void Main(string[] args) {
            while(true) {
                string[] s = Console.ReadLine().Split(' ');
                int m = int.Parse(s[0]), f = int.Parse(s[1]), r = int.Parse(s[2]);
                if(m == -1 && f == -1 && r == -1) break;
                if(m == -1 || f == -1) {
                    Console.WriteLine("F");
                } else if(m + f >= 80) {
                    Console.WriteLine("A");
                } else if(m + f >= 65) {
                    Console.WriteLine("B");
                } else if(m + f >= 50 || r >= 50) {
                    Console.WriteLine("C");
                } else if(m + f >= 30) {
                    Console.WriteLine("D");
                } else {
                    Console.WriteLine("F");
                }
            }
        }
    }
}

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

int main(){
    vector<vector<int>> c(3,vector<int>(3,0));
    rep(i,3){
        rep(j,3){
            cin >> c[i][j];
        }
    }
    //2行目と1列目の差が3列で同じか確認
    for(int i=-100; i<=100; i++){
        int temp=c[1][0]-c[0][0];
        if(c[1][1]-c[0][1]!=temp || c[1][2]-c[0][2]!=temp){
            cout << "No" << endl;
            return 0;
        }
    }
    //3行目が1行目の差が3列で同じか確認
    for(int i=-100; i<=100; i++){
        int temp=c[2][0]-c[0][0];
        if(c[2][1]-c[0][1]!=temp || c[2][2]-c[0][2]!=temp){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;

}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const int maxN = 1e5+1;
int arr[maxN];
int freq[maxN];

void solve () {
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 0;i < n;++i) {
		cin >> arr[i];
		freq[arr[i]]++;
		sum += arr[i];
	}
	int q;
	cin >> q;
	while (q--) {
		int a,b;
		cin >> a >> b;
		sum -= (ll)a*freq[a];
		sum += (ll)b*freq[a];
		freq[b] += freq[a];
		freq[a] = 0;
		cout << sum << '\n';
	}

}

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



Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<int> g[100001];
int color[100001];
bool dfs(int v,int c){
    color[v]=c;
    rep(i,g[v].size()){
        if(color[g[v][i]]==c) return false;
        if(color[g[v][i]]==0&&!dfs(g[v][i],-c)) return false;
    }
    return true;
}
int main(){
    int n,m,ai,bi;
    cin>>n>>m;
    rep(i,m){
        cin>>ai>>bi;
        --ai,--bi;
        g[ai].pb(bi);
        g[bi].pb(ai);
    }
    bool flag=dfs(0,1);
    if(flag){
        ll c1=0,c2=0;
        rep(i,n){
            if(color[i]==1) ++c1;
            else if(color[i]==-1) ++c2;   
        }
        cout<<c1*c2-m<<endl;
    }
    else cout<<(ll)n*(n-1)/2-m<<endl;
    return 0;
}

Measured memory_bytes: 8576
#include <iostream>
using namespace std;
int main()
{
  int a,b,c,d;cin>>a>>b>>c>>d;
  int l=a+b;
  int r=c+d;
  if(l>r)cout<<"Left";
  else if(l<r)cout<<"Right";
  else cout<<"Balanced";
  return 0;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;
const int K = 500;
const int maxN = 50;

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < n - 2; i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
	}
	cout << ans;
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

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

int main(){
  int64_t N ,T=1 ; 
  cin >> N ; 
  vector<int64_t> A(N) ;

  
  for(int i = 0 ; i < N ; i++){
    cin >> A.at(i) ; 
    if(A.at(i) == 0 ){
      cout << 0 << endl ; 
      return 0 ; 
    }
  }
  
  for(int i = 0 ; i < N ; i++){
    if(A.at(i) > 1000000000000000000/T){
      cout << "-1" << endl ; 
      return 0 ; 
    }
    T *= A.at(i) ;     
  }
     // cout << A.at(0)*A.at(1) << endl ;    
    cout << T << endl;
}

Measured memory_bytes: 4052
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Da;
		decimal a=(decimal)s[0];
		decimal b=(decimal)s[1];
		Console.WriteLine("{0}",(long)(a*b));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

const int maxn = 10000001;

bool ip[maxn];

int main() {

    for(int i=0;i<maxn;i++){
        ip[i] = true;
    }

    ip[0] = ip[1] = false;

    for(int i=2; i< maxn; i++){
        if(ip[i]){
            for(int j=2*i; j<maxn; j+=i){
                ip[j] = false;
            }
        }
    }

    while(1){

        int a;

        scanf(" %d",&a);

        if(a==0) break;

        while(1) {
            if (ip[a] && ip[a - 2] && ip[a - 6] && ip[a - 8]) {
                cout << a << endl;
                break;
            }
            a--;
        }

    }

    return 0;
}

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

int r[100001];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        r[a]++;
        r[b]++;
    }
    bool yes = true;
    for(int i = 1; i <= n; i++){
        if(r[i]%2 != 0) yes = false;
    }
    if(yes) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N,i;
    scanf("%d",&N);
    int A[200005];
    int B[200005];
    int cnt=0;
    B[0]=200001;
    for(i=1;i<=N;i++)
    {
        scanf("%d",&A[i]);
        if(A[i]<B[i-1])
        {
             B[i]=A[i];
        }
        else
        {
            B[i]=B[i-1];
        }
    }
    for(i=1;i<=N;i++)
    {
        if(A[i]<=B[i])
        {
            cnt++;
        }
    }
    printf("%d",cnt);

    return 0;
}


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

const ll INF = 100100100100;

int n;
vector<vector<ll>> dp(3010, vector<ll>(3010, INF));
vector<int> a;

ll rec(int i, int j) {
  if (dp[i][j] != INF) return dp[i][j];
  if (i == j) return dp[i][j] = (n % 2 == 1 ? a[i] : -a[i]);
  ll left = rec(i + 1, j);
  ll right = rec(i, j - 1);
  if ((n - (j - i)) % 2)
    return dp[i][j] = max(a[i] + left, a[j] + right);
  else
    return dp[i][j] = min(-a[i] + left, -a[j] + right);
}

int main() {
  cin >> n;
  a.resize(n);
  rep(i, n) cin >> a[i];
  cout << rec(0, n - 1) << endl;
}

Measured memory_bytes: 71296
N = int(input())
a = list(map(int, input().split()))
M = 0
b = [0]*N
B = []
for i in range(N, 0, -1):
    wa = 0
    cnt = 1
    while i*cnt <= N:
        wa += b[i*cnt-1]
        cnt+=1
    if wa%2 != a[i-1]:
        M+=1
        b[i-1] = 1
        B.append(i)
print(M)
if M!=0:
    print(*B)

Measured memory_bytes: 14060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    int XorSum = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        XorSum ^= a[i];
    }
    for(int i = 0; i < n; ++i){
        cout << (XorSum ^ a[i]) << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
int a[100005][4];
int dp[100005][4];
int n;

int funcc(int index, int flag) {

	if (index == n) return 0;

	if (dp[index][flag] != -1) return dp[index][flag];

	int maxi = 0;
	if (flag == 0) {
		maxi = max(maxi, a[index][1] + funcc(index + 1, 1));
		maxi = max(maxi, a[index][2] + funcc(index + 1, 2));
		maxi = max(maxi, a[index][3] + funcc(index + 1, 3));
	}
	else if (flag == 1) {
		maxi = max(maxi, a[index][2] + funcc(index + 1, 2));
		maxi = max(maxi, a[index][3] + funcc(index + 1, 3));
	}
	else if (flag == 2) {
		maxi = max(maxi, a[index][1] + funcc(index + 1, 1));
		maxi = max(maxi, a[index][3] + funcc(index + 1, 3));
	}
	else {
		maxi = max(maxi, a[index][1] + funcc(index + 1, 1));
		maxi = max(maxi, a[index][2] + funcc(index + 1, 2));
	}

	return dp[index][flag] = maxi;
}

int main() {

	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= 3; j++) {
			cin >> a[i][j];
		}
	}

	memset(dp, -1, sizeof dp);

	cout << funcc(0, 0);

	return 0;
}


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

using namespace std;

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, A[100000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  if(N == 1) {
    cout << A[0] / 2 << endl;
  } else {
    long long ret = 0;
    for(int i = 1; i < N; i++) {
      int card = A[i - 1] + A[i];
      ret += card / 2;
      A[i] = min(A[i], card % 2);
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main(){
    long long a, b, ans=2019;
    cin >> a >> b;
    for(long long i=a; i<=b; i++){
        for(long long j=i; j<=b; j++){
            if(i!=j)ans=min(ans, (i*j)%2019);
            if(ans==0){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
p = list(li())

ans = 0
cnt = 1
while cnt <= n:
    if p[cnt-1] == cnt:
        if cnt < n:
            cnt += 2
        elif cnt == n:
            cnt += 1

        ans += 1

    else:
        cnt += 1

print(ans)

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'




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


const int MOD = 1000000007;

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



int n;

void Input() {

    cin >> n;
}



void Solve() {

    int a[n];
    for(int i = 0; i < n; i++) {

        cin >> a[i];
    }


    for(int i = n-1; i > 0; i--) {

        if(a[i-1] == a[i]+1) a[i-1]--;
        else if(a[i-1] > a[i]) {

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

    cout << "Yes" << endl;



}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();


  return 0;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a, b;
  a = b = 0;
  for(int i = 0; i < 3; ++i){
    if(s[i]=='A')a++;
    if(s[i]=='B')b++;
  }
  if(a&&b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

vector<int> primes;
void init(int n) {
  primes.push_back(2);
  bool is_prime[n + 1];
  fill(is_prime, is_prime + n + 1, true);
  for (long long p = 3; p <= n; p += 2)
    if (is_prime[p]) {
      primes.push_back(p);
      for (long long i = p * p; i <= n; i += p) is_prime[i] = false;
    }
}

vector<long long> div(long long N) {
  vector<long long> ret = {1};
  for (auto p : primes) {
    if (N % p == 0) {
      int m = ret.size();
      long long ppw = p;
      while (N % p == 0) {
        for (int i = 0; i < m; i++) {
          ret.push_back(ret[i] * ppw);
        }
        N /= p;
        ppw *= p;
      }
    }
  }
  if (N > 1) {
    int m = ret.size();
    for (int i = 0; i < m; i++) {
      ret.push_back(ret[i] * N);
    }
  }
  return ret;
}

bool isok(long long N, long long K) {
  while (N % K == 0) N /= K;
  return N % K == 1;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  init(sqrt(N) + 1);
  long long ans = 0;
  auto d = div(N - 1);
  for (long long K : d)
    if (K != 1 && isok(N, K)) ans++;
  d = div(N);
  for (long long K : d)
    if (K != 1 && isok(N, K)) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4780
import math
N, M = map(int, input().split())

l = []
for i in range(1, int(math.sqrt(M))+1):
  if M % i == 0:
    l.append(i)
    if i != M//i:
      l.append(M//i)
      
l.sort(reverse=True)
for n in l:
  if n*N <= M:
    ans = n
    break
print(ans)

Measured memory_bytes: 9112
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X, K, D;
    cin >> X >> K >> D;
    ll num = abs(X) / D;
    ll ans = 0;
    if (num >= K) {
        ans = abs(X) - D * K;
    } else {
        ll tmp = abs(X) % D;
        if ((K - num) % 2 == 0) {
            ans = tmp;
        } else {
            ans = -(tmp - D);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }
    
    map<string, int> M;
    for(int i = 0; i < n; i++){
        sort(s[i].begin(), s[i].end());
        M[s[i]]++;
    }

    long long ans = 0;
    for(auto P : M){
        ans += (long long)P.second * (P.second - 1) / 2;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 18176
import fileinput


def frog(stones, jump_range):
    stone_cost = [0]
    for i in range(1, len(stones)):
        stone_cost.append(min(
            stone_cost[i - curr_jmp] + abs(stones[i] - stones[i - curr_jmp])
            for curr_jmp in range(1, min(i, jump_range) + 1)
        ))
    return stone_cost[-1]


inp = fileinput.input()
jump_range = [int(v) for v in inp.readline().split(" ")][1]
stones = [int(v) for v in inp.readline().split(" ")]
print(frog(stones, jump_range))

Measured memory_bytes: 60764
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    int n, d, ans = 0;
    cin >> n >> d;
    d *= d;
    loop(i, n) {
        int x, y;
        cin >> x >> y;
        ans += (x * x + y * y <= d);
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

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

    vector<bool> alp(26, false);
    for(auto c: s)
        alp[c - 'a'] = true;

    for(int i = 0; i < 26; i++){
        if(!alp[i]){
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
const ll MOD = 998244353;
const ll INF = 1e18;
using namespace std;


main(){    
    #ifdef XOX
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\Input.txt", "r", stdin);
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\OPT.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    string s;
    cin >> s;
    int cnt = 0;
    for(auto ch : s){
        cnt += (ch == 'o');
    }

    int n = 15 - s.length();

    if((cnt + n) >= 8)  cout << "YES\n";
    else    cout << "NO\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main(){
	int a,b;
	cin >> a>>b;
	int plus,minus,time;
	plus = a+b;
	minus = a-b;
	time = a*b;
	int ans = max(plus,minus);
	cout << max(ans,time);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vector<pair<string,int>> tone(n) ;
  REP(i,n){
    string s ;
    int t ;
    cin >> s >> t ;
    tone[i] = MP(s,t) ;
  }
  string t ;
  cin >> t ;
  int ans = 0 ;
  bool f = false ;
  REP(i,n){
    if(f){
      ans += tone[i].SE ;
    }
    if(t==tone[i].FI){
      f = true ;
    }
  }
  
  cout <<ans <<endl ;
  
  
  
  return 0 ;
}




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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    LL a,b;
    cin >> a >> b;
    LL gcd=__gcd(a,b);
    cout << (a*b)/gcd;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
scale = 62
#scale = 5
z0 = [0 for _ in range(scale)]
for x in a:
  for d in range(scale):
    if x % 2 == 1:
      z0[d] += 1
    x //= 2
ans = 0
for d in range(scale):
  ans += z0[d] * (n-z0[d]) * 2**d
mod = 10**9+7
ans %= mod
print(ans)

Measured memory_bytes: 122808
#include "bits/stdc++.h"

using namespace std;

int main() {
	int n;
	int h[100000];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> h[i];
	}

	int p = h[n - 1];
	int tmp = 0;
	int ans = 0;
	for (int i = n - 2; 0 <= i; i--)
	{
		if (h[i] >= h[i + 1])tmp++;
		else tmp = 0;
		ans = max(tmp, ans);
	}

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

Measured memory_bytes: 640
q=input()
y=len(q)


u=((y-1)//2);
p=((y+3)//2)-1;

t=q[0:u]
r="".join(reversed(t))

i=q[p:]
o="".join(reversed(i))

a="".join(reversed(q))
if a==q and o==i and t==r:
       print("Yes")
else :
  print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <limits>
int main()
{
    std::cout << std::setprecision(16);
    size_t n;
    std::cin >> n;
    std::vector<double> v1(n), v2(n), vd(n);
    for (auto itv : {&v1, &v2})
    {
        for (auto &it : *itv)
        {
            std::cin >> it;
        }
    }
    double pinf = std::numeric_limits<double>::lowest(), p1=0, p2=0, p3=0;
    for (size_t i = 0; i < n; i++)
    {
        double r = std::abs(v1[i] - v2[i]);
        if(r > pinf)
        {
            pinf = r;
        }
        p1 += r;
        p2 += r*r;
        p3 += r*r*r;
    }
    p1 = std::pow(p1,1.0);
    p2 = std::pow(p2,1.0/2);
    p3 = std::pow(p3,1.0/3);
    std::cout << p1 << "\n";
    std::cout << p2 << "\n";
    std::cout << p3 << "\n";
    std::cout << pinf << "\n";
    return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

constexpr int MAX = 3010000;
constexpr int MOD = 1000000007;

//Please set MAX and MOD!!========================================

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	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 || n < 0 || k < 0) return (0);
	return (fac[n] * (finv[k] * finv[n - k] % MOD) % MOD);
}


int main() {
	ll N, K; cin >> N >> K;
	COMinit();
	ll sum = 0;
	for (int i = max(1ll, N - K); i <= N; i++) {
		(sum += (COM(N-1, N-i) * COM(N, i)) % mod) %= mod;
	}
	cout << sum << endl;
	return (0);
}

Measured memory_bytes: 70784
#include <cassert>
#include <algorithm>
#include <cctype>
#include <complex>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <typeinfo>
#include <unordered_set>
#include <unordered_map>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REPD(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define PB(e) push_back(e)
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

int main(int argc, char *argv[])
{
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  vector<pair<int, int>> C(N);
  REP(i, N) {
    cin >> A[i] >> B[i];
    C[i] = make_pair(-(A[i] + B[i]), i);
  }
  sort(ALL(C));
  ll takahasi = 0;
  ll aoki = 0;
  REP(i, N) {
    if (i % 2 == 0) {
      takahasi += A[C[i].second];
    } else {
      aoki += B[C[i].second];
    }
  }
  cout << takahasi - aoki << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include <algorithm>
#include <functional>
#include <array>
#include <vector>
#include <string>

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))


using namespace std;
int main(){
  long N;
  cin>>N;
  string S[N];
  for(long i=0;i<N;i++){
    cin>>S[i];
  }
  
  std::sort(S, S+SIZE_OF_ARRAY(S), [](const string strA, const string strB) {
        return strB.compare(strA) > 0;
    });
  long max=0;
  long nowind=0;
  long cntind=0;
  long count[N]={0};
  string mystr[N]={};

  for(long i=0;i<N-1;i++){
    if(S[i]==S[i+1] && (i+1)==(N-1)){
      count[cntind]=N-1-nowind+1;
      mystr[cntind]=S[N-1];
    
      if(max<N-1-nowind+1){
        max=N-1-nowind+1;
      }
      cntind++;
      break;
    }
    if(S[i]!=S[i+1]){
      if(i+1==N-1){
        count[cntind]=i-nowind+1;
        mystr[cntind]=S[N-2];
        cntind++;
        count[cntind]=1;
        mystr[cntind]=S[N-1];
        cntind++;
        break;
      }
      
      if(max<i-nowind+1){
        max=i-nowind+1;
      }
      count[cntind]=i-nowind+1;
      mystr[cntind]=S[i];
      cntind++;
      nowind=i+1;
    }
  }
  for(long i=0;i<cntind;i++){
    if(count[i]==max){
      cout<<mystr[i]<<endl;
    }
  }
  
  return 0;
}
    

Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  ll a,b;
  cin >> a >> b;
  ll x=a+b,y=a-b,z=a*b, m = max({x,y,z});
  
  cout << m;
}

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

using int64 = long long int;
using Vint = vector<int>;
using V2int = vector<Vint>;
using pii = pair<int, int>;

const int MOD = 1e9 + 7;

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto (i) = (vec).begin(); (i) != (vec).end(); (i)++)
#define vrREP(i, vec) for(auto (i) = (vec).end() - 1; (i) != (vec).begin() - 1; (i)--)


bool IsNotHate(vector<bool> &A, int a){
  while(a != 0){
    int p = a % 10;
    a /= 10;
    if(!A.at(p)) return false;
  }
  return true;
}


int main(void){
  int n, k; cin >> n >> k;
  vector<bool> Can(10, true);
  REP(i, k){
    int tmp; cin >> tmp;
    Can.at(tmp) = false;
  }
  int res = n;
  while(!IsNotHate(Can, res)) res++;
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
  string s;long K;cin>>s>>K;
  deque<int> ren;int count=1;
  rep(i,1,s.size()){
    if(s[i-1]==s[i]) count++;
    else{
      ren.push_back(count);
      count=1;
    }
  }ren.push_back(count);
  long sum=0;
  if(s.size()==1){
    cout<<K/2<<endl;
    return 0;
  }
  if(s[0]!=s.back()){
    for(int i:ren) sum+=i/2*K;
  }else{
    if(ren.size()==1){
      cout<<ren[0]*K/2<<endl;
      return 0;
    }
    sum+=(ren[0]/2)+(ren.back()/2);
    sum+=(ren[0]+ren.back())/2*(K-1);
    rep(i,1,ren.size()-1) sum+=ren[i]/2*K;
  }cout<<sum<<endl;
}

Measured memory_bytes: 256
import math


def submit():
    n = int(input())

    min_manhattan = float('inf')
    for x in range(1, math.ceil(math.sqrt(n)) + 1):
        q, mod = divmod(n, x)
        if mod:
            continue

        if x + q < min_manhattan:
            min_manhattan = x + q

    print(min_manhattan - 2)


if __name__ == "__main__":
    submit()        

    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

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

  string s;
  cin >> s;

  auto ans = true;
  if (s.length () % 2 == 1)
  {
    ans = false;
    goto finished;
  }
  rep (i, s.length ())
  {
    if (i % 2 == 0)
    {
      if (not (s [i] == 'h')) ans = false;
    }
    else
    {
      if (not (s [i] == 'i')) ans = false;
    }
  }

finished:
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

const int MOD = 1000000007;
int N, M;
int S[2010], T[2010];
int dp[2010][2010];

void _main() {
    cin >> N >> M;
    REP (i, N) cin >> S[i];
    REP (i, M) cin >> T[i];
    REP (i, N + 1) dp[i][0] = 1;
    REP (i, M + 1) dp[0][i] = 1;
    REP (i, N) REP (j, M) {
        if (S[i] == T[j]) dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % MOD;
        else dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1] + MOD - dp[i][j]) % MOD;
    }
    cout << dp[N][M] << endl;
}

signed main(signed argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
#define dump(a) cout << #a << " " << a << endl
#define MAX_SIZE 101
using namespace std;

vector<pair<int,int>> sikis;
int dp[MAX_SIZE][MAX_SIZE];


int mul(int L, int M, int R) {
	int r1 = sikis[L].first;
	int c2 = sikis[R-1].second;
	int r2 = sikis[M].first;
	return (r1 * c2 * r2); //r1*c2*c1
}

int dfs(int L, int R) {
	if (L + 1 == R) { return 0; }
	if (dp[L][R] >= 0) { return dp[L][R]; } //dp?????¢
	
	vector<int> values;
	for(int m = L+1; m < R; m++) {
		int value = dfs(L,m)+dfs(m,R)+mul(L,m,R);
		values.push_back(value);
	}
	dp[L][R] = *min_element(values.begin(), values.end());

	return dp[L][R];
}

int main() {
	int N;
	int r,c;

	cin >> N;
	for(int y=0; y<N; y++) {
		for(int x=0; x<N+1; x++) {
			dp[y][x] = -1;
		}
	}

	for(int i=0; i<N; i++) {
		cin >> r >> c;
		sikis.push_back(make_pair(r,c));
	}
	cout << dfs(0,N) << endl;

	return EXIT_SUCCESS;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  ll n;cin>>n;
  ll ans=n+n;
  for(ll i=1; i*i<=n;i++){
    if(n%i==0){
      ll c=i-1+(n/i)-1;
      ans=min(ans,c);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,cnt,a[100005];
main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n;i++){
        bool f=1;
      	while(i<n-1 and a[i]==a[i+1]){
          i++;
          f=!f;
        }
      cnt+=f;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
import java.lang.Math;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);

      	long a = sc.nextLong();
      	long b = sc.nextLong();
      	long c = sc.nextLong();
      	long d = sc.nextLong();
      
      	System.out.println(Math.max(a * c, Math.max(a * d, Math.max(b * c, b * d))));      
    }
}

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

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

    int ans = 0;
    for (int i = 1; i < N - 1; i++) {
        if (min(min(P[i - 1], P[i]), P[i + 1]) != P[i] && max(max(P[i - 1], P[i]), P[i + 1]) != P[i]) ans++;
    }
    cout << ans << endl;
}

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

typedef long long int ll;
#define f(a, b) for(auto i = a;i < b;i++)

bool sortbysec(const pair<ll, ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 
void solve()
{
	return ;
}
ll mod = 1e9 + 7;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	ll n, m, sum = 0;
	cin >> n >> m;

	f(m, n + 2)
	{
		ll x = i - 1, y = n - x;
		x = i*(i + 1)/2;	
		y = y*(i) + x;

		sum += (y - x + 1);
		sum = sum%mod;
	}
	cout << sum << "\n";

}

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

const ll INF = 1001001001;

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

int main(){

  int s,w;
  cin>>s>>w;
  if(w>=s){
    cout<<"unsafe"<<endl;
  }else{
    cout<<"safe"<<endl;
  }

    
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <iostream>

int main() {
  std::string SA, SB, SC;
  std::cin >> SA >> SB >> SC;

  char turn = 'a';
  int i, j, k;
  i = j = k = 0;
  while ( true ) {
    if ( turn == 'a' ) {
      if ( i == SA.length() ) {
        std::cout << "A" << std::endl;
        break;
      }
      turn = SA[i];
      ++i;
    } else if ( turn == 'b' ) {
      if ( j == SB.length() ) {
        std::cout << "B" << std::endl;
        break;
      }
      turn = SB[j];
      ++j;
    } else if ( turn == 'c' ) {
      if ( k == SC.length() ) {
        std::cout << "C" << std::endl;
        break;
      }
      turn = SC[k];
      ++k;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

void enqueue(P);
P dequeue(void);

P Q[LEN+1];
int head = 0, tail = 0, n;

void enqueue(P u){
  if(head == (tail + 1) % LEN){
    printf("overfullow\n");
    exit(8);
  }
  Q[tail] = u;
  if(tail+1 == LEN){
    tail = 0;
  }else{
    tail++;
  }
}

P dequeue(){
  P u;
  if(head == tail){
    printf("underfullow\n");
  }
  u = Q[head];
  if(head+1 == LEN){
    head = 0;
  }else{
    head++;
  }
  return u;
}


int main(){
  int elaps = 0, c = 0;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 0; i < n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }

  while(c < n){
    u = dequeue();
    if(u.t > q){
      elaps += q;
      u.t -= q;
      enqueue(u);
    }else{
      elaps += u.t;
      printf("%s %d\n", u.name, elaps);
      c++;
    }
    
  }

  
  return 0;
}



Measured memory_bytes: 11876
MOD = 2019
def solve(l, r):
    if r - l >= MOD:
        return 0
    ans = MOD
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            ans = min(ans, i*j%MOD)
    return ans

l, r = map(int, input().split())
print(solve(l, r))

Measured memory_bytes: 3060