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

using namespace std;

#define MOD 1000000007
typedef long long int ll;

ll a[100001]={0};
ll b[100001]={0};
ll c[100001]={0};


int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
        
	ll x,y,A,B,C;
	cin>>x>>y>>A>>B>>C;
	for(ll i=1;i<=A;i++){
		cin>>a[i];
	}
	for(ll i=1;i<=B;i++){
		cin>>b[i];
	}
	for(ll i=1;i<=C;i++){
		cin>>c[i];
	}

	sort(a+1,a+A+1,greater<>());
	sort(b+1,b+B+1,greater<>());
	sort(c+1,c+C+1,greater<>());
	for(ll i=1;i<=A;i++){
		a[i]+=a[i-1];
	}
	for(ll i=1;i<=B;i++){
		b[i]+=b[i-1];
	}
	for(ll i=1;i<=C;i++){
		c[i]+=c[i-1];
	}
	ll ans=0;
	for(ll i=0;i<=x;i++){
		ll first=0;
		ll last=y;
		ll maxi=0;
		while(first<=last){
			ll mid1=first+(last-first)/3;
			ll mid2=last-(last-first)/3;
			ll ans1=b[mid1]+c[(x+y)-(i+mid1)];
			ll ans2=b[mid2]+c[(x+y)-(i+mid2)];
			maxi=max(maxi,max(ans1,ans2));
			if(ans1>=ans2){
				last=mid2-1;
			}
			else{
				first=mid1+1;
			}
		}
		ans=max(ans,a[i]+maxi);
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
set<int>::iterator gt(set<int>& bst, const int& v) { return bst.upper_bound(v); }
set<int>::iterator ge(set<int>& bst, const int& v) { return bst.lower_bound(v); }
set<int>::iterator lt(set<int>& bst, const int& v) { return bst.lower_bound(v) == bst.begin() ? bst.end() : --bst.lower_bound(v); }
set<int>::iterator le(set<int>& bst, const int& v) { return bst.upper_bound(v) == bst.begin() ? bst.end() : --bst.upper_bound(v); }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    set<int> s;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        s.insert(x);
    }
    int N = *s.rbegin();
    cout << N << " ";
    s.erase(N);
    auto lep = le(s, N / 2);
    auto gep = ge(s, N / 2);
    if(lep == s.end()) {
        cout << *gep << endl;
    } else if(gep == s.end()) {
        cout << *lep << endl;
    } else if(N % 2 == 0) {
        cout << (abs(*lep - N / 2) < abs(*gep - N / 2) ? *lep : *gep) << endl;
    } else {
        cout << (abs(*lep - N / 2) < abs(*gep - (N + 1) / 2) ? *lep : *gep) << endl;
    }
    return 0;
}


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

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

