akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
   ll N; cin >> N;
   Vi a(N);
   REP(i, N) cin >> a[i];
   SORT(a);

   ll count = -1, ans = -1;

   REP(x, 1e5 + 1){
      ll temp = upper_bound(a.begin(), a.end(), x + 1) - lower_bound(a.begin(), a.end(), x - 1);
      if(chmax(count, temp)) ans = x;
   }
   cout << count << endl;
}


Measured memory_bytes: 1024
N,W = map(int, input().split())
w,v = [0]*N, [0]*N
for i in range(N):
    w[i],v[i] = map(int, input().split())
    
dp = [0]*(W+1) 
for i in range(N):
    for j in reversed(range(W+1)):
        if j-w[i]<0:
            dp[j] = dp[j]
        else:
            dp[j] = max(dp[j],
                        dp[j-w[i]] + v[i])
    # print(dp)
print(dp[W])

Measured memory_bytes: 41964
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto nk = readints;
    int n = nk[0], k = nk[1];

    writeln(n % k == 0 ? 0 : 1);
}


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


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for (int a = 0; a <= N; ++a) {  
        for (int b = 0; b + a <= N; ++b) {  
            int c = N - a - b;  
            int total = 10000*a + 5000*b + 1000*c;
            if (total == Y) {  
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }

    

	cout << res10000 << " " << res5000 << " " << res1000 << "\n";
 } 



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    char d[k];
    for(int i = 0;i < k;i++)
    {
        cin >> d[i];
    }
    while(true)
    {
        bool flag = true;
        string s = to_string(n);
        for(int i = 0;i < s.size();i++)
        {
            for(int j = 0;j < k;j++)
            {
                if(s[i] == d[j])
                {
                    flag = false;
                    break;
                }
            }
            if(!flag)
            {
                break;
            }
        }
        if(!flag)
        {
            n++;
        }
        else
        {
            break;
        }
    }
    cout << n << "\n";
    
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abs/tasks/arc065_a


def main():
    s = input()
    t = s[:]
    no = False
    while len(t) > 0:
        if t[-1] == "m" and t[-5:] == "dream":
            t = t[:-5]
        elif t[-1] == "e" and t[-5:] == "erase":
            t = t[:-5]
        elif t[-1] == "r":
            if t[-6:] == "eraser":
                t = t[:-6]
            elif t[-7:] == "dreamer":
                t = t[:-7]
            else:
                no = True
                break
        else:
            no = True
            break
    if no:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int cnt[1000010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s; cin >> s;
    int x = 0;
    while(true) {
        cnt[s]++;
        x++;
        if(cnt[s] == 2) {cout << x << endl; return 0;}
        if(s % 2 == 0) s /= 2;
        else s = s * 3 + 1;
    }

    return 0;
}


Measured memory_bytes: 256
def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2])


formura = [i for i in input().split()]
stack = []

for i in range(len(formura)):
    if formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-':
        stack.append(formura[i])
        result = calc(stack)
        for j in range(3):
            stack.pop(-1)
        stack.append(result)
    else:
        stack.append(formura[i])

print(stack[0])

Measured memory_bytes: 7768
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		String st = sc.next();
		boolean map[] = new boolean[st.length()];

		for(int n=0;n<st.length();n++){
			if(st.charAt(n) == 'E') map[n] = true;
			else map[n] = false;
		}
		
		int min = st.length()+1;
		int cnt = 0;
		for(int m=1;m<st.length();m++){
			if(map[m]) cnt++;
		}
		min = cnt;
		for(int n=1;n<st.length();n++){
			if(!map[n-1]) cnt++;
			if(map[n]) cnt--;
			if(min > cnt) min = cnt;
		}
		
		System.out.println(min);
	}
}

Measured memory_bytes: 28732
while True:
    a,op,b=map(str,input().split())
    if op == "+":
        print(int(a)+int(b))
    elif op == "-":
        print(int(a)-int(b))
    elif op == "*":
        print(int(a)*int(b))
    elif op == "/":
        print(int(a)//int(b))
    else:
        break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=101;
const int W=1e5+1;
ll dp[N][W];
int main()
{
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<W;j++)
            dp[i][j]=LLONG_MAX;
    }
    int n,w;
    scanf("%i %i",&n,&w);
    vector<pair<int,int> > items(n);
    for(int i=0;i<n;i++)
        scanf("%i %i",&items[i].f,&items[i].s);
    dp[0][0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<W;j++)
        {
            if(dp[i][j]!=LLONG_MAX)
            {
                dp[i+1][j+items[i].s]=min(dp[i+1][j+items[i].s],dp[i][j]+items[i].f);
                dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            }
        }
    }
    for(int i=W-1;i>=0;i--)
    {
        if(dp[n][i]<=w)
        {
            printf("%i\n",i);
            return 0;
        }
    }
    printf("0\n");
    return 0;
}


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

