akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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;}

//const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(100005);
// comb(n,k)ならcomb(n+k+5)とかにしておく

mint f(int n, int k) {
  if (n < 0) return 0;
  mint res = comb(n,k);
  // nPk = nCk * k!
  //res *= comb.fact[k]; // <- nPk求めたいときは必要
  return res;
}
// f(n,k).x で nCk か nPk が計算される

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

  for (int i = 1; i <= k; ++i) {
    mint ans = f(n-k+1,i).x * f(k-1,i-1).x;
    printf("%lld\n", ans.x);
  }

  return 0;
}

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

int N;
string S, T;
string U;

int main() {
  cin >> N >> S >> T;
  
  for (int i = 0; i < N; i++){
  U = U + S.at(i);
    U = U + T.at(i);
  }
  cout << U << endl;

}

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

int main() {
    string s;
    cin >> s;
    if(s[0] != s[1] && s[1] != s[2]){
        if(s[2] != s[3])cout << "Good" << endl;
        else cout << "Bad" << endl;
    }else{
        cout << "Bad" << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}

typedef long long int ll;
const int maxn = 1e5+7;
const ll mod = 1e9+7;

bool compare(const pair<ll,ll>& x, const pair<ll,ll>& y) {
    if(x.second == y.second) return x.first < y.first;
    return x.second < y.second;
}

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) {
            res = (res*a)%mod;
        }
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

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