inline ll qpow(ll a,ll n){
    ll res=1;
    while(n){
        if(n&1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int n,m;
ll ans,f[500005]={1},inv[500005]={1};

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    for(int i=1;i<=5e5;i++){
        f[i]=f[i-1]*i%mod;
        inv[i]=qpow(f[i],mod-2);
    }
    cin>>n>>m;
    for(int i=0;i<=n;i++){
        ans=(ans+f[n]*inv[i]%mod*inv[n-i]%mod*((i&1)?-1:1)*f[m-i]%mod*inv[m-n]%mod)%mod;
    }
    for(int i=m-n+1;i<=m;i++)ans=ans*i%mod;
    cout<<(ans+mod)%mod<<endl;

    return 0;
}

Measured memory_bytes: 11420
/**
 *    Creator :  bizarre
 *    Date : 4/2020
 *    Problem Number : 478
**/
#include <bits/stdc++.h>
using namespace std;
#define bizarre  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define ll long long
/*
vector<int> prime_Numbers;
int primes[1000005];
void prime(int n)
{
    primes[1]=primes[0]=0;
    for(int i=2; i<=n; i++)
        primes[i]=true;
    for(int i=2; i<=n; i++)
    {
        if(primes[i]==true)
        {
            prime_Numbers.push_back(i);
            for(int j=i+i; j<=n; j+=i)
                primes[j]=false;
        }
    }
    for(int i=2;i<=n;i++)
        primes[i]+=primes[i-1];
}
void move1step(long long& a, long long& b, long long q)
{
    long long c= a-q*b;
    a=b;
    b=c;
}
long long egcd(long long r0,long long r1,long long& x0,long long& y0)
{
    long long x1=0,y1=1;
    x0=1;
    y0=0;
    while(r1)
    {
        long long q=r0/r1;
        move1step(r0,r1,q);
        move1step(x0,x1,q);
        move1step(y0,y1,q);
    }
    return r0;
}
bool  solve (long long a, long long b, long long c,long long&x, long long& y)
{
    long long g=egcd(a,b,x,y);
    int m=c/g;
    x*=m;
    y*=m;
    return c%g==0;
}
int gcd(int a, int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
void PrimeFactorization(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        int c=0;
        if(n%i==0)
        {
            while(n%i==0)
            {
                n/=i;
            }

        }
    }

}
long long ncrtane(long long n, long long r)
{
    long long ans=1,cntr=1;
    for(int i=n;i>n-r;i--)
    {
        ans*=i;
        ans/=cntr;
        cntr++;
    }
    return ans;
}
const int N = 1e6 + 5, inf = 2e9, mod = 1e9 + 7;
long long fact[N], inv[N];
long long fp(long long base, long long exp)
{
    if (exp == 0)
        return 1;
    long long ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}
void pre(long long n)
{
    fact[0] = 1;
    inv[0] = 1;
    for (long long i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}
int ncr(long long n, long long r)
{
    return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}

int npr(long long n, long long r)
{
    return (fact[n] * inv[n - r]) % mod;
}

*/
const int N=1e5+5;
int n,k,a[N],dp[N];
ll solve(int indx)
{
    if(indx==n-1)
        return 0;
    if(dp[indx]!=-1)
        return dp[indx];
    ll ans=solve(indx+1)+abs(a[indx]-a[indx+1]);
    for(int i=2;i<=k;i++)
    {
        if(indx+i<n)
       ans=min(ans,solve(indx+i)+abs(a[indx]-a[indx+i]));
    }
    return dp[indx]=ans;
}
int main()
{
    bizarre
    cin>>n>>k;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)cin>>a[i];
    cout <<solve(0);
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
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); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b) + min(c, d) << endl;
}

Measured memory_bytes: 256
import sys
def 解():
    N,K=[int(_) for _ in sys.stdin.readline().split()]
    aH=sorted(int(_) for _ in sys.stdin.readlines())

    iDiff = aH[-1]
    for i in range(N-K+1):
        d = aH[i+K-1] - aH[i]
        if d < iDiff:
            iDiff = d
        #if iDiff == 0:
        #   break
    print(iDiff)
解()


Measured memory_bytes: 14244
#include <iostream>
using namespace std;
long long n,ans;

int main()
{
    cin >> n;
    ans = n-1;
    for (int i = 1; i <=  1000000; i++)
    {
        if (n % i == 0)
        {
            if (n / i + i-2 < ans)
            {
                ans = n / i + i - 2;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        List<Pair<Integer, Integer>> list = new ArrayList<Pair<Integer, Integer>>(); 
        
        for(int i = 0; i < n; i++){
            list.add(new Pair<Integer,Integer>(sc.nextInt(),sc.nextInt()));
        }
        
        list.sort((a,b) -> a.getKey() - b.getKey());
        
        long res = 0;
        
        for(Pair<Integer,Integer> pair : list){
            if(pair.getValue() <= m){
                m-=pair.getValue();
                res+=(long) pair.getKey() * (long) pair.getValue();
            }else{
                res+=(long) pair.getKey() * (long) m;
                break;
            }
        }
        
        System.out.println(res);
    }
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
    
    public Pair(final K key, final V value) {
        super(key, value);
    }
 }



Measured memory_bytes: 96992
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    k = int(input())
    s = input()
    if len(s) > k:
        print(s[:k] + '...')
    else:
        print(s)

if __name__ == '__main__':
  main()


Measured memory_bytes: 10972
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def hoge(n, m):
    n = n % 12
    b = 30*n+0.5*m
    s = 6*m
    ans = min(abs(b-s), 360-abs(b-s))
    if ans == 360:
        ans = 0
    return ans

def solve():
  a, b, h, n = map(int, input().split())
  p = hoge(h, n)
  ans = math.sqrt(a**2+b**2-(2*a*b*math.cos(math.radians(p))))
  print(ans)
  return 0
 
if __name__ == "__main__":
  solve()


Measured memory_bytes: 31240
import java.util.*;

class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      int d = a / b;
      int r = a % b;
      double f = (double)a / b;
      System.out.printf("%d %d %.5f\n", d, r, f);
   }
}

