akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b;
  
  if ( a == 1 && b == 1){
    c = 400000;
  }
  else{
    c =0;
  }
  if (a < 4){
    a = (4-a)*100000;
  }
  else{
    a = 0;
  }
  
  if (b < 4){
    b = (4-b)*100000;
  }
  else{
    b = 0;
  }
  cout <<  a + b + c << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		// Scanner scanner = new Scanner("3 5 4 2 0 0 8 8");
		Scanner scanner = new Scanner(System.in);
		int h;
		int w;
		while (true) {
			h = scanner.nextInt();
			w = scanner.nextInt();
			if (h == 0 && w == 0) {
				break;
			}
			lineMaker01(w);
			for (int j = 0; j < h - 2; j++) {
				lineMaker02(w);
			}
			lineMaker01(w);
			System.out.println("");
		}
		//System.out.println("");
	}

	static void lineMaker01(int w) {
		for (int i = 0; i < w; i++) {
			System.out.print("#");
		}
		System.out.println("");
	}

	static void lineMaker02(int w) {
		System.out.print("#");
		for (int i = 0; i < w - 2; i++) {
			System.out.print(".");
		}
		System.out.print("#");
		System.out.println("");
	}
}

Measured memory_bytes: 32988
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD 1000000007



void solve()
{
  int N;
  cin>>N;
  vector<int> vec(N,0);
  vector<int> vec_A(N,0);
  int ACC_A=0;
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
    ACC_A += vec[i];
    vec_A[i] = ACC_A;
  }
 
  int acc = accumulate(vec.begin(),vec.end(),0);
 
  int half = acc/2;

  int sum = 0;
  int sum2 = 0;
  int half_p;
  int MIN = I64_MAX;

  int len_L = vec[0], len_R = vec[N-1];
  int l = 1, r = N -2;

  while(l <= r)
  {
    if(len_L > len_R)
    {
      len_R += vec[r];
      r--;
    }
    else
    {
      len_L += vec[l];
      l++;
    }
    
  }

  cout<<abs(len_R - len_L);
 
  // cout<<half_p<<endl;
}
int32_t main(int32_t argc, const char *argv[])
{
 
  solve();
 
  return 0;
}

Measured memory_bytes: 3328
import copy

class Card():
    def __init__(self, suit, value):
        self.suit = suit
        self.value = value

'''
def insertionsort(a,n,g):
    for i in range(g,n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return a
'''

def shellsort(a,n):
    cnt = 0
    def insertionsort(a,n,g,cnt):
        for i in range(g,n):
            v = a[i]
            j = i-g
            while j>= 0 and a[j] > v:
                a[j+g] = a[j]
                j = j-g
                cnt += 1
            a[j+g] = v
        return a, cnt

    g = [1]
    while g[-1]*3 + 1 < n:
        g.append(g[-1]*3+1)
    g = g[::-1]
    for i,x in enumerate(g):
        a, cnt = insertionsort(a,n,x,cnt)
    return a, len(g), g, cnt


def bubblesort(n,a):
    flag = 1
    while flag:
        flag = False
        for i in reversed(range(1,n)):
            if a[i-1].value > a[i].value:
                a[i], a[i-1] = a[i-1], a[i]
                flag = True
    return a

def selectionsort(n,a):
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j].value < a[minj].value:
                minj = j
        a[i], a[minj] = a[minj], a[i]
    return a

def is_stable(before, after):
    n = 9
    lb = [[] for _ in range(n)]
    la = [[] for _ in range(n)]
    for i in range(len(before)):
        lb[before[i].value-1].append(before[i].suit)
        la[after[i].value-1].append(after[i].suit)
    if la == lb:
        print('Stable')
    else:
        print('Not stable')


if __name__ == '__main__':
    n = int(input())
    a = [int(input()) for _ in range(n)]
    a, m, g, cnt = shellsort(a,n)
    print(m)
    print(' '.join(map(str, g)))
    print(cnt)
    for x in a:
        print(x)

    








Measured memory_bytes: 46044
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, Y;
  cin >> N >> Y;
  Y /= 1000;
  int k;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; i + j <= N; j++) {
      k = N - i - j;
      if (N < i + j + k) continue;
      if (10 * i + 5 * j + k == Y) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}

Measured memory_bytes: 3656
def inpl(): return [int(i) for i in input().split()]
from collections import defaultdict
import sys
def edge(S):
    e = defaultdict(lambda: set())
    for i in range(N+1):
        for j in S:
            e[i].add(i%j)
        e[i] = e[i] | {i}
    return e