int main() {
    string s,t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    int dp[n+1][m+1];
    for(int i=0;i<=n;i++) {
        for(int j=0;j<=m;j++) {
            dp[i][j] = 0;
        }
    }
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            } else {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    vector<char> res;
    int i = n, j = m;
    while(i > 0 && j > 0) {
        if(s[i-1] == t[j-1]) {
            res.push_back(s[i-1]);
            i--;
            j--;
        }
        else if (dp[i-1][j] > dp[i][j-1]) {
            i--;
        } else {
            j--;
        }
    }
    string ans = "";
    for(int i=res.size()-1;i>=0;i--) {
        ans += res[i];
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
// const int INF = 1e8;
const ll INF = 1LL << 60;
typedef pair<int, int> P;

string S;
ll Q;

int main() {
    cin >> S >> Q;
    int cnt = 0; // reverse_cnt;
    queue<string> q1, q2;
    // deque<string> deq;
    // deq.push_back(S);
    rep(i, Q) {
        int target; cin >> target;
        if (target == 1) {
            // reverse(ans.begin(), ans.end());
            cnt++;
        } else {
            ll f; string c2;
            cin >> f >> c2;
            if (cnt % 2 == 0) {
                if (f == 1) {
                    q1.push(c2);
                    // deq.push_front(c2);
                    // ans = c2 + ans; 
                } else if (f == 2) {
                    q2.push(c2);
                    // deq.push_back(c2);
                    // ans = ans + c2;
                }
            } else {
                if (f == 1) {
                    q2.push(c2);
                    // deq.push_back(c2);
                    // ans = ans + c2;
                } else if (f == 2) {
                    // ans = c2 + ans; 
                    // deq.push_front(c2);
                    q1.push(c2);
                }
            }
        }
    }
    string front_S = "";
    while (!q1.empty()) {
        front_S = q1.front() + front_S;
        q1.pop();
    }
    string back_S = "";
    while (!q2.empty()) {
        back_S = back_S + q2.front();
        q2.pop();
    }

    string ans = front_S + S + back_S;
    if (cnt % 2 == 1) {
        reverse(ans.begin(), ans.end());
    }
    cout << ans << endl;
}

Measured memory_bytes: 12000
#include<stdio.h>
#define N 100000

int main (){
int i,a,array1[N],b,array2[N];
int count = 0 , left = 0, right,mid;
   scanf("%d",&a);
   for(i = 0 ; i < a ; i++){
    scanf("%d",&array1[i]);
  }
  scanf("%d",&b);
  for(i = 0 ; i < b ; i++){
    scanf("%d",&array2[i]);
  }
  for(i = 0 ; i < b ; i++){
    left = 0;
    right = a;

    while(left < right){
      mid=(left+ right) / 2;

      if(array1[mid] == array2[i]){
    count++;
    break;
      }

      else if(array2[i] < array1[mid]){
    right = mid;
      }

      else {
    left = (mid+1);
      }

    }

  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  map<int, int> mp_full, mp_odd, mp_eve;
  rep(i, 0, n) {
    int v;
    cin >> v;
    mp_full[v]++;
    if (i & 1)
      mp_odd[v]++;
    else
      mp_eve[v]++;
  }

  int half = n / 2;
  if ((int)mp_full.size() == 1) {
    cout << half << endl;
  } else {
    vector<P> oddv, evev;
    for (auto odd : mp_odd)
      oddv.push_back(make_pair(odd.second, odd.first));
    for (auto eve : mp_eve)
      evev.push_back(make_pair(eve.second, eve.first));

    sort(oddv.rbegin(), oddv.rend());
    sort(evev.rbegin(), evev.rend());
    int on = (int)oddv.size(), en = (int)evev.size();

    int odd_max = 0, eve_max = 0;
    if (oddv[0].second == evev[0].second) {
      if (on == 1) {
        odd_max = oddv[0].first;
        eve_max = evev[1].first;
      } else if (en == 1) {
        odd_max = oddv[1].first;
        eve_max = evev[0].first;
      } else {
        if (oddv[1].first > evev[1].first) {
          odd_max = oddv[1].first;
          eve_max = evev[0].first;
        } else {
          odd_max = oddv[0].first;
          eve_max = evev[1].first;
        }
      }
    } else {
      odd_max = oddv[0].first;
      eve_max = evev[0].first;
    }

    cout << (half - odd_max) + (half - eve_max) << endl;
  }
}


Measured memory_bytes: 13472
#include <iostream>
#include <string>
using namespace std;
int main(){
	while(true){
		string s;
		cin >> s;
		if(s[0]=='#') break;
		int now=0;		//0a,1x,2y,3z,4w,5b
		for(int i=0;i<s.size();i++){
			int a=s[i]-'0';
			switch(now){
				case 0:
					now=(a?2:1);
					break;
				case 1:
					now=(a?3:6);
					break;
				case 2:
					now=(a?6:1);
					break;
				case 3:
					now=(a?5:4);
					break;
				case 4:
					now=(a?2:5);
					break;
				case 5:
					now=(a?1:2);
					break;
			}
		}
		cout << ((now==5)?"Yes":"No") << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
#define REP(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
int a[114514];
signed main() {
	int n; cin >> n;
	REP(i, n)cin >> a[i+1];

	int sum = 0;
	REP(i, n+1) {
		sum += abs(a[i + 1] - a[i]);
	}
	int S = sum;

	for (int i = 1; i <= n; i++) {
		sum = S;
		if (a[i - 1] <= a[i] && a[i] <= a[i + 1])
			cout << sum << endl;
		else if (a[i - 1] <= a[i] && a[i] > a[i + 1]) {
			sum -= abs(a[i - 1] - a[i]);
			sum -= abs(a[i] - a[i + 1]);
			sum += abs(a[i - 1] - a[i + 1]);
			cout << sum << endl;
		}
		else if (a[i - 1] >= a[i] && a[i] >= a[i + 1]) {
			cout << sum << endl;
		}
		else if (a[i - 1] >= a[i] && a[i] <= a[i + 1]) {
			sum -= abs(a[i - 1] - a[i]);
			sum -= abs(a[i] - a[i + 1]);
			sum += abs(a[i - 1] - a[i + 1]);
			cout << sum << endl;
		}
	}
}

Measured memory_bytes: 2048
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector <int> v[200000];

int main() {
    int h, w, n, l, r, ans = 1e9, i;
    
    scanf("%d %d %d", &h, &w, &n);
    
    for (i = 0; i < n; i++) {
        int x, y;
        
        scanf("%d %d", &x, &y);
        
        x--;
        y--;
        
        v[y].push_back(x);
    }
    
    for (i = 0; i < w; i++) {
        v[i].push_back(h);
        
        sort(v[i].begin(), v[i].end());
    }
    
    l = 0, r = v[0][0] - 1;
    
    for (i = 0; i < w; i++) {
        int p;
        
        ans = min(ans, r + 1);
        l++;
        
        if (r <= l || i == w - 1) break;
        
        p = lower_bound(v[i + 1].begin(), v[i + 1].end(), l) - v[i + 1].begin();
        
        while (p < v[i + 1].size() && l <= r) {
            if (v[i + 1][p] != l) {
                r = v[i + 1][p] - 1;
                break;
            }
            
            l++;
            p++;
        }
    }
    
    printf("%d\n", ans);
    
    return 0;
}


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int M = cin.nextInt();
        List<Tuple<int, int>> City = new List<Tuple<int, int>>();
        Dictionary<Tuple<int, int>, int> Num = new Dictionary<Tuple<int, int>, int>();

        for (int i = 0; i < M; i++)
        {
            var c = Tuple.Create(cin.nextInt(), cin.nextInt());
            City.Add(c);
            Num.Add(c, i);
        }

        City.Sort((a, b) =>
        {
            if (a.Item1 != b.Item1)
            {
                return a.Item1 - b.Item1;
            }
            return a.Item2 - b.Item2;
        });

        string[] ret = new string[M];
        int cp = City[0].Item1;
        int cn = 1;
        for (int i = 0; i < M; i++)
        {
            if (cp != City[i].Item1)
            {
                cp = City[i].Item1;
                cn = 1;
            }
            int n = Num[City[i]];
            ret[n] = String.Format("{0:000000}{1:000000}", cp, cn);
            cn++;
        }

        for (int i = 0; i < M; i++)
        {
            Console.WriteLine(ret[i]);
        }
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


Measured memory_bytes: 35180
// This  Program is made by Jan(Codezebra)
#include<bits/stdc++.h>
using namespace std;
signed main(){
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	string s;
	cin>>s;
	int a=0;
	for(int i=0;i<s.length();i++){
		if((s[i]=='1')==(i%2)){
			a++;
		}
	}
	cout<<min(a,(int)(s.length()-a));
	return 0;
}



Measured memory_bytes: 512
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;
int main(){
    int n;cin>>n;
    cout<<180*(n-2)<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
def banned_k(n,a):
  d=defaultdict(int)
  for x in a:
    d[x]+=1
  total = sum([d[i]*(d[i]-1)//2 for i in range(1,n+1)])
  ans = [total - d[x] + 1 for x in a]
  return ans

n = int(input())
a = list(map(int,input().split()))
ans = banned_k(n,a)
for x in ans:
  print(x)

Measured memory_bytes: 41456
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Main main = new Main();
		main.solveD();
	}

	private void solveD() throws IOException {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int left = 0;
		int right;
		for (right = N - 1; right >= 0 && a[right] >= K; right--);
		right++;
		while (left < right) {
			int current = (left + right) / 2;
			if (judge(current, a, K)) {
				left = current + 1;
			} else {
				right = current;
			}
		}
		System.out.println(left);
	}

	private boolean judge(int current, int[] a, int K) {
		int N = a.length;
		boolean[][] dp = new boolean[N + 1][];
		for (int i = 0; i <= N; i++) {
			dp[i] = new boolean[K];
		}
		dp[0][0] = true;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < K; j++) {
				if (dp[i][j]) {
					dp[i + 1][j] = true;
				}
			}
			if (current == i) {
				continue;
			}
			for (int j = 0; j < K; j++) {
				if (j - a[i] >= 0 && dp[i][j-a[i]]) {
					dp[i + 1][j] = true;
				}
			}
		}
		for (int i = K - 1; i >= K - a[current]; i--) {
			if (dp[N][i]) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 177732
#include <vector>
#include <cstddef>

template<class T>
struct fenwick_tree {
	using value_type = T;
	using size_type = std::size_t;
private :
	std::vector<T> node;
public :
	fenwick_tree (size_type n) : node(n, 0) { }

	const size_type size () const noexcept {
		return node.size();
	}

	void add (size_type index, const T &value) noexcept {
		index++;
		while (index <= size()) {
			node[index - 1] += value;
			index += (index & -index);
		}
	}

	value_type sum (size_type last) const noexcept {
		value_type value = 0;
		while (last > 0) {
			value += node[last - 1];
			last -= (last & -last);
		}
		return value;
	}

	value_type sum (size_type first, size_type last) const noexcept {
		return (sum(last) - sum(first));
	}

};

#include <iostream>

using usize = std::size_t;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	usize n, q;
	std::cin >> n >> q;
	fenwick_tree<long long> ft(n);
	for (usize i = 0; i < n; i++) {
		long long a;
		std::cin >> a;
		ft.add(i, a);
	}
	
	for (usize _ = 0; _ < q; _++) {
		usize type;
		std::cin >> type;
		if (type == 0) {
			usize index;
			long long x;
			std::cin >> index >> x;
			ft.add(index, x);
		} else {
			usize l, r;
			std::cin >> l >> r;
			std::cout << ft.sum(l, r) << '\n';
		}
	}
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  vector<int> x(n);
  for(int i = 0; i < n-2; i+=2) {
    sum -= 2*a.at(i);
  }
  x.at(n-1) = sum;
  x.at(0) = 2*a.at(n-1) - x.at(n-1);
  
  for(int i = 1; i < n-1; i++) {
    x.at(i) = 2*a.at(i-1) - x.at(i-1);
  }
  
  for(int i = 0; i < n; i++) {
    cout << x.at(i) << ' ';
  }
  cout << endl;

}


Measured memory_bytes: 2048
#include <iostream>
using namespace std;
int main(void){
    string S;
    cin>>S;
    if(S.length()%2!=0)
        cout<<"No"<<endl;
    else{
        for (int i=0;i<S.length();i++){
            char mozi=S[i];
            int count=0;
            for(int j=0;j<S.length();j++){
                if(mozi==S[j])
                    count+=1;
            }
            if(count%2!=0){
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
        
    }
}


Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)

inline int read(){
  ll ans=0,c=getchar();
  while(c<'0'||c>'9'){c=getchar();}
  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
  return ans;
}

int main(){
  int n;
  scanf("%d",&n);
  int a,count4=0,odd=0;
  rep(i,n){
    a=read();
    if(a%2){
      odd++;
    }else if(a%4==0){
      count4++;
    }
  }

  if(odd==0||odd+((n-count4-odd)?1:0)<=count4+1){
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
N=int(input())
s=[int(input()) for i in range(N)]

temp=s.copy()
s_max=max(temp)
temp.remove(s_max)
s_max2=max(temp)

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
    print(s_max2)

Measured memory_bytes: 14060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
ll ebob(ll a, ll b){
	if(!a)return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (a*b)/ebob(a, b);
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s; cin>>s;
	string c = "hi";
	int u = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'h'){
			if(u != 0){
				cout<<"No";
				return 0;
			}else u++;
		}else if(s[i] == 'i'){
			if(u != 1){
				cout<<"No";
				return 0;
			}else u = 0;
		}else{
			cout<<"No";
			return 0;
		}
	}
	if(u == 0)cout<<"Yes";
	else cout<<"No";
}

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

namespace ITP1_8_A
{
    public class Program

    {
        public static void Main(string[] args)
        {

            string line = ReadSt();
            string rlt = string.Empty;

            for (int i = 0 ; i < line.Length ; i++)
            {
                if (char.IsUpper(line[i]))
                {
                    rlt += char.ToLower(line[i]);
                }
                else if(char.IsLower(line[i]))
                {
                    rlt += char.ToUpper(line[i]);
                }
                else
                {
                    rlt += line[i];
                }
            }

            Console.WriteLine(rlt); 

        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var n = 0;
            for (int i = 0; i < 3; i++)
            {
                if (s[i] == t[i])
                {
                    n++;
                }
            }
            Console.WriteLine(n);
        }
    }
}


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

using ll = long long;

//constant
const double EPS = 1e-10;
ll MOD = 1000000007;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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

// ***************************************

int main(void) {


	ll N;
	cin >> N;

	vector<ll> size(N);
	vector<ll> dict(N);

	ll idx;
	REP(i, N) {
		cin >> idx; idx--;
		size[idx]++;
		dict[i] = idx;
	}


	vector<ll> cmb(N);
	ll cum = 0;
	REP(i, N){
		ll s = size[i];
		cmb[i] = s * (s - 1) / 2;
		cum += cmb[i];
	}

	for(auto& idx: dict) {
		ll s = size[idx] - 1;
		cout << cum - cmb[idx] + s * (s - 1) / 2 << endl;
	}

	return 0;
}

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

int main() {
	using ll = long long;
	int n;
	cin >> n;
	vector<ll> a(n);
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
		a[i] = sum;
	}

	ll ans = LLONG_MAX;
	for (int i = n - 1; i > 0; i--) {
		ll x = a.back() - a[i - 1];
		ll y = a[i - 1];
		ans = min(ans, abs(x - y));
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1792
//start of jonathanirvings' template v3.0.3 (BETA)

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

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}

inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}

inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

//end of jonathanirvings' template v3.0.3 (BETA)

LL s;
LL NINE = 1000000000;

int main()
{
  scanf("%lld",&s);
  LL a = (s + NINE - 1) / NINE;
  LL b = NINE;
  LL c = a * b - s;
  LL d = 1;
  printf("0 0 %lld %lld %lld %lld\n",a,c,d,b);
  return 0;
}











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

namespace abc064_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetInt();
            var a = GetIntList();
            var c = new bool[8];
            var c32 = 0;

            for (int i = 0;i<N;i++)
            {
                for(int j = 1; j <= 8; j++) 
                    if (a[i] < 400 * j)
                    {
                        c[j - 1] = true;
                        break;
                    }

                if (a[i] >= 3200) c32++;
            }

            var cc = c.Where(x => x).Count();

            if(cc == 0) Console.WriteLine("1 " + c32);
            else Console.WriteLine(cc + " " + (c32 + cc));
        }

        public static string GetStr() => Console.ReadLine();
        public static int GetInt() => int.Parse(Console.ReadLine());
        public static long GetLong() => long.Parse(Console.ReadLine());
        public static double GetDouble() => double.Parse(Console.ReadLine());
        public static decimal GetDecimal() => decimal.Parse(Console.ReadLine());

        public static List<string> GetStrList() => Console.ReadLine().Split(' ').ToList();
        public static List<int> GetIntList() => Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        public static List<long> GetLongList() => Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
        public static List<double> GetDoubleList() => Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToList();
        public static List<decimal> GetDecimalList() => Console.ReadLine().Split(' ').Select(x => decimal.Parse(x)).ToList();

    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n; cin >> n;
    vector<P> xy(n);
    rep(i, n) cin >> xy[i].first >> xy[i].second;

    vector<int> ord;
    rep(i, n) ord.push_back(i);

    double sum = 0;
    do {
        rep(i, n-1) {
            int a = ord[i];
            int b = ord[i + 1];
            double dx = xy[a].first - xy[b].first;
            double dy = xy[a].second - xy[b].second;

            sum += sqrt(dx * dx + dy * dy);
        }
    } while (next_permutation(all(ord)));

    rep(i, n) sum /= (i + 1);
    cout << fixed << setprecision(9) << sum << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; 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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

const double pi = 3.141592653589793;
// -------------------------------------------------------
vector<int> a;
int N;
map<int, int> cnt;

int main() {
  cin >> N;
  rep(i, 0, N) {
    int t;
    cin >> t;
    a.push_back(t);
    ++cnt[t];
  }
  ll ans = 0;
  for (auto e : cnt) {
    int n = e.first;
    int c = e.second;
    if (c >= n) {
      ans += c - n;
    } else {
      ans += c;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 5112
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
using namespace std;



int main(){
  ll N; cin>>N;
  vector <ll> A; A.resize(N+1,0);
  vector <ll> dp; dp.resize(N+1,0); dp[0] = 0;
  vector <ll> rp; rp.resize(N+1,0); rp[0] = -INF;
  for(int i=0;i<N;i++) cin>>A[i+1];
  dp[1] = (A[1]);
  rp[1] = -(A[1]);

  //cout<<1<<endl;
  //cout<<dp[1]<<"   "<<rp[1]<<endl;
  if(N == 2){
    cout<<max(dp[1] + A[2] , rp[1] - A[2]);
    return 0;
  }

  for(int i=2;i<=N-1;i++){ // 漸化式
//  ll a = A[i-1];
 // ll b = A[i];

  ll dp1,dp2,dp3,dp4;
  ll rp1,rp2,rp3,rp4;

  

  dp1 = max(dp[i-2] + A[i-1] + A[i], dp[i-2] - A[i-1] - A[i]); 
  //cout<<dp1<<endl;
  dp2 = dp[i-1] + A[i];
  dp3 = max(rp[i-2] - A[i-1] + A[i] , rp[i-2] + A[i-1] - A[i]);
  //if(i==2) dp3 = 0;
  //cout<<dp2<<endl;
  //cout<<dp3<<endl;
  dp4 = rp[i-1] - A[i];
  //cout<<dp4<<endl;

  rp1 = max(rp[i-2] - A[i-1] - A[i] , rp[i-2] + A[i-1] + A[i]);
  rp2 = rp[i-1] + A[i];
  rp3 = max(dp[i-2] + A[i-1] - A[i] , dp[i-2] - A[i-1] + A[i]);
  //if(i==2) rp3 = 0;
  rp4 = dp[i-1] - A[i];

dp3 = 0;
dp1 = 0;
rp1=0;
rp3 = 0;
  
ll res_dp = max(dp1,dp2);
res_dp = max(res_dp,dp3);
dp[i] = max(res_dp , dp4);

ll res_rp = max(rp1,rp2);
res_rp = max(res_rp,rp3);
rp[i] = max(res_rp , rp4);


//cout<<dp[i]<<"   "<<rp[i]<<endl;


  }


cout<<max(dp[N-1] + A[N] , rp[N-1] - A[N]) <<endl;

  return 0;
}

Measured memory_bytes: 2560
s = input()
n = int(s)

check = True

arrays = []

for i in range(n):
    v = input()
    x = list(v)
    if i > 0:
        if not y == x[0]:
            check = False
            break
    for j in range(len(arrays)):
        if arrays[j] == v:
            check = False
            break
    arrays.append(v)
    y = x.pop()

if check:
    print('Yes')
else:
    print('No')
        
    

Measured memory_bytes: 9096
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;
int h, w;
int num_of_bombs;

int main() {
    scanf("%d %d", &h, &w);
    scanf("%d", &num_of_bombs);

    vector<int> x_cnt(h, 0);
    vector<int> y_cnt(w, 0);
    set<pair<int, int>> s;

    for (int i = 0; i < num_of_bombs; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        x--;
        y--;
        x_cnt[x]++;
        y_cnt[y]++;
        s.emplace(x, y);
    }

    int max_x = 0, max_y = 0;
    for (int i = 0; i < h; ++i) {
        max_x = max(max_x, x_cnt[i]);
    }
    for (int i = 0; i < w; ++i) {
        max_y = max(max_y, y_cnt[i]);
    }

    vector<int> xs, ys;
    for (int i = 0; i < h; ++i) {
        if (max_x == x_cnt[i]) {
            xs.push_back(i);
        }
    }
    for (int i = 0; i < w; ++i) {
        if (max_y == y_cnt[i]) {
            ys.push_back(i);
        }
    }

    long long max_ans = max_x + max_y;
    for (auto a : xs) {
        for (auto b : ys) {
            if (s.find({a, b}) == s.end()) {
                printf("%lld\n", max_ans);
                return 0;
            }
        }
    }

    max_ans--;
    printf("%lld\n", max_ans);
    return 0;
}


Measured memory_bytes: 23856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll L, R, d; cin >> L >> R >> d;
    ll count = 0;
    for (int i = L; i <= R; ++i) {
        if (i % d == 0) count++;
    }
    cout << count << endl;
}

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

int main() {

 vector<vector<int>> a(3, vector<int>(3));

for (int i = 0; i < 3; i++) {

   cin >> a.at(i).at(0) >> a.at(i).at(1) >> a.at(i).at(2);
  /*  for (size_t j = 0; j < 3; j++)
    {
     cin >> a.at(i).at(j);
    }*/
  }

  int n;
  cin >> n;

  vector <int> b(n);
for (int u = 0; u < n; u++) {
    cin >> b.at(u);
    
  for (int i = 0; i < 3; i++) {
    for (size_t j = 0; j < 3; j++)
    {
      if(b.at(u)==a.at(i).at(j))
      {a.at(i).at(j)=200;}
    }
  }
  }
// a.at(i).at(j)==200が、穴の開いた状態

string bingo = "No";

for (int i = 0; i < 3; i++) {
     if( a.at(i).at(0)==a.at(i).at(1)&&a.at(i).at(1)==a.at(i).at(2)&&a.at(i).at(2)==a.at(i).at(0))
     {bingo = "Yes"; }
}


for (int j = 0; j < 3; j++) {

     if( a.at(0).at(j)==a.at(1).at(j)&&a.at(1).at(j)==a.at(2).at(j)&&a.at(2).at(j)== a.at(0).at(j))
     {bingo = "Yes";}
}

if( a.at(0).at(0)==a.at(1).at(1)&&a.at(1).at(1)==a.at(2).at(2)&&a.at(2).at(2)== a.at(0).at(0))
     {bingo = "Yes";}

if( a.at(2).at(0)==a.at(1).at(1)&&a.at(1).at(1)==a.at(0).at(2)&&a.at(0).at(2)== a.at(2).at(0))
     {bingo = "Yes";}

     cout << bingo << endl;

}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 256
from operator import itemgetter
n, m = map(int, input().split())
ab = sorted([tuple(map(int, input().split()))
             for i in range(m)], key=itemgetter(1))
removed = -1
ans = 0
for a, b in ab:
    # aがremoved以降の値ならまだ橋を取り除いてない
    if a > removed:
        removed = b - 1  # これでb-1からbには行けないようにする
        ans += 1  # 取り除いた分カウント

print(ans)


Measured memory_bytes: 18972
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        String[] b = sc.next().split("");
        int cntR = 0;
        int cntB = 0;
        for (int i = 0; i < a; i++) {
            if (b[i].equals("R")) {
                cntR++;
            } else {
                cntB++;
            }
        }
        if (cntR > cntB) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22864
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a;i>0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    ll n, m;
    cin >> n >> m;
    ll maxGcd = m / n;
    RREP(i, maxGcd){
        if(m % i)continue;
        print(i);
        return 0;
    }
}

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

#define ll long long
#define ldb long double
#define rep(i, x, n, j) for(int i=x;i<(int)n;i+=j)
#define F first
#define S second
#define per(i, x, n, j) for(int i=(int)n-1;i>=0;i-=j)
#define all(v) v.begin(),v.end()
#define sz(a) (int)a.size()

const int N = 2000100;
const ll MOD = 1e9+7;
const ll inf = 1e18+5;

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

int _;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x, y, a, b, c; cin >> x >> y >> a >> b  >> c;
	ll r[a], g[b], co[c];
	rep(i,0,a,1) cin >> r[i];
	rep(i,0,b,1) cin >> g[i];
	rep(i,0,c,1) cin >> co[i];
	vector<pair<ll, char>> v;
	rep(i,0,a,1) v.push_back({r[i], 'R'});
	rep(i,0,b,1) v.push_back({g[i], 'G'});
	rep(i,0,c,1) v.push_back({co[i], 'C'});
	sort(all(v));
	ll red=x, green=y, col=0;
	reverse(all(v));
	ll ans = 0;
	for(int i=0; i<sz(v); ++i){
		if(red+green-col<=0) break;
		ll amount = v[i].F, type = v[i].S;
		if(type=='R' && red>0){
			ans += amount; --red;
		}
		if(type=='G' && green>0){
			ans += amount; --green;
		}
		if(type=='C'){
			ans += amount; ++col;
		}
	}
	cout << ans << endl;
	return 0;
}


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

long long dp[90];

int main()
{
    dp[0] = 2;
    dp[1] = 1;
    for (int i = 2; i < 90; i++)
        dp[i] = dp[i - 1] + dp[i - 2];
    int N;
    cin >> N;
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    ll w,h,x,y;cin>>w>>h>>x>>y;
    double ans=(double)(h*w)/2.0;
    cout<<fixed<<setprecision(12)<<ans<<" ";
    if(2*x==w&&2*y==h)cout<<1<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,a;
    cin>>n>>a;
    if (n%500<=a)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll qpow(ll a,ll b,ll M) {a%=M;ll s=1;while(b){if(b&1)s=(s*a)%M;a=(a*a)%M;b>>=1;}return s; }
ll qmul(ll a,ll b,ll M) {a%=M;ll s=0;while(b){if(b&1)s=(s+a)%M;a=(a+a)%M;b>>=1;}return s; }
ll M,pt[20];
struct Matrix
{
    ll mat[3][3];
    Matrix() {memset(mat,0,sizeof(mat));}
    Matrix operator * (Matrix b)
    {
        Matrix res;
        rep(i,0,2) rep(j,0,2) rep(k,0,2) res.mat[i][j] = (res.mat[i][j] + mat[i][k]*b.mat[k][j]%M)%M;
        return res;
    }
    Matrix operator ^ (ll b)
    {
        Matrix res,A=*this;
        rep(i,0,2) res.mat[i][i] = 1;
        while(b){
            if(b&1) res = res * A;
            A = A*A;
            b>>=1;
        }
        return res;
    }
};
int main()
{
    fastio(); ll n,a,b;
    cin>>n>>a>>b>>M;
    ll ans = 0;
    pt[0] = 1;
    rep(i,1,18) pt[i] = pt[i-1]*10;
    ll L = a,R = a+(n-1)*b;
    rep(i,1,18){
        if(L < pt[i]){
            ll e = (pt[i]-L-1)/b*b+L;
            if(e>R) e = R;
            ll t = (e-L)/b + 1;
            Matrix A;
            A.mat[0][0] = pt[i]%M;
            A.mat[0][1] = A.mat[1][1] = A.mat[2][2] = 1;
            A.mat[1][2] = b%M;
            A = A^t;
            ans = (ans*A.mat[0][0]%M + L%M*A.mat[0][1]%M + A.mat[0][2]) %M;
            if(e==R)break;
            L = e + b;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys
from bisect import bisect_left

def main():
    N = int(input())
    L = sorted(list(map(int, input().split())))
    ans = 0

    for i in range(N-1):
        for j in range(i+1,N):
            index = bisect_left(L,L[i]+L[j])
            ans += max(0,index-j-1)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  int A[M];
  int total = 0;
  for(int i=0;i<M;i++)
  {
    cin >> A[i];
    total += A[i];
  }
  
  int can = N -total;
  if(can < 0) can = -1;
  cout << can <<endl;
  return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trii(x) cerr<<#x<<": ("<<x.F<<","<<x.S<<")\n";
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define triiset(s) cerr<<#s<<": ";for(auto &i:s) trii(i);
#define epsilon 0.000000001L
#define mod 1000000007ll
#define inf 9999999999999999ll
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define modulo 998244353ll

int main()
{
    fast();
    ll n;
    string s,t;
    cin>>n>>s>>t;
    string ans;
    for(ll i=0;i<n;i++)
    {
        ans.pb(s[i]);
        ans.pb(t[i]);
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n, k) for (int i = n; i < k; i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v)                      \
    for (int i = 0; i < v.size(); i++) \
        P(v[i]);
#define printt(a, b) cout << a << " " << b << endl;
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int MOD = 1e9 + 7;

int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};

void solve()
{
    int h, w;
    cin >> h >> w;
    vector<string> vs;
    vector<string> ans;
    rep(i, h)
    {
        string s;
        cin >> s;
        vs.push_back(s);
        ans.push_back(s);
    }
    rep(i, h)
    {
        rep(j, w)
        {
            if (vs[i][j] != '#')
            {
                int count = 0;
                rep(k, 8)
                {
                    if (i + dy8[k] >= 0 && i + dy8[k] < h && j + dx8[k] >= 0 && j + dx8[k] < w)
                    {
                        if (vs[i + dy8[k]][j + dx8[k]] == '#')
                            count++;
                    }
                }
                ans[i][j] = '0' + count;
            }
        }
    }
    rep(i, h)
    {
        rep(j, w)
        {
            cout << ans[i][j];
        }
        cout << endl;
    }
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n,x;
    
    cin >> n >> x;
    int moto = 0;

    vector<int> m(n);
    for(int i=0;i<n;i++){ 
        cin >> m[i];
        moto += m[i];
    }

    sort(m.begin(),m.end());

    cout << n + (x-moto)/m[0];
    return 0;
}

Measured memory_bytes: 888