Measured memory_bytes: 17332
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.io.*;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

//    public static void main(String[] args)
////    {
////        System.out.println("Hello World!");
////
//////    ArrayList<int> arr= new ArrayList<int>(1,2,3,4,5);
////        var arr= new ArrayList<Integer>();
////        arr.add(1);
////        arr.add(4);
////        arr.add(3);
////        arr.add(5);
////        arr.add(2);
////        Collections.sort(arr);
////        var max = Collections.max(arr);
////        var min = Collections.min(arr);
////        for (var value:
////             arr) {
////            System.out.println(value);
////        }
////        System.out.println(max);
////        System.out.println(min);
////    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();

        if (a <= x && a + b >= x){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21844
#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 convert_num(vector<int> array){
    int res=0;
    rep(i, array.size()){
        res = 10*res+array[i];
    }
    return res;
}

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

  map<int, int> mp;
  vector<int> array(n);
  rep(i,n) array[i] = i+1;
  int cnt = 1;
  do{
      int num = convert_num(array);
      mp[num] = cnt;
      cnt++;
  }while(next_permutation(array.begin(), array.end()));

  vector<int> p(n), q(n);
  rep(i,n) cin >>p[i];
  rep(i,n) cin >>q[i];
  int P = convert_num(p);
  int Q = convert_num(q);

  cout << abs(mp[P] - mp[Q]) << endl;
  return 0;
}


Measured memory_bytes: 2176
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int a, b;
	cin >> a >> b;
	string s = "==";
	if (a > b)
		s = ">";
	else if (a < b)
		s = "<";
	cout << "a " + s + " b" << endl;

	return 0;
}


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

#define YESNO(x) x ? printf("YES") : printf("NO")
#define YesNo(x) x ? printf("Yes") : printf("No")
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define scani(x) scanf("%d", &x)
#define scanll(x) scanf("%lld", &x)
#define printi(x) printf("%d", x)
#define printll(x) printf("%lld", x)
typedef long long ll;
using namespace std;

long long GCD(long long x, long long y) {
	return y ? GCD(y, x % y) : x;
}

long long LCM(long long x, long long y) {
	return x * y / GCD(x, y);
}

int A() {
	int n;
	scani(n);

	switch (n % 10) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		printf("hon");
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		printf("pon");
		break;
	case 3:
		printf("bon");
		break;
	}

	return 0;
}

int B() {
	int k;
	string s;
	scani(k);
	cin >> s;

	if (s.length() <= k) {
		for (int i = 0; i < s.length(); i++) {
			printf("%c", s[i]);
		}
	}
	else {
		for (int i = 0; i < k; i++) {
			printf("%c", s[i]);
		}
		printf("...");
	}

	return 0;
}