def path(edge):
    p = defaultdict(lambda: set())
    for st in range(N+1):
        Q, p[st], new = [edge[st]]*3
        while Q:
            for j in Q:
                new = new | edge[j]
            Q = new - p[st]
            p[st] = p[st] | new
    return p

K = int(input())
A = inpl()
B = inpl()
for i in range(K):
    if A[i] < B[i]:
        print(-1)
        sys.exit()
if A == B:
    print(0)
    sys.exit()
N = max(A) 
T = []
for l in range(N,-1,-1):
    S = T + list(range(1,1+l))
    Pa = path(edge(S))
    for i in range(K):
        if B[i] not in Pa[A[i]]:
            break
    else:
        continue
    T.append(l+1)
if not T:
    print(2)
    sys.exit()
if N+1 in T:
    print(-1)
    sys.exit()
print(sum([2**i for i in T]))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
#define enl << endl
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int res[100010];
    res[2] = 1;

    reps(i, 3, 100000){
        res[i] = 0;
        if(i%2 == 0) continue;
        bool flg = true;
        reps(j, 1, sqrt(i)){
            if(i%j == 0 && j!=1){
                flg = false;
                break;
            }
        }
        if(flg){
            res[i] = 1;
        }
    }

    vector<int> v;
    reps(i, 2, 100000){
        if(res[i] == 1 && res[(i+1)/2] == 1){
            v.push_back(i);
        }
    }

    int q;
    cin >> q;

    int l, r;
    rep(i, q){
        cin >> l >> r;
        int cnt = 0;

        auto itrl = lower_bound(all(v), l);
        auto itrr = upper_bound(all(v), r);
        
        cout << distance(v.begin(), itrr) - distance(v.begin(), itrl) << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    if (s[1] == 'B') s[1] = 'R';
    else s[1] = 'B';
    cout << s;
    return 0;
}


Measured memory_bytes: 3596
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    ans = 0
    if N < 10:
        ans = N
    elif N < 100:
        ans = 9
    elif N < 1000:
        ans = 9 + ( N - 100 + 1 )
    elif N < 10000:
        ans = 9 + 900 
    elif N < 100000:
        ans = 9 + 900 + ( N - 10000 + 1 )
    else:
        ans = 9 + 900 + 90000
    print( ans )

Measured memory_bytes: 3060
sa,sb,sc = [list(input()) for _ in 'abc']
p = 'a'
while 1:
  if p == 'a' and len(sa)>0:
    p = sa.pop(0)
  elif p == 'b' and len(sb)>0:
    p = sb.pop(0)
  elif p == 'c' and len(sc)>0:
    p = sc.pop(0)
  else:
    break
print(p.upper())

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define M   1000000007 // 1e9 + 7
#define MAXN 100100
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,double> pdd;
inline int mod(int n, int m){int ret = n%m; if(ret < 0) ret += m; return ret;}
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }    else return mod(k*k,m);
}

int32_t main(){
	fastio;
     	int a,b,c;
     	cin>>a>>b>>c;
     	if(a+b+c>=22)cout<<"bust"<<endl;
     	else cout<<"win"<<endl;
	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int delicious[n],multi[n][n];
    int sum = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> delicious[i];
    }
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < n;j++)
        {
            multi[i][j] = delicious[i] * delicious[j];
            if(i != j)
            {
                sum = sum + multi[i][j];
            }
        }
    }
    cout << sum / 2;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, INF = 1e9, larg = 1e5;
int A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
int max_value = 0, max_index = 0;
int min_value = INF, min_index = 0;

typedef pair<int, int> Po;
typedef long long ll;

