akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
#include <cassert>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 1000 * 1000 + 47;
string s;
PII A[MAX];
PII B[MAX];
int sz;

bool cmp(const PII & a, const PII & b) {
    return min(a.first, a.second + b.first) > min(b.first, b.second + a.first);
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;   
    FOR(i, 0, n) {
        cin >> s;

        int bal = 0;
        int minbal = 0;
        FOR(j, 0, SZ(s)) {
            bal += s[j] == '(' ? 1 : -1;
            minbal = min(minbal, bal);
        }

        A[i] = MP(minbal, bal);
    }

    int bal = 0;
    FOR(i, 0, n) {
        if (A[i].first > 0) {
            bal += A[i].second;
            continue;
        }

        B[sz++] = A[i];
    }


    sort(B, B + sz, cmp);
    FOR(i, 0, sz) {
        if (bal + B[i].first < 0) {
            cout << "No" << endl;
            return 0;
        }

        bal += B[i].second;
    }

    if (bal == 0) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int A, P;
    cin >> A >> P;

    cout << ((A * 3) + P) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int h,w,i;
    char line[301];
    while(1){
        cin >> h >> w;
        if(!(h+w)) break;
        for(i=0;i<w;i++){
            line[i]='#';
        }
        line[i]=0;//end of C string
        for(i=0;i<h;i++){
            cout << line << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int x = 0, y = 0;
		
		if(X>=500){
			x = X/500;
			X -= 500*x;
        }
		if(X>=5){
			y = X/5;
			X -= 5*y;
        }

		System.out.println(1000*x+5*y);
	}
}


Measured memory_bytes: 35644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

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

using namespace std;

bool comp(int i, int j) {
    return i > j;
}

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

    vector<int> p(n);
    vector<int> q(n);

    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> q[i];
    }

    //cout << "---" << endl;

    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        v[i] = i+1;
    }

    int count = 1;
    int ans1;
    int ans2;

    sort(v.begin(), v.end());
    
    do {
        bool equal1 = p.size() == v.size() && std::equal(p.cbegin(), p.cend(), v.cbegin());
        bool equal2 = q.size() == v.size() && std::equal(q.cbegin(), q.cend(), v.cbegin());

        if (equal1 == true)
        {
            ans1 = count;
        }
        if (equal2 == true)
        {
            ans2 = count;
        }

        count++;
    }while( next_permutation(v.begin(), v.end()) );

    //cout << ans1 << endl;
    //cout << ans2 << endl;

    if (ans1 > ans2)
    {
        cout << ans1 - ans2 << endl;
    }
    else if (ans1 < ans2)
    {
        cout << ans2 - ans1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    
    
    

}


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

typedef long long ll;
typedef long double ld;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;

#define pub push_back
#define pob pop_back
#define mp make_pair
#define ff first
#define ss second
#define umap unordered_map
#define uset unordered_set

#define forn(i, n)     for(ll i = 0; i< (ll)n; i++)
#define forf(i, x, y)  for(ll i=(x); i<=(ll)y; i++)
#define forb(i, x, y)  for(ll i=(x); i>=(ll)y; i--)
#define lpt() 		   ll T; std::cin>>T; while(T--)

#define nl "\n"
#define newl std::cout<<"\n";
#define bug(x) std::cerr<<"debug "<<#x<<" : "<<x<<"\n";
#define all(x) x.begin(),x.end()
#define fastio() ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);

template<typename X> std::ostream& operator<< (std::ostream& out, std::vector<X> v)
{ for(auto &i : v) out<<i<<" "; return out; }
template<typename X, typename Y> std::ostream& operator<< (std::ostream& out, std::pair<X,Y> p)
{ out<<p.first<<" "<<p.second; return out; }

static const long long mod = 1000000007;

using namespace std;

ll n,k;
vll a(100005);
int dp[100005];

bool stones(ll val)
{
	if(val<0)
		return 1;
	
	if(dp[val]!=-1)
		return dp[val];

	int flag=0;
	forn(i,n)
	{
		flag= flag or !stones(val-a[i]);
	}

	return dp[val]=flag;
}