int Main() {
	const double PI = 3.14159265358979323846;
	int a, b, h, m;

	scani(a);
	scani(b);
	scani(h);
	scani(m);

	long double ax = (long double)a * sinl((long double)2.0 * PI * ((long double)h / (long double)12.0 + (long double)m / (long double)60.0 / 12.0));
	long double ay = (long double)a * cosl((long double)2.0 * PI * ((long double)h / (long double)12.0 + (long double)m / (long double)60.0 / 12.0));
	long double bx = (long double)b * sinl((long double)2.0 * PI * (long double)m / (long double)60.0);
	long double by = (long double)b * cosl((long double)2.0 * PI * (long double)m / (long double)60.0);

	long double xDist = ax - bx;
	long double yDist = ay - by;
	long double sum = xDist * xDist + yDist * yDist;
	long double ans = sqrtl(sum);
	printf("%.11Lf", ans);

	return 0;

}

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

Measured memory_bytes: 4136
#pragma comment(linker, "/stack:200000000")

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ull unsigned long long
#define ld long double
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;

using namespace std;

const int N = 1e5 + 123;
int n , h[N] , dp[N];
main(){
	scanf("%lld" , &n);
	for(int i = 1 ; i <= n ; i++){
		dp[i] = 1e18;
		scanf("%lld" , &h[i]);
	}
	dp[1] = 0;
	for(int i = 1 ; i <= n ; i++){
		dp[i + 1] = min(dp[i] + abs(h[i] - h[i + 1]) , dp[i + 1]);
		dp[i + 2] = min(dp[i] + abs(h[i] - h[i + 2]) , dp[i + 2]);
	}
	printf("%lld" , dp[n]);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  int N;
  cin >> N; 

  vector<int> A(N);
  
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  } 
  
  vector<int> B(N);
  for (int j = 0; j < N; j++) {
    B.at(A.at(j) - 1) = j + 1;
  }
  
  for (int i = 0; i < N; i++)
      cout << B.at(i) << " ";
  cout << endl;
}


Measured memory_bytes: 1664
n = int(input())
p_list = list(map(int,input().split()))

cnt = 0
for i in range(n-2):
    if (p_list[i]<p_list[i+1]<p_list[i+2]) or (p_list[i]>p_list[i+1]>p_list[i+2]):
        cnt += 1

print(cnt)

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

int main(){
    long int A,B;
    int K,i;
    scanf("%ld %ld %d",&A,&B,&K);
    if (B-A >= 2*K){
        long int * s = malloc(sizeof(long int)*2*K);
        for(i=0;i<K;i++){
            s[i]=A+i;
            s[2*K-1-i]=B-i;
        }
        for(i=0;i<2*K;i++){
            printf("%ld\n", s[i]);
        }        
    } else{
        for(i=A;i<=B;i++){
        printf("%d\n", i);
        }
    }
    return 0;
}

Measured memory_bytes: 128
// Problem : A - αlphabet
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//mst,pq,mp,st,q
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {	
    	char ch1;
    	cin>>ch1;
    	for(char ch='A';ch<='Z';++ch)
    	{
    		if(ch==ch1)
    		{
    			cout<<"A";
    			return 0;
    		}
    	}
    	cout<<'a';		
    }
    return 0;
}