int main() {
  int D;
  cin >> D;
  if(D == 25)
    cout << "Christmas" << endl;
  if(D == 24)
    cout << "Christmas Eve" << endl;
  if(D == 23)
    cout << "Christmas Eve Eve" << endl;
  if(D == 22)
    cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

void print_ans(bool flag){
    if(flag){
        cout << "yes" << endl;
    } else {
        cout << "no" << endl;
    }   
}

int main(){
    string s;
    cin >> s;
    sort(begin(s), end(s));
    bool ans = true;
    for(int i = 1; i < s.size(); i++){
        ans &= (s[i] != s[i-1]);
    }
    print_ans(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ld INF = 1e9+123;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ull a, ull b){
  if(a==b)return a;
   if (a%b==0)return(b);
   else return(gcd(b, (a%b)));
}
ll lcm(ll a,ll b){
  	if(a==b)return a;
  	if(a%b==0)return a;
  	else if(b%a==0)return b;
    return a/gcd(a,b)*b;
}
ll antidiv(ll N,ll C,ll D){
    return N-N/C-N/D+N/lcm(C,D);
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    int N;
    cin>>N;
    
    ll g=1;
    REP(i,N){
        ll t;
        cin>>t;
        g=lcm(g,t);
    }
    
    cout<<g;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main(){
  int A[N],n,i,j,minj,t,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<=n;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]){
        minj=j;
      }
    }
    t=A[i];
    A[i]=A[minj];
    A[minj]=t;
    if(i !=minj){
      count++;
    }
    }
    for(i=0;i<n;i++){
      if(i>0)printf(" ");
      printf("%d",A[i]);
    }
    printf("\n%d\n",count);
  }



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