int main()
{fastio()
	
	cin>>n>>k;
	a.resize(n);
	forn(i,n)
		cin>>a[i];
	sort(all(a));
	memset(dp,-1,sizeof dp);
	forn(i,a[0])
		dp[i]=false;

	if(stones(k)==1)
		cout<<"First"<<nl;
	else
		cout<<"Second"<<nl;

return 0;}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #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); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	vector<vector<vector<int>>> vvvi(4, vector<vector<int>>(3, vector<int>(10, 0)));
	int n; cin >> n;
	REP(i, n) {
		int b, f, r, v; cin >> b >> f >> r >> v;
		--b, --f, --r;
		vvvi[b][f][r] += v;
	}
	REP(b, 4) {
		REP(f, 3) {
			REP(r, 10) {
				cout << " " << vvvi[b][f][r];
			}
			cout << endl;
		}
		if (b != 3) cout << "####################" << endl;
	}
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}



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

const int N=200100;
char S[N*2],*T;
int n,K;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>K>>(S+1);T=S+1;
	int tag=0;
	for(;K --> 0;){
		if((T[0]^tag)=='A')T[0]^=3;
		else{
			tag^=3;T[n]='A'^tag;
			++T;
		}
		if(T>S+n){
			if((T[0]^tag)=='A'&&(K&1))T[0]^=3;
			break;
		}
	}
	for(int i=0;i<n;++i)T[i]^=tag;
	cout<<T<<'\n';
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    for(int i=a;i<=b;i++){
        string s = to_string(i);
        bool flag = 1;
        rep(i,2){
            if(s[i]!=s[4-i]){
                flag = 0;
            }
        }
        if(flag)ans++;
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 256
import java.util.*;

import java.io.*;

public class Main {

	static int n;
	static long memo[][];
	static int p;
	static int pl[][];
	static pair[] a;
	static int k;

	public static long dp(int msk, int idx) {
		if (idx == n)
			return 0;
		if (memo[msk][idx] != -1)
			return memo[msk][idx];
		long max = k - (idx - Integer.bitCount(msk)) > 0 ? dp(msk, idx + 1) + a[idx].x : dp(msk, idx + 1);

		for (int i = 0; i < p; i++) {
			if (((msk >> i) & 1) == 0) {
				max = Math.max(max, pl[a[idx].y][i] + dp(msk | 1 << i, idx + 1));
			}
		}
		return memo[msk][idx] = max;

	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		long n=Long.parseLong(st.nextToken());
		long a=Long.parseLong(st.nextToken());
		long b=Long.parseLong(st.nextToken());
		long g=n/(a+b);
		long x=n%(a+b);
		System.out.println(g*a+Math.min(a,x));		
	}
	

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

	static class pair {
		int x;
		int y;

		pair(int r, int t) {
			x = r;
			y = t;
		}

		public String toString() {
			return "(" + x + "," + y + ")";
		}

	}
}

Measured memory_bytes: 22996
//0507-Square
#include <bits/stdc++.h>
using namespace std;
vector<int> num;
void dfs(int left,int prev){
	if(left==0){
		for(int i=0;i<(int)num.size();i++){
			if(i)	cout<<" ";
			cout<<num[i];
		}
		cout<<endl;
		return;
	}
	for(int i=min(prev,left);i>0;i--){
		num.push_back(i);
		dfs(left-i,i);
		num.erase(num.end()-1);
	}
	return;
}

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)	return 0;
		dfs(n,n);
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(n) for(int i = 0; i < n; i++)

using namespace std;