Measured memory_bytes: 3608
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
    if (a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2)
    {
        cout << "infinity" << endl;
        return;
    }
    if (a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2)
    {
        swap(a1, b1);
        swap(a2, b2);
    }
    if (a1 > b1)
    {
        cout << 0 << endl;
        return;
    }
    i64 d = (a1 * t1 + a2 * t2) - (b1 * t1 + b2 * t2);
    //print(a1, a2, b1, b2, d);
    cout << 2 * (((b1 - a1) * t1 + d - 1) / d) - 1 + ((b1 - a1) * t1 % d == 0) << endl;
}

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b, c;

	cin>>a>>b>>c;

	cout<<yn(c>=a&&c<=b)<<endl;
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(intr i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print64_t_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) print64_tf(a?"Yes\n":"No\n")
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

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

  int64_t n;
  cin >> n;
  map<int64_t, int64_t, greater<int64_t>> mp;
  rep(i,n) {
    int64_t a;
    cin >> a;
    mp[a]++;
  }

  int64_t res = 1, idx = 2;
  for(auto P : mp) {
    int64_t f = P.fi;
    int64_t s = P.se / 2;
    //cout << f << " " << s << endl;
    while(s > 0 && idx > 0) {res *= f; s--; idx--;}
  }
  if(idx == 2) res = 0;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 6528
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int r, c;
		r = in.nextInt();
		c = in.nextInt();
		int table[][] = new int[r+1][c+1];
		for(int i=0;i<r;i++) {
			for(int j=0;j<c;j++) {
				table[i][j] = in.nextInt();
			}
		}
		int[] colSum = new int[c+1];
		for(int i=0;i<r;i++) {
			int rowSum = 0;
			for(int j=0;j<=c;j++) {
				rowSum += table[i][j];
				if(j == c) {
					table[i][j] = rowSum;
				}
				colSum[j] += table[i][j];
			}
		}
		for(int i=0;i<=c;i++) {
			table[r][i] = colSum[i];
		}

		for(int i=0;i<=r;i++) {
			for(int j=0;j<=c;j++) {
				System.out.print(String.format("%d%s", table[i][j], (j == c) ? "": " "));
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 53428
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;

using namespace std;

//Binary exponent
ll Bin_pow(ll a,ll b)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
        {
            res=res*a;
        }
        a=a*a;
        b>>=1;
    }
    return res;
}

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

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll n;
	cin>>n;
	
	if(n%1000==0)
	    cout<<0<<"\n";
	else
	{
	    cout<<1000-(n-1000*(n/1000));
	}
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <cctype>
//小文字を大文字 c-0x20;


#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define vvll(z,a,b) vector<vector<ll>>z(a,vector<ll>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
using namespace std;


int main(){
  string s,p;
  cin>>s>>p;
  size_t hu=s.length();
  size_t pu=p.length();
  int flag=0,ff=0;
 
 rep(i,hu){
  flag=0; int k=0;
   if(s[i]==p[0]){
     
     for(int j=i;j<hu;j++){
       
      if(flag==pu){ff=1;break;}
       if(s[j]!=p[k]){
        
         break;}
        if(j==hu-1)j=-1;
       flag++;
       k++;
     }
if(ff)break;
   }
 
 }
 
 if(flag==pu)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;


}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const int MOD = pow(10, 9) + 7;
//const int LLINF = pow(2, 61) - 1;
//const int INF = pow(2, 30) - 1;
const int MAX = MOD;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); --i)



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

  
  ll H,W;
  cin >> H>>W;

  if(H==1||W==1){
    cout << 1 << endl;
  }
  else{
    if (H % 2 == 0)
    {
      if (W % 2 == 0)
      {
        cout << H * W / 2 << endl;
      }
      else
      {
        cout << H * W / 2 << endl;
      }
    }
    else
    {
      if (W % 2 == 0)
      {
        cout << H * W / 2 << endl;
      }
      else
      {
        cout << H * (W - 1) / 2 + (H + 1) / 2 << endl;
      }
    }
  }



}