int main() {
	cin >> K;
	cout << (K/2)*((K+1)/2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=405;

int a,b;

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>a>>b;
	cout<<(b*2<a?a-b*2:0)<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[5005][5005];

int main()
{
	int N;
	string S;

	cin >> N >> S;

	for (int i = N - 1; i >= 0; i--) {
		for (int j = N - 1; j >= 0; j--) {
			if(S[i] != S[j]) {
				dp[i][j] = 0;
			} else {
				dp[i][j] = dp[i + 1][j + 1] + 1;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i >= j) {
				continue;
			}
			int now = min(dp[i][j], j - i);
			ans = max(ans, now);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 98048
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    ll q;
    cin>>q;
    int h=1;
    vector<char> temp;
    rep(i,q){
        ll type;
        cin>>type;
        if(type==1){
            h^=1;
        }else{
            ll type2;
            char c1;
            cin>>type2>>c1;
            type2--;
            if((type2^h)==1){
                temp.push_back(c1);
            }else{
                s.push_back(c1);
            }
        }
    }
    if(h==0){
        reverse(all(s));
        cout<<s;
        for(auto i:temp){
            cout<<i;
        }
        cout<<endl;
    }else{
        reverse(all(temp));
        for(auto i:temp){
            cout<<i;
        }
        cout<<s;
        cout<<endl;
    }
}


Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
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 pair<int, int> pair;
bool seen[505][505];

//dpTable
//bool dp[100050];

int main(){
    int N,M;
    cin >> N >> M;
    priority_queue<ll> pque;
    rep (i,N) {
        ll A;
        cin >> A;
        pque.push(A);
    }
    rep (i,M) {
        ll a = pque.top();
        a /= 2;
        pque.push(a);
        pque.pop();
    }
    ll ans = 0;
    while (!pque.empty()) {
        ans += pque.top();
        pque.pop();
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned ll

#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define INFLL 9e18
#define INF 2e9
#define EPS 1e-9
#define pb push_back
#define emp emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0


int main ()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);

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

    long long n;
    cin >> n;
    
    ll count = 0;
    ll ans = 0;
    bool isPrime = true;
    if (n == 1) isPrime = false;

    for (long long i=2; i*i <= n; i++){
        if (n%i == 0){
            isPrime = false;
            while (n%i == 0){
                n /= i;
                count++;
            }
            double now = -0.5 + 0.5*(sqrt(1.0 + 8.0*(double)count));
            //cout << i << " " << count << " " << now << endl; 
            ans += (long long) now;
            count = 0;
            now = 0.0; 
        }
    }
    if (n > 1) ans += 1;
    if (!isPrime)
    cout << ans << endl;
    else cout << 1 << endl;   
    
    return 0;
}


Measured memory_bytes: 3700
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);
    Task solver = new Task();
    solver.solve(1, in, out);
    out.close();
  }

  static class Task {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      String N = in.next();

      if (N.contains("7")) {
        out.print("Yes");
      } else {
        out.print("No");
      }
    }

  }
}



Measured memory_bytes: 26980
#include<cstdio>

char s[200000];
int m[200000];

int main(void) {
    int n,q;
    scanf("%d%d",&n,&q);
    scanf("%s", s);

    for(int i=0; i<n; i++)
        m[i+1] = m[i] + (s[i] == 'A' && s[i+1] == 'C');

    for(int i=0; i<q; i++) {
        int l,r;
        scanf("%d%d", &l, &r);
        l--, r--;
        printf("%d\n", m[r] - m[l]);
    }
}


Measured memory_bytes: 1280
#include <stdio.h>
int main()
{
    int n;
    int a[100];
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = n - 1; i > 0; i--)
    {
        printf("%d ", a[i]);
    }
    printf("%d\n", a[0]);

    return 0;
}


Measured memory_bytes: 2668
n, a, b = map(int, input().split(' '))
s = list(input())
ab = 0
bb = 0
for i in range(n):
	if s[i] == 'a':
		if ab < a + b:
			print('Yes')
			ab += 1
		else:
			print('No')
			ab += 1
	elif s[i] == 'b':
		if ab < a + b and bb < b:
			print('Yes')
			ab += 1
			bb += 1
		else:
			print('No')
			bb +=1
	else:
		print('No')


Measured memory_bytes: 4712
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int n;
string s[12345], t;

int main(void)
{
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> s[i];
		while (s[i].size() < 20)s[i].push_back(' ');
	}
	cin >> t;
	while (t.size() < 20)t.push_back(' ');
	int up = 0, dn = 0;
	for (int i = 0; i < n; ++i)
	{
		string ab, be;
		for (char c : s[i])ab.push_back(c == '?' ? 'a' : c);
		for (char c : s[i])be.push_back(c == '?' ? 'z' : c);
		if (ab <= t && be >= t)
		{
			continue;
		}
		if (ab <= t)
		{
			++up;
		}
		if (be >= t)
		{
			++dn;
		}
	}
	for (int i = up; i < n - dn + 1; ++i)
	{
		cout << i + 1 << " \n"[i == n - dn];
	}
	return 0;
}