int main(void)
{
  int N;
  int si;
  int remain = 0;
  int remain2;
  int ans = 0;

  cin >> N;

  vector<int> n;

  rep(N)
  {
    cin >> si;
    if((si % 10) == 0)
      ans += si;
    else
    {
      remain += si;
      n.push_back(si);
    }
  }

  if((remain % 10) != 0)
  {
    cout << ans + remain << endl;
    return 0;
  }

  if((remain2 = (int)n.size()) == 0)
  {
    cout << 0 << endl;
    return 0;
  }

  cout << ans + remain - *min_element(n.begin(), n.end());

  return 0;
}


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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    string S;
    cin >> S;
    
    reverse(S.begin(), S.end());
    for(int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
    
    bool can = true;
    for(int i = 0; i < S.size();) {
        bool can2 = false;
        
        for(int j = 0; j < 4; ++j) {
            string d = divide[j];
            if(S.substr(i, d.size()) == d) {
                can2 = true;
                i += d.size();
            }
        }
        if(!can2) {
            can = false;
            break;
        }
    }
    
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 1e3 + 5;

int n,m,sx,sy,ex,ey;
int vis[N][N];
char a[N][N];

struct node{
	int x,y,z;
	bool operator <(const node &T) const{
		return z>T.z;
	}
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n>>m>>sx>>sy>>ex>>ey;
    for(int i=1;i<=n;i++) cin>>a[i]+1;
    priority_queue<node> q;
    memset(vis,-1,sizeof(vis));
    vis[sx][sy]=0;
    q.push({sx,sy,0});
    while(q.size()){
    	node t=q.top();q.pop();
    	if(t.z>=vis[ex][ey] and vis[ex][ey]!=-1) break;
    	int x=t.x,y=t.y,z=t.z;
    	for(int i=-2;i<=2;i++){
    		for(int j=-2;j<=2;j++){
    			int tx=x+i;
    			int ty=y+j;
    			int tz=z;
	    		if(abs(tx-x)+abs(ty-y)>1) tz++;
    			if(tx>=1 and tx<=n and ty>=1 and ty<=m and a[tx][ty]=='.' and (vis[tx][ty]==-1 || tz<vis[tx][ty])){
	    			vis[tx][ty]=tz;
	    			q.push({tx,ty,tz});
	    		}
    		}
    	}
    }
    cout<<vis[ex][ey]<<'\n';
    return 0;
}

Measured memory_bytes: 8648
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
ans = inf
for i in reversed(range(1, int(sqrt(n)) + 1)):
    if n % i == 0:
        ans = min(ans, i + n // i - 2)
print(ans)

Measured memory_bytes: 61800
#include <iostream>

int main(){
  using namespace std;
  int n;
  int vec[4][3][10] = {{{}}};
  cin >> n;
  int b,f,r,v;
  for(int i{0}; i<n; i++){
    cin >> b >> f >> r >> v;
    vec[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++){
	cout << " " << vec[i][j][k];
    }
    cout << endl;
    }
    if(i<3) {cout << "####################" << endl;}
  }
  return 0;
}



Measured memory_bytes: 3120
from bisect import bisect_left
from sys import stdin
input = stdin.buffer.readline

def main():
    a, b, q = map(int, input().split())
    s = [int(input()) for _ in range(a)]
    t = [int(input()) for _ in range(b)]
    x = [int(input()) for _ in range(q)]

    ans = [0] * q
    for i in range(q):
        start = x[i]
        si = bisect_left(s, start, hi=a-1)
        ti = bisect_left(t, start, hi=b-1)

        sl = (s[si-1], s[si])
        tl = (t[ti-1], t[ti])

        distance = 100000000000
        for j in sl:
            for k in tl:
                if abs(start - j) + abs(j - k) < distance:
                    distance = abs(start - j) + abs(j - k)
                if abs(start - k) + abs(k - j) < distance:
                    distance = abs(start - k) + abs(k - j)

        ans[i] = distance

    for i in ans:
        print(i)

main()

Measured memory_bytes: 81944
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void push(int);
int pop();

int top;
int dat[10000];

int main() {
  int x,y;
  char data[100];

  while(scanf("%s",data) != EOF) {
    if(data[0] == '+') {
      x = pop();
      y = pop();
      push(x + y);
    }else if(data[0] == '-') {
      y = pop();
      x = pop();
      push(x - y);
    }else if(data[0] == '*') {
      x = pop();
      y = pop();
      push(x * y);
    }else{
      push(atoi(data));
    }
  }

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

void push(int x) {
  dat[++top] = x;
}

int pop() {
  top--;
  return dat[top + 1];
}

  
    
    
      
      
  




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

int main() {
    string S;
    string T;
    cin >> S;
    cin >> T;
    map<char, int> smap;
    map<char, int> tmap;
    map<char, int>::iterator it;
    bool result = true;
    if (S.size() != T.size()) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < S.size(); i++) {
        char s = S[i];
        it = smap.find(s);
        if (it == smap.end()) {
            smap[s] = i;
        } else {
            int j = smap[s];
            if (T[i] != T[j]) {
                result = false;
            }
        }
    }

    for (int i = 0; i < T.size(); i++) {
            char t = T[i];
            it = tmap.find(t);
            if (it == tmap.end()) {
                tmap[t] = i;
            } else {
                int j = tmap[t];
                if (S[i] != S[j]) {
                    result = false;
                }
            }
        }

    if (result) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
	return 0;
}


Measured memory_bytes: 776
/*---> 10 February 2020 <--- > 19:35:09 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	int n;
	cin>>n;
	int x;
	map<int,int> mp;
	for(int i=0;i<n;i++){
		cin>>x;
		if(mp.find(x)!=mp.end())
			return cout<<"NO\n",0;
		mp[x]++;
	}
	cout<<"YES\n";
return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i, 0, n) cin >> v[i];
    int ans = 0;
    for(int l = 0; l <= n; l++){
        for(int r = 0; r <= n; r++){
            if(l + r > n) continue;
            for(int x = 0; x <= n; x++){
                if(l + r + x > k) continue;
                vector<int> t;
                for(int i = 0; i < l; i++) t.push_back(v[i]);
                for(int i = 0; i < r; i++) t.push_back(v[n - 1 - i]);
                sort(t.begin(), t.end());
                int tmp = 0;
                for(int i = x; i < t.size(); i++) tmp += t[i];
                ans = max(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def main():
  n, k = map(int, input().split())
  hs = [int(input()) for _ in range(n)]
  hs.sort()
  _min = hs[-1]
  for i in range(n-k+1):
    kouho = hs[i+k-1] - hs[i]
    if kouho < _min:
      _min = kouho
  print(_min)
  pass

if __name__=='__main__':
  main()

Measured memory_bytes: 7384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int a = Integer.parseInt(in.next());
            int b = Integer.parseInt(in.next());
            int c = Integer.parseInt(in.next());
            boolean ok = false;
            if ((a <= c && c <= b) || (b <= c && c <= a)) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
}



Measured memory_bytes: 21844
import java.util.*;

public class Main 
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		String n = scan.next();
		
		if (n.contains("9"))
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
		
		
		scan.close();
	}
}


Measured memory_bytes: 22740
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <fstream>

using namespace std;

template<class T> inline T cabs(const T &x) { return x > 0 ? x : (-x); }
template<class T> inline T gcd(const T &x, const T &y) { return (y == 0) ? x : gcd(y, x % y); }
template<class T> inline T _sgn(const T &x) { return (x > 0) - (x < 0); }

#define dbg(x) cout << #x << " = " << (x) << endl
#define dbg2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define dbg3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl
#define dbg4(x,y,z,w) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #w << " = " << w << endl

#define out(x) cout << (x) << endl
#define out2(x,y) cout << (x) << " " << (y) << endl
#define out3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define out4(x,y,z,w) cout << (x) << " " << (y) << " " << (z) << " " << (w) << endl

int run(int a, int b, int c) {
    return (a + b == c) || (cabs(a - b) == c);
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    printf("%s\n", run(a, b, c) ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
#define answer(p) printf("Case #%lld:\n",(p)+1);
// #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],dp[1001][1001];
int field[200][200];

int main(){
  cin >> n >> m;
  print(n+m/2);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;

int main(){
	int n;
	cin >> n;
	if(n%10==n/100)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a:u64, b:u64) -> u64 {
    if b==0 {
        a
    } else {
        gcd(b, a%b)
    }
}
fn lcm(a:u64, b:u64) -> u64 {
    a / gcd(a, b) * b
}
pub fn divisor(n: u64) -> Vec<u64> {
  let mut res = Vec::new();
  for i in (1..).take_while(|x| x * x <= n) {
    if n % i == 0 {
      res.push(i);
      if i != n / i {
        res.push(n / i);
      }
    }
  }
  res
}
use std::collections::HashSet;
fn main() {
    input!{
        n:usize,
        mut a:[u64;n]
    }
    let mut ans:i64=-1;
    if n==2 {
        ans=std::cmp::max(a[0] as i64, a[1] as i64);
    }else{
        a.sort();
        let ab=gcd(a[0], a[1]);
        let bc=gcd(a[1], a[2]);
        let ca=gcd(a[2], a[0]);
        let mut v1:Vec<u64> = divisor(ab);
        let mut v2:Vec<u64> = divisor(bc);
        let mut v3:Vec<u64> = divisor(ca);
        
        v1.append(&mut v2);
        v1.append(&mut v3);
        // println!("{:?}", v1);
        let mut prob:HashSet<u64> = v1.into_iter().collect();
        // println!("{:?}", prob);
        let mut note=1;
        for factor in prob {
            // println!("{}", i);\
            let mut penal=0;
            for i in 0..n {
                if a[i]%factor!=0 {
                    penal+=1;
                }
            }
            if penal<=1 {
                ans=std::cmp::max(ans, factor as i64);
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
    int num_a,num_b,num_c;

    scanf("%d %d %d",&num_a,&num_b,&num_c);

    if(num_a<num_b && num_b<num_c){
        printf("Yes");
    }else{
        printf("No");
    }
    printf("\n");
    return (0);
}

Measured memory_bytes: 1740
import itertools
N=int(input())
A=list(map(int, input().split()))
ans=0
for any_pair in itertools.combinations(A, 3):
    pair=sorted(any_pair)
    #print(type(pair))
    if pair[0]+pair[1]>pair[2] and pair[1]+pair[2]>pair[0] and pair[0]+pair[2]>pair[1] and pair[0]!=pair[1] and pair[1]!=pair[2]:
        ans+=1
        #print(pair)
print(ans)

Measured memory_bytes: 9220
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <map>
#define Z class
#define ln cout<<'\n'
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

int main(){
    long X,A,B; cin >> X >> A >> B;
    string res;
    if(A>=B) res = "delicious";
    else if(B-A<=X) res = "safe";
    else res = "dangerous";
    pr(res);
}



Measured memory_bytes: 256
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

D, G = map(int, input().split())
p = [0]*(D+1)
c = [0]*(D+1)
for i in range(1, D+1):
    p[i], c[i] = map(int, input().split())


#
ans = int(1e18)
for pat in range(1<<D):
    score = G
    res = 0
    for i in range(1, D+1):
        if pat & (1<<(i-1)) > 0:
            res += p[i]
            score -= i * p[i] * 100 + c[i]
    
    for i in reversed(range(1, D+1)):
        if score <= 0:
            ans = min(ans, res)
            break
        if pat & (1<<(i-1)) == 0:
            now = (score + (i * 100) - 1) // (i * 100)
            if now <= p[i]:
                res += now
                ans = min(ans, res)
                break
            else:
                res += p[i]
                score -= i*100 * p[i]
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using ll = long long;

using namespace std;

int main(){
	ll n;
	cin >> n;
	ll sum = 0;
	ll mx = 0;
	
	vector<int> table(n+1,0);
	for(ll i = 1; i <= n; i++){
		sum += i;
		table[i] = 1;
		if(sum >= n){
			mx = i;
			break;
		}
	}
	
	ll i = 1;
	ll j = 1;
	while(sum != n){
		if(sum > n){
			j = 1;
			table[i] = 0;
			sum -= i;
			i++;
		}
		if(sum < n){
			i = 1;
			table[j] = 1;
			sum += j;
			j++;
		}
	}
	
	ll now = 0;
	for(int i = 1; i <= mx; i++){
		if(table[i] == 1){
			cout << i << endl;
		}
		now += table[i];
	}
	
	return 0;
}
 

Measured memory_bytes: 42256
n = int(input())
s = []
c = 0
for _ in range(n):
    a, b = map(int, input().split())
    s.append([b, a])
s.sort()
for i in range(n):
    c += s[i][1]
    if c > s[i][0]:
        c = -1
        break
if c != -1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 35608
#include<stdio.h>

int main(void){

int m,n,x,i;
scanf("%d%d%d",&n,&m,&x);

int cost[m];
for(i = 0; i < m; i++) scanf("%d",&cost[i]);

i = -1;
while( i < m){
i++;
if(x < cost[i]) break;
}

if((m - i )*2< m) printf("%d",m-i);
else  printf("%d",i);

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto i : x){cerr << " [" << i << "]";} cerr << "\n";
using namespace std;
using ll = long long;
const double PI = acos(-1);
const int mod = 998244353;
const int inf = 1e9 + 100;
const ll inf64 = 1e18 + 100;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	double n, d;
	cin >> n >> d;
	cout << (int)ceil(n / (2 * d + 1)) << '\n';
	return 0;
}
 


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

using namespace std;

// Author: Mubashir Ahmad
// Github : @hakerbaya

int main(){
	int n; cin >> n;
  	vector<pair<string,int>> vc;
  	for(int i=0;i<n;i++){
    	string s; cin >> s;
      	int tim; cin >> tim;
      	vc.push_back(make_pair(s,tim));
      }
  	string s; cin >> s;
  	int j;
  	int total = 0;
  	for(int i=0;i<n;i++){
      if(vc[i].first == s){
      	j = i;
      }
    }
  for(int i=j+1;i<n;i++){
      total+=vc[i].second;
    }
  
  if(vc.size() == 1){
  	cout << "0";
  } else{
  	cout << total;
  }
  
  
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define pub push_back
#define pob pop_back
#define mp make_pair

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie();
	
	string s;
	cin >> s;
	for (ll i = 0; i < s.length() - 1; i++) {
		if (s[i] == s[i+1]) {
			cout << i + 1 << ' ' << i + 2;
			return 0;
		}
	}
	for (ll i = 0; i < s.length() - 2; i++) {
		if (s[i] == s[i+2]) {
			cout << i + 1 << ' ' << i + 3;
			return 0;
		}
	}
	cout << -1 << ' ' << -1;
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	double A, B, H, M;
	cin >> A >> B >> H >> M;

	auto pi = acos(-1);
	auto ta = 2 * pi * (H / 12 + M / 60 / 12);
	auto tb = 2 * pi * M / 60;
	auto ax = A * cos(pi / 2 - ta);
	auto ay = A * sin(pi / 2 - ta);
	auto bx = B * cos(pi / 2 - tb);
	auto by = B * sin(pi / 2 - tb);

	auto diffX = ax - bx;
	auto diffY = ay - by;

	cout << fixed << setprecision(13) <<  sqrt(diffX * diffX + diffY * diffY) << endl;

	return 0;
}

Measured memory_bytes: 4132
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,h[200005],val[200005];
map<int,ll> cnt;
ll ans=0;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>h[i],val[i]=i+h[i];
	for(int i=n; i>=1; i--) {
		ans+=cnt[val[i]];
		if(i-h[i]<=0) continue;
		cnt[i-h[i]]++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 18976
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=0;
    for(int i=0;i<3;i++){
        if(s[i]=='o'){
            n++;
        }
    }
    cout << 700+n*100<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	vector<int> a(n),f(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>f[i];
	}
	sort( a.begin(), a.end() );
	sort( f.begin(), f.end() );
	reverse( a.begin(), a.end() );
	int ok = 10000000000009, ng = -1;
	while( ok - ng > 1 ){
		int mid = ( ok + ng ) / 2;
		int tms = 0;
		for(int i=0;i<n;i++){
			int cur = mid / f[i];
			tms += max( 0LL, a[i]-cur );
		}
		if( tms <= k ){
			ok = mid;
		}
		else{
			ng = mid;
		}
	}
	cout<<ok<<endl;
	return 0;
}

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

#define vs vector<string>
#define ll long long int

int main() {

    int N;
    cin >> N;

    vs S;
    string s;
    for (int i = 0; i < N; i++) {
        cin >> s;
        sort(s.begin(), s.end());
        S.push_back(s);
    }
    S.push_back("zzzzzzzzzzzzzzzzzzzzzzz");

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

    ll count = 0;
    ll ang = 1;

    for (int i = 0; i < N; i++) {
        if (S[i] == S[i+1]) {
            ang++;
        }
        else {
            count += (ang * (ang - 1) / 2);
            ang = 1;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 5748
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val sList = readLine()?.toCharArray() ?: return

    // 西から東方向へ見ていったときの、各項のE,Wの累積Listを作る
    val wToEList = mutableListOf<Pair<Int, Int>>().apply {
        if (sList[0] == 'E') {
            add(1 to 0)
        } else {
            add(0 to 1)
        }
        for (i in 1 until n) {
            if (sList[i] == 'E') {
                val pre = this[i - 1]
                add(pre.first + 1 to pre.second)
            } else {
                val pre = this[i - 1]
                add(pre.first to pre.second + 1)
            }
        }
    }

    // 作った累積配列を使って貪欲に試行する
    // 任意のSiをリーダーとしたとき、
    //   リーダーより西側にいるWをEに(a)
    //   リーダーより東側にいるEをWに(b)する必要がある
    // この人数はそれぞれ(a)は wToEList[i - 1].second で、
    // (b)は wToEList[n - 1].first - wToEList[i].first となり
    // (a) + (b)の最小値を求めればよい

    var result = Int.MAX_VALUE

    for (i in 0 until n) {
        val a = if (i == 0) 0 else wToEList[i - 1].second
        val b = wToEList[n - 1].first - wToEList[i].first
        val count = a + b
        if (count < result) {
            result = count
        }
    }

    println(result)
}

Measured memory_bytes: 50512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main()
{
    int d, n;
    scanf("%d%d", &d, &n);
    if (n == 100) n++;
    int ans = pow(100, d)*n;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#ifdef Rahul
#include "RAHUL.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

#include "atcoder/lazysegtree"
#include "atcoder/modint"
using namespace atcoder;

using Mod = modint998244353;

struct Info {
  int sz;
  Mod ans;
  Info() : sz(0), ans(0) {}
};

Info Mix(Info x, Info y) {
  Info z;
  z.sz = x.sz + y.sz;
  z.ans = x.ans * Mod(10).pow(y.sz) + y.ans;
  return z;
}

Info Id() {
  return Info{};
}

struct Lazy {
  Mod val;
  Lazy(int x) : val(x) {}
};

Lazy Compose(Lazy from, Lazy to) {
  if (from.val.val() == 0) return to;
  return from;
}

const Mod kInv9 = 1 / Mod(9);
Info Map(Lazy l, Info x) {
  if (l.val.val() > 0) x.ans = l.val * (Mod(10).pow(x.sz) - 1) * kInv9;
  return x;
}
Lazy LazyId() {
  return Lazy{0};
}
int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int n, q; cin >> n >> q;
  vector<Info> a(n);
  for (auto& e : a) e.sz = 1, e.ans = 1;
  lazy_segtree<Info, Mix, Id, Lazy, Map, Compose, LazyId> seg(a);
  while (q--) {
    int l, r, d; cin >> l >> r >> d;
    --l;
    seg.apply(l, r, Lazy{d});
    cout << seg.prod(0, n).ans.val() << '\n';
  }
  
}


Measured memory_bytes: 10128
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back 
 
using LL = long long int;
using VL = vector<LL>;
using VI = vector<int>;
using VVL = vector<VL>;
using PLL = pair<LL,LL>;
using PII = pair<int ,int>;
 
#ifdef DEBUG
void _print()
{
  cout << endl;
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
  cout << first_elem << " ";
  _print(args...);
}
#else
void _print()
{
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
}
#endif
 
 
// NOTE: Please dont implement _print() as function in your program. It is reserved
// for debug purpose.

int main()
{
    ios::sync_with_stdio(false);
    LL t = 1;
    while (t--) {
        string s;
        cin >> s;
        if (s[0] - 'A' <= 26) {
            cout << "A" << endl;
        } else {
            cout << "a" << endl;
        }

    }
    return 0;
    
}

Measured memory_bytes: 3604
import numpy as np
n=int(input())
ABC=[list(map(int,input().split())) for _ in range(n)]

dp=np.zeros((n,3),int)
for i in range(3):
  dp[0,i]=ABC[0][i]
for i in range(1,n):
  for j in range(3):
    dp[i,j]=max(dp[i-1,(j+1)%3]+ABC[i][j],dp[i-1,(j+2)%3]+ABC[i][j])
print(max(dp[-1]))

Measured memory_bytes: 43596
#pragma GCC optimize ("O3")
///#include<bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;



/// Info.
///****************************************************************************************************************************************///
/// Coder               : BAHAA El_DEEN OSAMA SAYED.
/// Problem name        : D - I miss you...
/// Method              : IM-string
/// Date                : 23/2/2020
///****************************************************************************************************************************************///


#define rep0(i,x)         for(int i=0; i<=x ;++i)
#define all(v)           ((v.begin()),((v.end())
#define mm(v,d)          memset(v,d,sizeof(v))
#define lp(i,v)          for(int i=0;i<sizeof(v);++i)
#define lpi(i,j,n)       for(int i=(j);i>=(int)n;++i)
#define lpd(i,j,n)       for(int i=(j);i>=(int)n;--i)
#define MP               make_pair
#define SZ(v)            ((int) ( (v).size() ) )
#define ull              unsigned long long
#define ll               long long
#define pi               3.1415926536
#define oo               1e9
#define OO               1e18
#define Fx(n)            fixed<<setprecision(n)
#define FasterIO           std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define RE0              return 0
#define RE1              return 1
#define mp(a,b)          make_pair(a,b)
#define X                first
#define Y                second
#define pii              pair(int a, int b)
#define rep1(i,x)        for(int i=1;i<x;++i)
#define rep2(i,x)        for(int i=2;i<x;++i)
#define RE               return
//#define LD               long double
#define all(v) ((v).begin()),((v).end())


const  int  N   = (int) 1e5+100;
const  int  M   = (int) 1e4+4;
const  int  INF = (int) 0x3f3f3f3f;
///const double ESP = 1e-7;
///const ll MOD=1e8+9;


string str;

int main()
{
FasterIO;

cin>>str;

rep0(i,str.size())
{
    if(str[i]!='x')
        str[i]= 'x';
}
cout << str;


 RE0;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ps puts("")
#define fi first
#define nd second
#define mset(x) memset((x), 0, sizeof (x))
#define mk make_pair
#define sqr(x) ((x)*(x))
#define pii pair<int,int>
#define lch (o<<1)
#define rch (o<<1|1)
using namespace std;
typedef long long ll;
ll read() {ll x = 0;char f = 1, ch = getchar();while(ch < '0' || ch > '9') {if(ch == '-')f = -1;
ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';ch = getchar();}return x * f;}
void write(ll x) {if(x < 0) x = -x, putchar('-');if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
const int N = 600000;

ll a, b;
int main() {
	a = read(), b = read();
	for(int i = 1;  i<= 3; ++i)
		if(a * b * i % 2 == 1) {
			puts("Yes");
			return 0;
		}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k,n;
    cin>>n>>k;
    ll arr[n];
    REP(i,n){
        cin>>arr[i];
    }
    ll sum=0;
    sort(arr,arr+n);
    REP(i,k){
        sum+=arr[i];
    }
    cout<<sum<<endl;
}


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

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x>=r&&x<=W-r&&y>=0&&y<=H-r){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3116
#include<iostream>

using namespace std;


static const int MAX = 100;
static const int inf = (1 << 21);
static const int white = 0;
static const int gray = 1;
static const int black = 2;

int n, m[MAX][MAX];



int prim() {

	int u, minv;
	int d[MAX], p[MAX], color[MAX];

	for (int i = 0; i < n; i++)
	{
		d[i] = inf;
		p[i] = -1;
		color[i] = white;
	}

	d[0] = 0;

	while (1)
	{
		minv = inf;
		u = -1;

		for (int i = 0; i < n; i++) {
			if (minv > d[i] && color[i] != black) {
				u = i;
				minv = d[i];
			}
		}

		if (u == -1) break;
		color[u] = black;
		for (int v = 0; v < n; v++) {
			if (color[v] != black && m[u][v] != inf) {
				if (d[v] > m[u][v]) {
					d[v] = m[u][v];
					p[v] = u;
					color[v] = gray;
				}
			}
		}
	}

	int sum = 0;
	for (int i = 0; i < n; i++) {
		if (p[i] != -1) sum += m[i][p[i]];
	}

	return sum;
}


int main() {


	int s;

	cin >> n;

	for (int i = 0;i < n;i++) {
		for (int k = 0; k < n; k++)
		{
			cin >> s;
			m[i][k] = (s == -1) ? inf : s;
		}
	}


	cout << prim() << endl;

	return 0;
}







Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
#define frp(i,n) for((i)=0;(i)<(n);i++)
int vx[4]={0,1,0,-1};
int vy[4]={1,0,-1,0};
int H,W;
int check(int n1,int n2,int rednum,vector<int> red1,vector<int> red2){
  for(int i=0;i<rednum;i++){
    if(n1==red1[i]&&n2==red2[i]||n1<0||n2<0||n1>=H||n2>=W){
      return 0;
    }
  }
  return 1;
}
int main(){
  int i,j,now1,now2;
  while(cin>>W>>H,W+H!=0){
    int num=1;
    string str2;
    vector<string> str;
    vector<int> red1;
    vector<int> red2;
    frp(i,H){
      cin>>str2;
      str.push_back(str2);
    }
    frp(i,H){
      frp(j,W){
	if(str[i][j]=='#'){
	  red1.push_back(i);
	  red2.push_back(j);
	}
      }
    }
    queue<pair<int,int> > qii;
    frp(i,H){
      frp(j,W){
	if(str[i][j]=='@'){
	  qii.push(make_pair(i,j));
	  red1.push_back(i);
	  red2.push_back(j);
	}
      }
    }
    while(!qii.empty()){
      now1=qii.front().first;
      now2=qii.front().second;
      qii.pop();
      for(i=0;i<4;i++){
	if(check(now1+vx[i],now2+vy[i],red1.size(),red1,red2)==1){
	  red1.push_back(now1+vx[i]);
	  red2.push_back(now2+vy[i]);
	  qii.push(make_pair(now1+vx[i],now2+vy[i]));
	  num++;
	}
      }
    }
    cout<<num<<endl;
  }
  return 0;
}
      

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

using namespace std;

const int N = 3010;
const int P = 998244353;

int mult(int a, int b) {
    return a * 1ll * b % P;
}
void add(int &a, int b) {
    a += b;
    if(a >= P) a -= P;
}
void sub(int &a, int b) {
    a -= b;
    if(a < 0) a += P;
}

int dp[N][N];

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (int i = a; i <= c; ++i) {
        for (int j = b; j <= d; ++j) {
            add(dp[i][j], mult(j, dp[i-1][j]));
            add(dp[i][j], mult(i, dp[i][j-1]));
            sub(dp[i][j], mult(mult(i - 1, j - 1), dp[i-1][j-1]));

        }
    }
    printf("%d\n", dp[c][d]);
}

Measured memory_bytes: 38896