Measured memory_bytes: 384
import static java.lang.System.*;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int card[][] = new int[14][5];
		for(int a = 1; a <= count; a++) {
			String mark = sc.next();
			int num = sc.nextInt();
			switch(mark) {
			case "S":
				card[num][1] = 1;
				break;
			case "H":
				card[num][2] = 1;
				break;
			case "C":
				card[num][3] = 1;
				break;
			case "D":
				card[num][4] = 1;
				break;
			}
		}
		for(int a = 1; a <= 4; a++) {
			for(int b = 1; b <= 13; b++) {
				if(card[b][a] != 1) {
					switch(a) {
					case 1:
						out.println("S " + b);
						break;
					case 2:
						out.println("H " + b);
						break;
					case 3:
						out.println("C " + b);
						break;
					case 4:
						out.println("D " + b);
						break;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 26344
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	auto result = 0;
	if (A >= 13)
	{
		result = B;
	}
	else if (A >= 6)
	{
		result = B / 2;
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);


int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int main() {
	ll n, k;
	cin >> n >> k;
	int ans = 0;
	while (n > 0) {
		n /= k;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = S.Length;
		int l = N / 2;
		int r = N / 2;
		if(N % 2 == 0) l--;
		int cnt = 0;
		while(l >= 0){
			if(S[l] != S[r]) cnt++;
			l--; r++;
		}
		Console.WriteLine(cnt);
		
		
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bn begin()
#define en end()
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007
#define pi 3.141592653589
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int a, b, c, k, cnt1 = 0, cnt2 = 0 ;
    cin >> a >> b >> c >> k ;
    while(b <= a) {
        cnt1++ ;
        b *= 2 ;
    }
    while(c <= b) {
        cnt2++ ;
        c *= 2 ;
    }
    if(cnt1+cnt2 <= k) cout << "Yes\n" ;
    else cout << "No\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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


Measured memory_bytes: 3604
#include <stdio.h>

int main(int argc, char const *argv[]) {
    int people[4][3][10] = {};

    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        int b, f, r, v;
        scanf("%d %d %d %d", &b, &f, &r, &v);
        people[b-1][f-1][r-1] += v;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                printf(" %d", people[i][j][k]);
            }
            printf("\n");
        }
        if (i != 3) {
            printf("####################\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2100
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	
	int n, T;
	cin >> n >>T;
	int c[105], t[105];
	for (int i = 0; i < n; i++) {
		cin >> c[i] >> t[i];
	}
	int ans = -1;
	for (int i = 0; i < n; i++) {
		if (t[i] <= T) {
			if (ans == -1) {
				ans = i;
			}
			else {
				if (c[ans] > c[i]) {
					ans = i;
				}
			}
		}
	}
	if (ans == -1) {
		cout << "TLE" << endl;
	}
	else {
		cout << c[ans] << endl;
	}
	return 0;
}

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


using namespace std;
int a[5020];
int n,k;
bool d[5020];
bool test(int idx){
    
    if(a[idx]>=k) return true;
    
    memset(d,false,sizeof(d));
    d[0]=true;
    for(int i=0;i<n;i++){
        
        if(i==idx) continue;
        
        for(int j = k-1;j>=0;j--){
            if(!d[j])continue;
            if(j+a[i]<=k) d[j+a[i]]=true;
        }
    }
    
    for(int i=k-a[idx];i<k;i++){
        if(d[i]) return true;
    }
    return false;
}

int main(){
    
    scanf("%d %d",&n,&k);
    
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    
    
    sort(a,a+n);
    
    int l = 0;
    int r = n-1;
    int ans = -1;
    
    /*
    for(int i=0;i<n;i++){
        printf("%d ",test(i));
    }printf("\n");
    */
    
    while(l<=r){
        
        int mid = (l+r)/2;
        
        if(test(mid)){
            r=mid-1;
          //  ans = max(ans,mid);
        }else{
            l=mid+1;
              ans = max(ans,mid);
        }
    }
    
    if(ans ==0) printf("1\n");
    else if(ans==-1) printf("0\n");
    else printf("%d\n",ans+1);
    
    
    return 0;
}


/*

*/

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN = 1000000;
char R[MAXN + 5], T[MAXN + 5];
int que1[MAXN + 5], que2[MAXN + 5], f[MAXN + 5], s, t;
int main() {
	int L; bool flag = true;
	scanf("%d%s%s", &L, R, T);
	for(int i=0;i<L;i++)
		if( R[i] != T[i] ) flag = false;
	if( flag ) {
		printf("%d\n", 0);
		return 0;
	}
	s = 1, t = 0;
	int ans = 0, j = L-1, del;
	for(int i=L-1;i>=0;) {
		while( j >= 0 && R[j] != T[i] )
			j--;
		if( j < 0 ) {
			puts("-1");
			return 0;
		}
		f[j] = i;
		while( s <= t && que1[s]-del > i ) s++;
		if( s > t ) {
			que1[++t] = j;
			que2[t] = 1;
			del = 0;
		}
		else {
			del++;
			if( que1[t] - 1 != j ) {
				que1[++t] = j+del;
				que2[t] = 1-del;
			}
		}
		ans = max(ans, que2[s]+del);
		while( i >= j && T[i] == R[j] )
			i--;
		j--;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 13824
import java.util.ArrayList;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var k = sc.nextInt();
		var p = IntStream.range(0, n).map(i -> sc.nextInt()).toArray();
		var c = IntStream.range(0, n).map(i -> sc.nextInt()).toArray();
		sc.close();

		var result = Long.MIN_VALUE;
		for (var i = 0; i < n; i++) {
			var list = new ArrayList<Long>();
			var cp = i;
			var cs = 0L;
			while (true) {
				cp = p[cp] - 1;
				cs += c[cp];
				list.add(cs);
				if (cp == i) {
					break;
				}
			}
			var len = k % list.size();
			if (len == 0) {
				len = list.size();
			}
			var max = Long.MIN_VALUE;
			for (var j = 0; j < len; j++) {
				max = Math.max(max, list.get(j));
			}
			if (list.get(list.size() - 1) >= 0 && k > list.size()) {
				max += (long) list.get(list.size() - 1) * ((k - 1) / list.size());
			}
			if (k > list.size()) {
				var max2 = Long.MIN_VALUE;
				for (var j = 0; j < list.size(); j++) {
					max2 = Math.max(max2, list.get(j));
				}
				max = Math.max(max, max2);
			}
			result = Math.max(result, max);
		}
		System.out.println(result);
	}
}


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

int main() {
    int N;
    int K;
    cin >> N >> K;
    int H[N];

    rep(i, N) cin >> H[i];

    sort(H, H+N, greater<int>());

    ll ans = 0;
    rep(i, N) {
        if (K > 0) {
            K--;
        }
        else {
            ans += H[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define erep(i, a, b) for (int i = a; i <= (int)(b); i++)
#define per(i, a, b) for (int i = (b)-1; i > (a); i--)
#define eper(i, a, b) for (int i = ((int)(a)); i >= b; i--)
#define pb push_back
#define mp make_pair
#define INF (1 << 30) - 1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int n, w[110], v[110], W, dp[110][11000];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> W;
  rep(i, 0, n) cin >> v[i] >> w[i];
  erep(i, 0, W) dp[0][i] = 0;
  rep(i, 0, n) {
    erep(j, 0, W) {
      if (j >= w[i])
        dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
      else
        dp[i + 1][j] = dp[i][j];
    }
  }
  printf("%d\n", dp[n][W]);
  return 0;
}


Measured memory_bytes: 7512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a;
	cin >> a;
	cout << 3 * a * a << endl;
}


Measured memory_bytes: 256
N,M,X=map(int,input().split())
ans=[]
c=[]
for _ in range(N):
    c.append(list(map(int, input().split())))
for i in range(pow(2,N)):
    d=[0]*(M+1)
    for j in range(N):
        if ((i >> j) & 1):
            for k in range(M+1):
                d[k]+=c[j][k]
    j=True
    for l in range(1,M+1):
        if d[l]<X:
            j=False
    if j:
        ans.append(d[0])
if len(ans)!=0:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 9312
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S,T;
int ans = 0;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int main() {
	cin >> H >> W >> N;
	cin >> R >> C;
	R--, C--;
	cin >> S >> T;
	
	int mx_r = W - 1, mx_l = 0, mx_u = 0, mx_d = H - 1;
	for (int i = N - 1; i >= 0; i--) {
		if (T[i] == 'L') {
			if (mx_r == W - 1) {
				0;
			}
			else {
				mx_r++;
			}
		}
		else if (T[i] == 'R') {
			if (mx_l == 0) {
				0;
			}
			else {
				mx_l--;
			}
		}
		else if (T[i] == 'U') {
			if (mx_d == H-1) {
				0;
			}
			else {
				mx_d++;
			}
		}
		else {
			if (mx_u == 0) {
				0;
			}
			else {
				mx_u--;
			}
		}
		if (S[i] == 'L') {
			mx_l++;
			if(mx_l>=W)break;
		}
		else if (S[i] == 'R') {
			mx_r--;
			if(mx_r<0)break;
		}
		else if (S[i] == 'U') {
			mx_u++;
			if(mx_u>=H)break;
		}
		else{
			mx_d--;
			if(mx_d<0)break;
		}
	}
	bool flag = 0;
	if (R >= mx_u && R <= mx_d && C >= mx_l && C <= mx_r) {
		flag = 1;
	}
	if (flag)cout << "YES" << endl;
	else cout << "NO" << endl;
}



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

class UnionFind {
  vector<int> parent, rank;
  
public:
  void init(int n) {
    for (int i = 0; i < n; i++) {
      parent.push_back(i);
      rank.push_back(0);
    }
  }
  
  void merge(int m, int n) {
    int x = find(m), y = find(n);
    if (rank.at(x) > rank.at(y)) {
      parent.at(y) = x;
    } else {
      parent.at(x) = y;
      if (rank.at(x) == rank.at(y)) rank.at(y)++;
    }
  }
  
  int find(int n) {
    if (parent.at(n) == n) return n;
    return parent.at(n) = find(parent.at(n));
  }
};

int main() {
  int n, k, l;
  cin >> n >> k >> l;
  UnionFind road, rail;
  road.init(n);
  rail.init(n);
  for (int i = 0; i < k; i++) {
    int p, q;
    cin >> p >> q;
    road.merge(p - 1, q - 1);
  }
  for (int i = 0; i < l; i++) {
    int r, s;
    cin >> r >> s;
    rail.merge(r - 1, s - 1);
  }
  map<pair<int, int>, int> connection;
  for (int i = 0; i < n; i++) {
    connection[make_pair(road.find(i), rail.find(i))]++;
  }
  for (int i = 0; i < n; i++) {
    cout << connection[make_pair(road.find(i), rail.find(i))];
    if (i == n - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	cout<<(n-1)/min({a,b,c,d,e})+5<<"\n"s;
}

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

int main() {

  int N;
  cin>>N;
  
  int Ai;
  int fm=0;
  for(int i=0;i<N;i++)
  {
    cin>>Ai;
    fm+=(Ai-1);
  }
  
  cout<<fm<<endl;
  
  return 0;
}


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

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        Console.WriteLine(a.Sum() - (long)n * (n + 1) / 2);
    }
}



Measured memory_bytes: 16256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    vector<ll> a(7,0);
    for(ll i=0;i<7;++i)cin>>a[i];
    ll ans=2*a[1];
    if((a[0]%2)+(a[3]%2)+(a[4]%2)>=2&&a[0]&&a[3]&&a[4]){
        ans+=6;
        a[0]--;a[3]--;a[4]--;
    }
    ans+=4*(a[0]/2)+4*(a[3]/2)+4*(a[4]/2);
    prt(ans/2)



    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
char a,b,c,d;
int main() 
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>a>>b>>c>>d;
	if(a=='Y' && b=='A' && c=='K' && d=='I')cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}  

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

#define RISI 1.05

int main(void)
{

        double debt = 100000;
        int i = 0;
        int n = 0;
        double kiriage = 0;
        int ans=0;

        scanf("%d",&n);

        for(i = 0; i < n; i++)
        {
                debt = debt * RISI;
                if((int)debt%1000 != 0)
                {
                        kiriage = debt / 1000;
                        kiriage = (int)kiriage*1000;
                        debt = kiriage + 1000;
                }

        }

        printf("%0.0f\n",debt);


        return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    
    sort(S.begin(), S.end());
    sort(T.begin(), T.end(), greater<char>());

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

    return 0;
    
}

Measured memory_bytes: 256
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
ll a[1009];
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>n>>k;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<k;i++)
        x+= a[i];
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 3600