int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	multiset<int, greater<int>> ms;
	for(int i=0; i<n; i++) {
		auto it = ms.upper_bound(a[i]);
		if(it != ms.end())
			ms.erase(it);
		ms.insert(a[i]);
	}
	cout << ms.size();
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;
int main() {
    ll n;cin >> n;
    ll k; cin >> k;
    set<ll> h;
    for(ll i=0;i<k;i++){
        ll x;
        cin >> x;
        h.insert(x);
    }
    vector<ll> cost(n+1,0);
    cost[0]=1;
    for(ll i=0;i<n;i++){
        if(h.find(i)!=h.end())continue;
        for(ll j=1;j<=2;j++){
            if(h.find(i+j)!=h.end())continue;
            if(i+j<=n)(cost[i+j]+=cost[i])%=1000000007;
        }
    }
    cout << cost[n] << endl;
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define int long long
using namespace std;

typedef pair<char,int> P;

int h, w, n, sy, sx;
string s, t;
vector<P> H, W;

signed main(){
  
  cin>>h>>w>>n;
  cin>>sy>>sx;
  cin>>s>>t;
  
  for(int i=0;i<n;i++){
    
    if( s[i] == 'L' || s[i] == 'R' ){
      W.push_back(P(s[i],0));
    }
    else{
      H.push_back(P(s[i],0));
    }

    if( t[i] == 'L' || t[i] == 'R' ){
      W.push_back(P(t[i],1));
    }
    else{
      H.push_back(P(t[i],1));
    }
    
  }
  
  int pos = sy;
  
  for(int i=0;i<(int)H.size();i++){
    
    char dir = H[i].first;
    int u = H[i].second;
    
    if( u == 0 && dir == 'D' ){
      pos++;
      if( pos > h ){
	cout<<"NO"<<endl;
	return 0;
      }
    }
    
    if( u == 1 && dir == 'U' ){
      if( pos != 1 ) pos--;
    }
    
  }
  
  pos = sy;
  
  for(int i=0;i<(int)H.size();i++){
    
    char dir = H[i].first;
    int u = H[i].second;
    
    if( u == 0 && dir == 'U' ){
      pos--;
      if( pos < 1 ){
	cout<<"NO"<<endl;
	return 0;
      }
    }
    
    if( u == 1 && dir == 'D' ){
      if( pos != h ) pos++;
    }
    
  }
  
  pos = sx;
  
  for(int i=0;i<(int)W.size();i++){
      
    char dir = W[i].first;
    int u = W[i].second;
    
    if( u == 0 && dir == 'R' ){
      pos++;
      if( pos > w ){
	cout<<"NO"<<endl;
	return 0;
      }
    }
    
    if( u == 1 && dir == 'L' ){
      if( pos != 1 ) pos--;
    }
    
  }
  
  pos = sx;
  
  for(int i=0;i<(int)W.size();i++){
    
    char dir = W[i].first;
    int u = W[i].second;
    
    if( u == 0 && dir == 'L' ){
      pos--;
      if( pos < 1 ){
	cout<<"NO"<<endl;
	return 0;
      }
    }
    
    if( u == 1 && dir == 'R' ){
      if( pos != w ) pos++;
    }
    
  }
  
  cout<<"YES"<<endl;
  
  return 0;
}


Measured memory_bytes: 10728
S=input()
e=[0,0]#全体、白の数
o=[0,0]
for i,s in enumerate(S):
    if i%2:#odd
        o[0]+=1
        o[1]+=int(s)
    else:
        e[0]+=1
        e[1]+=int(s)
eblack,ewhite=e[0]-e[1],e[1]
oblack,owhite=o[0]-o[1],o[1]
print(min(eblack+owhite,ewhite+oblack))
        
        

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> w(n);
  for(int i=0;i<n;i++){
    cin >> w[i];
    w[i]+=i>0?w[i-1]:0;
  }
  int ans=w[n-1];
  for(int i=0;i<n;i++){
    ans=min(ans,abs(w[n-1]-2*w[i]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


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


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return

# B


def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return

# C


def C():
    n, k, q = LI()
    d = [0] * n
    for _ in range(q):
        a = II() - 1
        d[a] += 1
    for a in d:
        if k - (q - a) > 0:
            print("Yes")
        else:
            print("No")
    return

# D


def D():
    n, = LI()
    a = LI()
    q = []
    for ai in a:
        heappush(q, ai)
    for _ in range(m):
        heappush(q, heappop(q) / 2)
    ans = 0
    while q:
        ans += int(heappop(q))
    print(ans)
    return

# E


def E():
    return

# F


def F():
    return


# Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 50416
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    int a,b,c;

    scanf("%d %d %d", &a, &b, &c);
    if (a-c == 0){
        printf("%d", b);
    }else if(a-b == 0){
        printf("%d", c);
    }else{
        printf("%d", a);
    }

    printf("\n");

    return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if (s.equals(u))
            a--;
        else
            b--;
        System.out.println(a + " " + b);
    }
}

Measured memory_bytes: 21716
n = int(input())
n = int(list(str(n))[-1])
list_ = [2, 4, 5, 7, 9]
if n in list_:
    print('hon')
list_ = [0, 1, 6, 8]
if n in list_:
    print('pon')
if n == 3:
    print('bon')


Measured memory_bytes: 9184
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    int n;
    cin>>n;

    if ( n % 2 == 0 )
    {
        cout<<n/2<<endl;
    }
    else
    {
        cout<<n/2 + 1<<endl;
    }
    
}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

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

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

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

const int DIM = 2e5 + 5;

long long arr[DIM], bit[DIM];
vector<long long> lst;

void update( int p, int x ) {
    for( int i = p; i < DIM; i += (i & (-i)) )
        bit[i] += x;
    return;
}

long long query( int p ) { long long x = 0;
    for( int i = p; i >= 1; i -= (i & (-i)) )
        x += bit[i];
    return x;
}

int main( void ) {
    ios::sync_with_stdio( false );
    cin.tie(); cout.tie();
    
    int n, k;
    cin >> n >> k;
    
    lst.push_back( 0 );
    for( int i = 1; i <= n; i ++ ) {
        cin >> arr[i];
        arr[i] += arr[i - 1] - k;
        
        lst.push_back( arr[i] );
    }
    
    sort( lst.begin(), lst.end() );
    lst.resize( unique( lst.begin(), lst.end() ) - lst.begin() );
    
    arr[0] = lower_bound( lst.begin(), lst.end(), arr[0] ) - lst.begin() + 1;
    update( arr[0], 1 );
    
    long long ans = 0;
    for( int i = 1; i <= n; i ++ ) {
        arr[i] = lower_bound( lst.begin(), lst.end(), arr[i] ) - lst.begin() + 1;
        ans += query( arr[i] ); update( arr[i], 1 );
    }
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, G, K,L, W, H, P, Q, R, V, X, Y;
  string S, T;
  cin >> N;
  if (N%2 == 1) cout << N/2 + 1 << endl;
  else cout << N/2;



}


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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
#define CNT __builtin_popcount
const int M=1<<22;
int s[M];
int id[M][3];
int main(){
    int N;
    cin>>N;
    REP(i,M)REP(j,3)id[i][j]=-1;
    REP(i,N){
        int k;cin>>k;
        int a=0;
        REP(j,k){
            int b;cin>>b;
            a|=(1<<(b-1));
        }
        s[a]=a;
        k=0;
        for(;k<2&&id[a][k]!=-1;k++);
        id[a][k]=i;
    }
    int res=0;
    FOR(i,1,M+1){
        int bit=M-i;
        int cnt=0;
        for(;cnt<3&&id[bit][cnt]!=-1;cnt++);
        REP(j,22){
            int nxt=bit|(1<<j);
            s[bit]|=s[nxt];
            REP(k,3){
                if(cnt==3||id[nxt][k]==-1)break;
                if(id[nxt][k]!=id[bit][0]&&id[nxt][k]!=id[bit][1]&&id[nxt][k]!=id[bit][2])
                    id[bit][cnt++]=id[nxt][k];
            }
        }
        if(id[bit][2]!=-1)
            chmax(res,CNT(bit)*CNT(s[bit]));
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 68740
#60
#ALDS1_2_A
n=int(input())
*l,=map(int,input().split())
flag=0

for i in range(n):
    for j in range(n-1):
        if l[j+1]<l[j]:
            l[j],l[j+1]=l[j+1],l[j]
            flag+=1
print(*l)
print(flag)


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct Combinatorics {
  using int64 = long long;
  int64 mod;
  int64 fact[202020];
  int64 invfact[202020];
  Combinatorics(int64 mod):mod(mod) {
    fact[0] = invfact[0] = 1;
    for(int i = 1; i < 202020; ++i) {
      fact[i] = fact[i-1]*i%mod;
      invfact[i] = minv(fact[i]);
    }
  }
  int64 mpow(int64 x, int64 n) const {
    int64 res = 1;
    while(n > 0) {
      if(n&1) res = res*x%mod;
      x = x*x%mod;
      n >>= 1;
    }
    return res;
  }
  int64 minv(int64 x) const {
    return mpow(x, mod-2);
  }
  int64 mfact(int64 x) const {
    return fact[x];
  }
  int64 C(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[r]%mod*invfact[n-r]%mod;
  }
  int64 P(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[n-r]%mod;
  }
}C(mod);


signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int r, c, ay, ax, by, bx;
  cin >> r >> c >> ay >> ax >> by >> bx;

  int By[3][3], Bx[3][3];
  reps(i, -1, 2) reps(j, -1, 2) {
    By[i+1][j+1] = by+i*r;
    Bx[i+1][j+1] = bx+j*c;
  }

  int mod = 1e8+7;
  Combinatorics comb(mod);

  int mn = inf;
  rep(i, 3) rep(j, 3) {
    chmin(mn, llabs(ay-By[i][j])+llabs(ax-Bx[i][j]));
  }

  int ans = 0;
  rep(i, 3) rep(j, 3) {
    int d = llabs(ay-By[i][j])+llabs(ax-Bx[i][j]);
    if(mn == d) {
      ans += comb.C(mn, llabs(ay-By[i][j]));
      ans %= mod;
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 9536
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        long long int a, b, ab;
        cin >> a >> b;
        ab = a * b - 1;
        long long int bb = 1, ee = ab;
        while (bb < ee) {
            long long int m = (bb + ee) / 2 + 1;
            if (ab / m < m) {
                ee = m - 1;
            } else {
                bb = m;
            }
        }
        long long int res = bb * 2;
        if (ab / bb == bb) res--;
        if (bb >= a) res--;
        if (bb >= b) res--;
        cout << res << endl;
    }
}




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

const int X_MAX = 100000 + 1;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n = 1) : n(n), f(n + 1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i * i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x; }
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
} sieve(X_MAX);

int main() {
  vector<int> d(X_MAX);
  for (int i = 1; i <= X_MAX; i++) {
    if (i % 2 == 0) {
      d[i + 1] = d[i];
      continue;
    }
    d[i + 1] = d[i] + (sieve.isPrime(i) && sieve.isPrime((i + 1) / 2));
  }

  int q;
  cin >> q;
  rep(i, q) {
    int l, r;
    cin >> l >> r;
    cout << d[r + 1] - d[l] << endl;
  }
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<string> S;
	REP(i, N){
		string T;
		cin >> T;
		S.push_back(T);
	}
	ll res = 0;
	REP(i, N){
		bool flag = true;
		REP(j, N)REP(k, N){
			//dump(S[j][(i+k)%N])
			//dump(S[(i+k)%N][j])
			if(S[j][(i+k)%N]!=S[k][(i+j)%N]) flag = false;
		}
		if(flag) res += N;
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

int dx[4] = {-1,0,1,0};
int dy[4] = {0,1,0,-1};
int dist[1002][1002];
char maze[1002][1002];

int main(){

    rep(i,1002){
        rep(j,1002){
            dist[i][j] = -1;
        }
    }

    int H,W;
    cin >> H >> W;
    int cnt=0;
    rep(i,H){
		rep(j,W){
            cin >> maze[i][j];
        }
    }

	queue<Point> Q;
    rep(i,H){
        rep(j,W){
            if (maze[i][j]=='#'){
                Point s = {i, j};
                Q.push(s);
                dist[i][j] = 0;
            }
        }
    }

	while(!Q.empty()){
		Point now = Q.front();
		Q.pop();
		rep(i, 4){
			Point next = {now.x+dx[i],now.y+dy[i]};
            if( next.x < 0 || next.x >= H || next.y < 0 || next.y >= W ) continue;
			if( maze[next.x][next.y] == '#' ) continue; // 壁
			if( dist[next.x][next.y] != -1 ) continue; // visited
			dist[next.x][next.y] = dist[now.x][now.y] + 1;
			Q.push(next);
		}
	}
    int ans = 0;
    rep(i,H)rep(j,W){
        ans = max(ans, dist[i][j]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, double> P;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = { 0, 1, 0, -1 };

int main() {

	int a, b, c;
	cin >> a >> b >> c;
	int cnt = 0;
	
	if (a == c) cnt++;
	if (a == b) cnt++;
	if (b == c) cnt++;

	if (cnt > 1) cout << 1 << endl;
	if (cnt == 1) cout << 2 << endl;
	if (cnt == 0) cout << 3 << endl;

	return 0;
}

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

using namespace std;

#define int long long

const int N=1e5+5;
struct data{
    int x,y,id;
} c[N];
int n,pset[N],ans;
vector< pair< int,pair<int,int> > > edge;

bool cmpx(data _a,data _b){
    if(_a.x!=_b.x) return _a.x<_b.x;
    else return _a.y<_b.y;
}
bool cmpy(data _a,data _b){
    if(_a.y!=_b.y) return _a.y<_b.y;
    else return _a.x<_b.x;
}

int findset(int pos){
    return ( pos==pset[pos]?pos:pset[pos]=findset(pset[pos]) );
}

bool sameset(int i,int j){
    return findset(i)==findset(j);
}

void unionset(int i,int j){
    pset[findset(i)]=findset(j);
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;++i) cin>>c[i].x>>c[i].y,c[i].id=i;
    sort(c+1,c+n+1,cmpx);
    for(int i=1;i<n;++i) edge.push_back(make_pair(c[i+1].x-c[i].x,make_pair(c[i+1].id,c[i].id)));
    sort(c+1,c+n+1,cmpy);
    for(int i=1;i<n;++i) edge.push_back(make_pair(c[i+1].y-c[i].y,make_pair(c[i+1].id,c[i].id)));
    sort(edge.begin(),edge.end());
    for(int i=1;i<=n;++i) pset[i]=i;

    for(int i=0;i<edge.size();++i){
        int w=edge[i].first,u=edge[i].second.first,v=edge[i].second.second;
        if(!sameset(u,v)){
            ans+=w;
            unionset(u,v);
        }
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 10864
def main():

    numlist = set()
    x = int(input())

    for _ in range(x):
        numlist.add(tuple(input().split()))
    
    cards = set()
    for mark in ('S', 'H', 'C', 'D'):
        for i in range(1,14):
            cards.add((mark, str(i)))

    for item in numlist:
        cards.remove(item)

    for mark in ('S', 'H', 'C', 'D'):
        for i in range(1, 14):
            if (mark, str(i)) in cards:
                print(mark, i)

if __name__ == '__main__':
    main()


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

int main() {
  char a,b;
  cin>>a>>b;
  if((a=='H' && b=='H') || (a=='D'&&b=='D')){
    cout<<'H'<<endl;
  }
  else{
    cout<<'D'<<endl;
  }
}

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

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

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

const ll mod = 1e9 + 7;


int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n;
    cin >> n;
    string s;
    cin >> s;

    for (int i; i < s.size(); i++){
        if(s[i] + n > 'Z'){
            s[i] += n -('Z' - 'A') - 1;
        }else{
            s[i] += n;
        }
    }



    cout << s << endl;

    return 0;
}



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

#define ll long long int
#define vll vector<ll>

int main() {

    int N;
    ll C, K;
    cin >> N >> C >> K;

    ll t;
    vll T;

    for (ll i = 0; i < N; i++) {
        cin >> t;
        T.push_back(t);
    }

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

    ll ans = 0;
    ll num = 1;
    ll limit = T[0] + K;
    for (ll i = 1; i < N; i++) {
        if (num < C && T[i] <= limit) {
            num++;
        }
        else {
            ans++;
            num = 1;
            limit = T[i] + K;
        }
    }
    if (num) ans++;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
int main()
{
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    m=(S-h*3600)/60;
    s=(S-h*3600-m*60);
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


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

int main(void) {
    const string ret[3] = {"GREATER", "LESS", "EQUAL"};
    string a, b;
    int rank = 2;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b;
    if (a.length() > b.length()) {
        rank = 0;
    } else if (a.length() < b.length()) {
        rank = 1;
    } else {
        if (a > b) {
            rank = 0;
        } else if (a < b) {
            rank = 1;
        } else {
            rank = 2;
        }
    }

    cout << ret[rank] << "\n";
    return 0;
}

Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f=0,x=0,g,p=0,q=0,y=0,z=0;

    vector<pair<long long,long long>>v;
    vector<long long>u;
    map<string,long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4,s5,s6;
   cin>>n>>m;
   if(m*2>=n)
   {
       cout<<0<<endl;
   }
   else{cout<<(n-(m*2))<<endl;}




}


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

int main() {
    int a, b;
    std::cin >> a >> b;

    if (a < b) {
        for (int i = 0; i < b; ++i) {
            std::cout << a;
        }
        std::cout << std::endl;
    } else {
        for (int i = 0; i < a ; ++i) {
            std::cout << b;
        }
        std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

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

		int n = sc.nextInt();

		String ans = "No";

		outer:
		for (int i = 0; i * 4 <= n; i++) {
			for (int j = 0; i * 4 + j * 7 <= n; j++) {
				if (i * 4 + j * 7 == n) {
					ans = "Yes";
					break outer;
				}
			}
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 23764
a,b,c,x,y = map(int, input().split())
sm=0
if a+b>c*2:
    mn=min(x,y)
    sm+=c*mn*2
    x-=mn
    y-=mn
    if a>2*c:
        sm+=x*2*c
    else:
        sm+=x*a
    if b>2*c:
        sm+=y*2*c
    else:
        sm+=y*b
else:
    sm+=a*x+b*y

print(sm)


Measured memory_bytes: 8988
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x-r<0||x+r>W||y-r<0||y+r>H){
    printf("No\n");
  }
  else{
    printf("Yes\n");
  }
  return(0);
}

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

int par[200000]; //union-find
int ranks[200000]; //union-find
void init(int n){ //union-find 
    for(int i=0;i<n;i++){
        par[i]=i;
        ranks[i]=0;
    }
}

int find(int x){ //union-find
    if(par[x]==x){
        return x;
    }
    else{
        return par[x]=find(par[x]);
    }
}

void unite(int x, int y){ //union-find
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(ranks[x]<ranks[y]){
        par[x]=y;
    }
    else{
        par[y]=x;
        if(ranks[x]==ranks[y]) ranks[x]++;
    }
}

bool same(int x, int y){ //union-find
    return find(x) == find(y);
}


struct place{int i,x,y;};
struct edge{int u,v,cost;}; //クラスカル
bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}

bool sx(const place &a,const place &b){
    return a.x < b.x;
}

bool sy(const place &a,const place &b){
    return a.y < b.y;
}


int main(){
    int n;
    cin >> n;
    vector<place> v;
    vector<edge> G;
    int x[n],y[n];
    rep(i,n){
        int xx,yy;
        cin >> xx >> yy;
        place p = {i,xx,yy};
        v.push_back(p);
    }
    sort(v.begin(),v.end(),sx);
    rep(i,n-1){
        edge e = {v[i].i,v[i+1].i,v[i+1].x-v[i].x};
        G.push_back(e);
    }
    sort(v.begin(),v.end(),sy);
    rep(i,n-1){
        edge e = {v[i].i,v[i+1].i,v[i+1].y-v[i].y};
        G.push_back(e);
    }

    init(n);
    sort(G.begin(),G.end(),comp);

    int res=0;
    for(int i=0;i<G.size();i++){
        edge e = G[i];
        if(!same(e.u,e.v)){
            unite(e.u,e.v);
            res+=e.cost;
        }
    }
    cout << res << endl;


}

Measured memory_bytes: 6132
using System;

namespace ABC055B
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            long surplus = 1;
            for (int i = 1; i <= n; i++)
            {
                surplus = (surplus * i) % 1000000007;
            }

            Console.WriteLine($"{surplus}");
        }
    }
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scan sc = new Scan();
            write wr = new write();
            int[] ab = sc.intarr;

            wr.wri(Method.max(ab[0] + ab[1], ab[0] - ab[1], ab[0] * ab[1]));
            
            
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();
    }


    //出力クラス
    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


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

bool C(string x) {
    for(char c : x) {
        if(c != 'A' && c != 'C' && c != 'G' && c != 'T') return false;
    }
    return true;
}

int main() {
    string S; cin >> S;
    size_t res = 0;
    for(int i=0; i<S.size(); ++i) {
        for(int k=1; i+k<=S.size(); ++k) {
            string tmp = S.substr(i, k);
            if(C(tmp)) res = max(res, tmp.size());
        }
    }
    cout << res << endl;
}

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

typedef long long ll;
const long long MAX = 3500LL;

int main() {
    ll N; cin >> N;
    for(ll h = 1; h <= MAX; h ++) {
        for(ll n = 1; n <= MAX; n ++) {
            ll x = N*h*n;
            ll y = 4*h*n - N*(n+h);
            if(y>0 && x%y==0) {
                ll w = x/y;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <cstring>
#include <string>
#include <bitset>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
#define st first
#define sd second
#define mkp make_pair
#define pb push_back
void wenjian(){freopen("concatenation.in","r",stdin);freopen("concatenation.out","w",stdout);}
void tempwj(){freopen("hash.in","r",stdin);freopen("hash.out","w",stdout);}
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a % b);}
ll qpow(ll a,ll b,ll mod){a %= mod;ll ans = 1;while(b){if(b & 1)ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans;}
struct cmp{bool operator()(const pii & a, const pii & b){return a.second > b.second;}};
int lb(int x){return  x & -x;}

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 2147483648;
const int maxn = 2e3 + 5;

int main()
{
    int l,r,d;
    scanf("%d%d%d",&l,&r,&d);
    int ans = r / d - (l - 1) / d;
    printf("%d\n",ans);
}


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

class Solution
{
  public static void Main(string[] args)
  {
    var n = int.Parse(Console.ReadLine());
    var mochis = new int[n];
    for (var i = 0; i < n; i++) mochis[i] = int.Parse(Console.ReadLine());

    var mochiSet = new HashSet<int>();
    foreach (var m in mochis)
    {
      mochiSet.Add(m);
    }
    Console.WriteLine($"{mochiSet.Count}");
  }
}


Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back

using namespace std;
typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int K;
  cin >> K;
  vector<string> v;
  REP(i, s.size()) {
    for (int j = 1; j <= 5; j++) {
      if (i + j <= s.size()) {
        v.PB(s.substr(i, j));
      }
    }
  }
  sort(ALL(v));
  v.erase(unique(ALL(v)), v.end());
  cout << v[K - 1] << endl;

  return 0;
}

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

int main() {
  int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1, dy = y2 - y1;
  int x3 = x2 - dy, y3 = y2 + dx, x4 = x1 - dy, y4 = y1 + dx;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}

Measured memory_bytes: 3600