Measured memory_bytes: 1152
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
struct edge{
	int to,val;
};
vector<edge> v[100010];
int n,m,f[100010],siz[100010];
queue<int> q;
int main(){
	int x,y;
	scanf("%d %d",&n,&m);
	while(m--){
		scanf("%d %d",&x,&y);
		v[x].push_back((edge){y,1});
		siz[y]++;
	}
	for(int i=1;i<=n;i++){
		if(!siz[i]) q.push(i);
	}
	while(q.size()){
		int x=q.front();
		q.pop();
		for(int i=0;i<v[x].size();i++){
			siz[v[x][i].to]--;
			f[v[x][i].to]=max(f[v[x][i].to],f[x]+v[x][i].val);
			if(!siz[v[x][i].to]) q.push(v[x][i].to);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,f[i]);
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 6528
#include <stdio.h>
long long v;
long long gcd(long long a,long long b){
	if(a<b){
		v=a;
		a=b;
		b=v;
	}
	if(a%b)return gcd(b,a%b);
	else return b;
}
int main(void){
	long long n,x;
	scanf("%lld%lld",&n,&x);
	long long a[n];
	long long e;
	for(int i=0;i<n;i++){
		scanf("%lld",&e);
		if(e>x)a[i]=e-x;
		else a[i]=x-e;
	}
	if(n==1){
		printf("%lld\n",a[0]);
		return 0;
	}
	long long k;
	k=gcd(a[0],a[1]);
	for(int i=2;i<n;i++){
		k=gcd(k,a[i]);
	}
	printf("%lld\n",k);
}

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

using namespace std;
using ll = long long;
 
int main() {
  ll x, k, d; cin >> x >> k >> d;
  if (x < 0) {
    x = -x;
  }
  ll q = x / d;
  ll r = x % d;
  if (q > k) {
    cout << x - k * d << endl; return 0;
  }
  else {
    if (k % 2 == q % 2) {
      cout << r << endl; return 0;
    }
    else {
      cout << d - r << endl; return 0;
    }
  }
}

Measured memory_bytes: 3672
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 200000;
int n;
pii p[MAX_N];
int ans[MAX_N];

int main() {
    fastio();

    cin >> n;
    forn(i, n) {
        cin >> p[i].fst;
        p[i].snd = i;
    }

    sort(p, p + n);

    int mid = n / 2;

    for (int i = 0; i < mid; i++) {
        ans[p[i].snd] = p[mid].fst;
    }

    for (int i = mid; i < n; i++) {
        ans[p[i].snd] = p[mid - 1].fst;
    }

    forn(i, n) {
        cout << ans[i] << '\n';
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; i++) cin >> a[i];
	vector<int> row, column;
	for (int i = 0; i < H; i++) {
		bool white = true;
		for (int j = 0; j < W; j++) {
			if (a[i][j] == '#') white = false;
		}
		if (white) row.push_back(i);
	}
	for (int j = 0; j < W; j++) {
		bool white = true;
		for (int i = 0; i < H; i++) {
			if (a[i][j] == '#') white = false;
		}
		if (white) column.push_back(j);
	}
	
	vector<string> ans;
	for (int i = 0; i < H; i++) {
		string s;
		for (int j = 0; j < W; j++) {
			bool remove = false;
			for (int h : row) {
				if (i == h) remove = true;
			}
			for (int w : column) {
				if (j == w) remove = true;
			}
			if (remove) continue;
			s.push_back(a[i][j]);
		}
		if (!s.empty()) ans.push_back(s);
	}
	for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;


int main() {
  int a,b,c,d,e,k;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  if(e-a>k)
  cout << ":(" << endl;
  else
  cout << "Yay!" << endl;
}

Measured memory_bytes: 3568
N = gets.to_i
a = Array.new(N)
b = Array.new(N)
c = Array.new(N)

1.upto(N).each {|i|
  ai, bi, ci = gets.split.map(&:to_i)
  a[i] = ai
  b[i] = bi
  c[i] = ci
}

A = 0
B = 1
C = 2

# dp[i][j] i 日目の行動が j だった場合の最大の幸福度 (選択できない場合は -1)
dp = Array.new(N + 1) { Array.new(3, 0) }
dp[0][A] = 0
dp[0][B] = 0
dp[0][C] = 0

1.upto(N) {|i|
  h = i - 1
  ap = dp[h][A]
  bp = dp[h][B]
  cp = dp[h][C]

  dp[i][A] = (bp < cp ? cp : bp) + a[i]
  dp[i][B] = (ap < cp ? cp : ap) + b[i]
  dp[i][C] = (ap < bp ? bp : ap) + c[i]
}

puts dp.last.max


Measured memory_bytes: 9468
#include<stdio.h>
#include<math.h>

int main() {
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	if ((A == B && B != C) || (A == C && C != B) || (B == C && C != A)) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <iomanip> 
#include <vector>
#include <unordered_map> 
#include <algorithm>
#include <set> 
#include <map>
#include <queue>
#include <deque>
using namespace std;
 



int main(){
    int n,m;
    cin >> n >> m;
    int wrong[n+1]={};
    bool done[n+1]={};
    int correct = 0;
    int penalty = 0;
    for(int i = 0;i<m;i++){
        int index;
        string answer;
        cin >> index >> answer;
        if(answer == "AC" && !done[index]){
            done[index]= true;
            correct +=1;
            penalty += wrong[index];
        }else{
            wrong[index]+=1;
        }

    }
    cout << correct << " " << penalty;
}
    

   

Measured memory_bytes: 768
def check(s):
    i, j = 0, len(s) - 1
    while i < j:
        if s[i] != s[j]:
            return False
        i += 1; j -= 1
    return True
s = input()
n = len(s)
n_S = s[0:(n - 1)//2]
n_E = s[(n+3)//2 - 1::]

if check(s) and check(n_S) and check(n_E):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38384
#include <iostream>
#include <stdlib.h>
#include <unordered_set>

using namespace std;

using ll = long long;

int main()
{

	ll N, K;

	cin >> N >> K;

	ll n = N % K, min_n = N;

	unordered_set<ll> seen;

	while (true) {
		n = abs(n - K);
		min_n = min(min_n, n);

		if (seen.find(n) == seen.end()) {
			seen.insert(n);
		} else {
			break;
		}
	}

	cout << min_n << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, X;
	cin >> N >> M >> X;
	
	vector<int> a(M);
	for (int i = 0; i < M; i++) cin >> a[i];

	int bnd = lower_bound(a.begin(), a.end(), X) - a.begin();

	cout << min(bnd, M - bnd) << "\n";

	return 0;
}

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

int main(){
  int X,N;
  cin >>X >>N;
  vector<int> P(N);
  vector<int> A(N);
  int sita=X;
  int ue=X;
  int answer=-1;
  int countsita=0;
  int countue=0;
  bool out=false;
  
  if(N==0){answer=X;}
  else{
    //Pを整頓
    for(int i=0; i<N; i++){cin >>P.at(i);}
    sort(P.begin(), P.end());
    //for(int i=0; i<N; i++){cout << P.at(i)<<" ";}cout<<endl;
    
    for(int j=0; j<N; j++){
      for(int i=0; i<N; i++){
        if(P.at(i) != sita){countsita++;}
        //cout << countsita << endl;
      	if(countsita>=N){out=true; break;}  
      }
      if(out){break;}
      
      countsita=0;
      sita--;
    }
    out=false;
    
    for(int j=0; j<N; j++){
      for(int i=0; i<N; i++){
        if(P.at(i) != ue){countue++;}
      	if(countue>=N){out=true; break;}  
      }
      if(out){break;}
      //cout << ue << endl;
      countue=0;
      ue++;
    }
    
    
    
    
    if(ue-X < X-sita){answer = ue;}
    else{answer = sita;}
    
    
  }
  
  cout<< answer <<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e16;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("substrcmp.in", "r", stdin);
       // freopen("substrcmp.out", "w", stdout);
#endif
}

void solve(){
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vi nums1(a);
    for(int &i:nums1)
        cin >> i;
    vi nums2(b);
    for(int &i:nums2)
        cin >> i;
    vi nums3(c);
    for(int &i:nums3)
        cin >> i;
    sort(all(nums1));
    reverse(all(nums1));
    sort(all(nums2));
    reverse(all(nums2));
    sort(all(nums3));
    reverse(all(nums3));
    vi keklol;
    for(int i=0; i<x; i++)
        keklol.pb(nums1[i]);
    for(int i=0; i<y; i++)
        keklol.pb(nums2[i]);
    sort(all(keklol));
    reverse(all(keklol));
    int can = min((int)nums3.size(), x+y);
    int sum = 0;
    for(int i=0; i<x+y-can; i++){
        sum += keklol[i];
    }
    int sum2 = 0;
    for(int i=0; i<can; i++){
        sum2 += nums3[i];
    }
    int ans = sum+sum2;
    for(int i=x+y-can; i<x+y; i++){
        sum += keklol[i];
        sum2 -= nums3[can-1-(i-x-y+can)];
        ans = max(sum+sum2, ans);
    }
    cout << ans << endl;

}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 4852
<?php
/*
    Problem URL : https://beta.atcoder.jp/contests/abc066/tasks/abc066_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

// define('DEBUG', true);
define('DEBUG', false);

ini_set('error_reporting', E_ALL & ~E_NOTICE);

$a = explode(" ", trim(fgets(STDIN)));

echo (array_sum($a) - max($a)) . PHP_EOL;


Measured memory_bytes: 4604
// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second
#define endl '\n'
 
 
ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll
 
 
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};
 
bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   
    if(a.f==b.f)
    {
        if(a.s<=0 && b.s<=0) return (a.s>b.s);
        return (a.s<b.s);
    }
    else if(a.f<=0 && b.f<=0 ) return (a.f > b.f);
    else return (a.f<b.f);
}


int main()
{

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);

     

        ll N,A,B;
        cin>>N>>A>>B;

        if(A==0 )
            cout<<0<<endl;
        else if(B==0)
            cout<<N<<endl;
        else{
            ll ans=(N/(A+B))*A;
            if(N%(A+B)<=A)
                ans+=(N%(A+B));

            else
                ans+=A;
            cout<<ans<<endl;
        }



}

Measured memory_bytes: 384
#include <cstdio>
#include <assert.h>

typedef long long LL;

const int MAXM = 1e5, MOD = 1e9 + 7;
int n, m;

inline int add ( int a, const int b ) { return ( a += b ) < MOD ? a : a - MOD; }
inline int mul ( LL a, const int b ) { return ( a *= b ) < MOD ? a : a % MOD; }

inline int rint () {
	int x = 0; char s = getchar ();
	for ( ; s < '0' || '9' < s; s = getchar () );
	for ( ; '0' <= s && s <= '9'; s = getchar () ) x = x * 10 + ( s ^ '0' );
	return x;
}

struct Matrix {
	int n, m, mat[3][3];
	Matrix (): n ( 0 ), m ( 0 ), mat {} {}
	Matrix ( const int tn, const int tm ): n ( tn ), m ( tm ), mat {} {}
	inline int* operator [] ( const int key ) { return mat[key]; }
	inline Matrix operator * ( Matrix t ) {
		assert ( m == t.n );
		Matrix ret ( n, t.m );
		for ( int i = 0; i < n; ++ i ) {
			for ( int k = 0; k < m; ++ k ) {
				for ( int j = 0; j < t.m; ++ j ) {
					ret[i][j] = add ( ret[i][j], mul ( mat[i][k], t[k][j] ) );
				}
			}
		}
		return ret;
	}
};

inline Matrix qkpow ( Matrix a, int b ) {
	Matrix ret ( a.n, a.m );
	for ( int i = 0; i < ret.n; ++ i ) ret[i][i] = 1;
	for ( ; b; a = a * a, b >>= 1 ) if ( b & 1 ) ret = ret * a;
	return ret;
}

Matrix I ( 3, 1 ), A ( 3, 3 ), B ( 3, 3 );

inline void init () {
	I[0][0] = 1;
	A[0][0] = 1;
	A[1][0] = 2, A[1][1] = 1;
	A[2][0] = A[2][1] = A[2][2] = 1;
	B = A, ++ B[0][0], ++ B[0][1], ++ B[0][2];
}

int main () {
	init ();
	n = rint (), m = rint ();
	int las = 0;
	for ( int i = 1, x; i <= m; ++ i ) {
		x = rint ();
		I = A * qkpow ( B, x - las - 1 ) * I;
		las = x;
	}
	
	I = A * qkpow ( B, n - las - 1 ) * I;
	printf ( "%d\n", I[2][0] );
	return 0;
}

Measured memory_bytes: 3164
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n;cin>>n;
    P a[114514];rep(i,0,n){
        cin>>a[i].first;a[i].second=i;
    }
    sort(a,a+n);
    int cnt=0;
    int ans=0;
    rep(i,0,n){
       // cout<<a[i].second<<" "<<i<<endl;
        if((abs(a[i].second-i))%2==1)cnt++;
    }ans=cnt/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2048
//Chandigarh University
//author:- shivamkr21
#include<bits/stdc++.h>
#define lli long int 
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(lli i=0;i<s.length();i++)
	{
		//65-90
		lli p=int(s[i]);
		p=p+n;
		if(p>90)
		{
			p=p-26;
		}
		cout<<char(p);
	}
	return 0;
}

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

int main(){
    int n, a, t, i, ans;
    double dmin = 1e9;
    cin >> n >> t >> a;
    int h[n];
    for (i = 0; i < n; i++){
        cin >> h[i];
    }

    for(i = 0; i < n; i++){
        double d;
        d = t - h[i] * 0.006;
        if(abs(a - d) < abs(a - dmin)) {
            dmin = d;
            ans = i+1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
function F()
  N = parse(Int64,readline())
  L = parse.(BigInt,split(readline()))
  c = 0
  for i = 1:N-2
    for j = i+1:N-1
      for k = j+1:N
        if L[i] + L[j] > L[k] && L[j]+L[k]>L[i] && L[i]+L[k]>L[j] && L[i]!=L[j] && L[j] != L[k] && L[k] != L[i]
          c += 1
        end
      end
    end
  end
  println(c)

  
end
F()

Measured memory_bytes: 224908
#include<cstdio>

bool binarySearch(int A[], int n, int key)
{
    int left = 0;
    int right = n;
    int mid;
    while(right > left)
    {
        mid = (left + right) / 2;
        if(A[mid] == key)
            return true;
        else if(A[mid] < key)
            left = mid+1;
        else
            right = mid;
    }
    return false;
}
int main()
{
    int S[1000000];
    int key;
    int n,q;
    int nums = 0;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d",&S[i]);
    scanf("%d", &q);
    for(int i=0; i<q; i++)
    {
        scanf("%d",&key);
        if(binarySearch(S,n,key))
            nums++;
    }
    printf("%d\n",nums);

    return 0;
}



Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<pair<int,char>> a(m);
    for(int i=0;i<m;i++){
        int s;
        char c;
        cin>>s>>c;
        s--;
        a[i].first=s;
        a[i].second=c;
    }
    for(int num=0;num<1000;num++){
        bool ok=true;
        string t=to_string(num);
        for(int i=0;i<t.size();i++){
            for(int j=0;j<m;j++){
                if(t[a[j].first]!=a[j].second)ok=false;
            }
        }
        if(ok&&t.size()==n){
            cout<<num<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int H,W;
char S[22][22];

int DFS(int x, int y, int max){

    return 0;
}


int main(void) {

    string n;cin>>n;
    for (int i = 0; i < 3; ++i) {
        if(n[i]=='1') n[i]='9';
        else if(n[i]=='9')n[i]='1';
    }
    cout<<n<<endl;
}

Measured memory_bytes: 384
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int A = sc.nextInt();
    	int B = sc.nextInt();
      	int ans = 0;
        for (int i=A; i<=B; i++) {
            if(i % K == 0){
              ans += 1;
          	  break;
            }
        }
      	if(ans > 0)
        	System.out.println("OK");
      	else
          	System.out.println("NG");
    }
}

Measured memory_bytes: 35704
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n,c;
	c = 0;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n - 2; i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')	c++;
	}
	cout << c << endl;
  	return 0;
}

Measured memory_bytes: 256
// 2013/11/09 Tazoe

#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main()
{
	int D, N;
	cin >> D >> N;

	int T[200];
	for(int i=0; i<D; i++){
		cin >> T[i];
	}

	int A[200], B[200], C[200];
	for(int i=0; i<N; i++){
		cin >> A[i] >> B[i] >> C[i];
	}

	bool S[200][200];
	for(int i=0; i<D; i++){
		for(int j=0; j<N; j++){
			S[i][j] = (A[j]<=T[i] && T[i]<=B[j]);
		}
	}

	int DP[200][200];
	for(int i=0; i<D; i++){
		for(int j=0; j<N; j++){
			DP[i][j] = -1;
		}
	}

	for(int j=0; j<N; j++){
		if(S[0][j]){
			DP[0][j] = 0;
		}
	}

	for(int i=1; i<D; i++){
		for(int j=0; j<N; j++){
			if(!S[i][j])
				continue;

			for(int k=0; k<N; k++){
				if(!S[i-1][k])
					continue;

				DP[i][j] = max(DP[i][j], DP[i-1][k]+abs(C[k]-C[j]));
			}
		}
	}

	int ans = -1;
	for(int j=0; j<N; j++){
		ans = max(ans, DP[D-1][j]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1356
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    getLine
    hs <- getIntList
    putStrLn $ solve hs

solve (h : []) = "Yes"
solve (h1 : h2 : []) | h2 >= h1 = "Yes"
                     | otherwise = "No"
solve (h1 : h2 : hs) | h1 == h2 = solve (h2 : hs)
                     | h2 > h1 = solve ((h2 - 1) : hs)
                     | otherwise = "No"

Measured memory_bytes: 4092
#include<stdio.h>
#include<math.h>
#define NUM 102
int main(){
  int i,x,n,s,tmp;
  int p[NUM],np[NUM],diff[2][NUM];
  
  //入力
  scanf("%d %d",&x,&n);
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    getchar();
    np[p[i]]=-1;
  }
  //絶対値で差を求める
  for(i=0;i<NUM;i++){
    diff[1][i]=i;//番号記憶
    if(np[i]!=-1){
      diff[0][i]=abs(x-i);
    }
    else{
      diff[0][i]=999;
    }
  }
  //並び替え
  for(i=NUM-1;i>=0;i--){
    for(s=0;s<i;s++){
      if(diff[0][s]>diff[0][s+1]){
        //
        tmp=diff[0][s];
        diff[0][s]=diff[0][s+1];
        diff[0][s+1]=tmp;
        //
        tmp=diff[1][s];
        diff[1][s]=diff[1][s+1];
        diff[1][s+1]=tmp;
      }
    }
  }
  //for(i=0;i<NUM;i++){
    //printf("%d %d\n",diff[0][i],diff[1][i]);
  //}
  printf("%d",diff[1][0]);

}

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

using namespace std;

int main(){
    int a, b, c, d, e;
    int k;
    cin >> a >> b >> c >> d >>e ;
    cin >> k;

    string ans;
    int L = e - a ;
    if (L <= k) ans  = "Yay!";
    else ans = ":(" ;

    cout << ans << endl;
}


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

int main() {
	string s;
	cin >> s;
	int atoz[26]={};
	for(int i=0; i<s.length(); i++){
		if(atoz[s[i]-'a']>0){
			cout << "no" << endl;
			return 0;
		}
		atoz[s[i]-'a']++;
	}
	cout<<"yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int n;
int p[200100];

int min(int a, int b) {
    return (a < b ? a : b);
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &p[i]);
    int mn = p[0];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] <= mn) ans++;
        mn = min(mn, p[i]);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
using namespace std;

static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c){
  stack<int> s;
  s.push(r);
  color[r] = c;
  while(!s.empty()){
    int u=s.top();
    s.pop();
    for(int i=0;i<G[u].size();i++){
      int v = G[u][i];
      if(color[v] == NIL){
        color[v] = c;
        s.push(v);
      }
    }
  }
}

void assignColor(){
  int id = 1;
  for(int i=0;i<n;i++) color[i] = NIL;
  for(int u=0;u<n;u++){
    if(color[u] == NIL) dfs(u,id++);
  }
}

int main(){
  int s,t,m,q;

  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  assignColor();

  cin >> q;

  for(int i=0;i<q;i++){
    cin >> s >> t;
    if(color[s] == color[t]){
      cout << "yes" << endl;
    }else{
      cout << "no" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 8960
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let n: usize = read();
    let s: String = read();
    let cv: Vec<char> = s.chars().collect();

    let mut ans = 0;
    for i in 0..(n - 2) {
        if cv[i] == 'A' && cv[i + 1] == 'B' && cv[i + 2] == 'C' {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

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

using namespace std;
using lint=long long;

int main(){
	int n; cin>>n;
	int d[300][300];
	rep(i,n) rep(j,n) cin>>d[i][j];

	bool ok=true;
	rep(k,n) rep(i,n) rep(j,n) if(d[i][j]>d[i][k]+d[k][j]) ok=false;
	if(!ok){ cout<<-1<<endl; return 0; }

	bool need[300][300];
	rep(i,n) rep(j,n) need[i][j]=true;
	rep(k,n) rep(i,n) rep(j,n) if(k!=i && k!=j && d[i][j]==d[i][k]+d[k][j]) need[i][j]=false;

	lint ans=0;
	rep(i,n) rep(j,n) if(need[i][j]) ans+=d[i][j];
	cout<<ans/2<<endl;

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K; 
  cin >> N >> K;

  int ans = 0;
  while(N > 0){
    N /= K;
    ans++;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256