akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin >> N >> M;
  rep(i, 1, 3) {
    if (i == N || i == M) {
      continue;
    }
    cout << i << endl;
    return;
  };
}
void solve() {
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstdlib>
#include<string>
#include<unordered_map>
#include<vector>
#include<list>
#include<map>
#include<set>
#define fi first
#define se second
#define pb push_back
#define me(a,b) memset(a,b,sizeof(a))
#define INIT() std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int MAX_N=200000+5;
const int MAX_M=100000+5;
const int INF=0x7fffffff;
const int inf=1000000000;
const double EPS=1e-6;
const ull base=123;
const ll mod=1e9+7;
const double pi=4*atan(1.0);
int main()
{
    int n;
    double d;
    scanf("%d%lf",&n,&d);
    int ans=0;
    while(n--)
    {
        double x,y;
        scanf("%lf%lf",&x,&y);
        if((x*x+y*y)<=d*d)
            ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3720
def part_sum(a,A):
    N=len(a)
    dp=[[0 for i in range(A+1)] for j in range(N+1)]
    dp[0][0]=1

    for i in range(N):
        for j in range(A+1):
            if a[i]<=j: 
                dp[i+1][j]=dp[i][j-a[i]] or dp[i][j]
            else: 
                dp[i+1][j]=dp[i][j]
    return dp[N][A]


n=int(input())

A=[int(i) for i in input().split()] #s

q=int(input())

M=[int(i) for i in input().split()]

for i in range(q):
    if(part_sum(A,M[i])==1):
        print('yes')
    else:
        print('no')


Measured memory_bytes: 5940
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

int MOD=1000000007;


int main(){
  ld R;
  cin >> R;
  cout << 2*M_PI*R << endl;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

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

  ll n;
  cin >> n;
  set<ll> factors1, factors2;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      factors1.insert(i);
      if (i * i != n) factors1.insert(n / i);
    }
    if ((n-1) % i == 0) {
      factors2.insert(i);
      if (i * i != n-1) factors2.insert((n-1) / i);
    }
  }

  ll cnt = factors2.size() - 1;
  ll n1;
  for (ll f: factors1) {
    if (f == 1) continue;
    //cout << f << endl;
    n1 = n;
    while (n1 % f == 0) n1 /= f;
    if (n1 % f == 1) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3904
//
//  AT2084 CF.cpp
//  Algorithm
//
//  Created by SkyGao on 2020/2/13.
//  Copyright © 2020 skygao. All rights reserved.
//

#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define re register
using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    string a;
    cin>>a;
    int pos1=a.find_first_of('C'),pos2=a.find_last_of('F');
    if(pos1>=0&&pos1<a.length()&&pos2>=0&&pos2<a.length())
    {
        if(pos1<pos2)
            printf("Yes");
        else
            printf("No");
    }
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define ld long double
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define foriter(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define endl '\n'
#define INF (ll)(1e9)
#define EPS 1e-9
#define MOD (ll)(1e9+7)
#define PI 3.1415926535897932384626433832795
#define set set
#define mset multiset
#define uset unordered_set
#define umset unordered_multiset
#define map map
#define mmap multimap
#define umap unordered_map
#define ummap unordered_multimap

using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vll;
typedef vector<vll> vvll;
typedef pair<i64, i64> pll;

int inp(){
  int x; 
  cin>>x;
  return x;
}

//=============================================================================//
int dfs(int i, vector<bool>& vis, vector<set<ll>>& g){
    vis[i] = true;
    int f = 1;
    for(auto it: g[i]){
      if(!vis[it]) f+=dfs(it, vis, g);
    }
    return f;
}
void solve() {
    int n, m; cin>>n>>m;
    vector<set<ll>> g(n);
    for0(i, m){
      int x, y; cin>>x>>y;
      g[x-1].insert(y-1);
      g[y-1].insert(x-1);
    }

    vector<bool> vis(n, false);
    int mx = 0;
    for(int i = 0; i<n; i++){
      if(!vis[i]) mx = max(mx, dfs(i, vis, g));
    }
    cout<<mx;
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);

    int T=1;
    //cin >> T;
    while (T--) {
        solve();
        cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 43800
n,m = map(int,input().split())
AC = [0]*n
WA = [0]*n
ac = 0
wa = 0

for i in range(m):
  c,s = input().split()
  c = int(c)
  c -= 1
  if AC[c]: continue
  if s == 'AC':
    AC[c] = 1
  else:
    WA[c] +=  1

for i in range(n):
  ac += AC[i]
  if AC[i]: 
    wa += WA[i]

print(ac, wa)
  

Measured memory_bytes: 10456
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	ss:=split(s)
	switch ss[len(ss)-1]  {
	case "2","4","5","7","9":
		fmt.Println("hon")
	case "0", "1", "6", "8":
		fmt.Println("pon")
	case "3":
		fmt.Println("bon")

	}
}


func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


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

vector<int> G[200020];
bool visited[200020];
int cntL, cntR;
void dfs(int x) {
    if(visited[x]) return;
    visited[x] = true;
    if(x <= 100000) cntL++;
    else cntR++;
    for(auto to: G[x]) {
        dfs(to);
    }
}


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    ll ans = -n;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        G[x].push_back(y + 100010);
        G[y + 100010].push_back(x);
    }
    rep(i, 200020) {
        cntL = 0, cntR = 0;
        dfs(i);
        if(cntL > 0 && cntR > 0) {
            ans += (ll)(cntL) * cntR;
        }
       
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10240
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
  int n, b_;
  scanf("%d", &n);
  vector<int> a(n), c(n-1);
  int b = 0;
  REP(i, n) scanf("%d", &a.at(i));
  REP(i, n) {
    scanf("%d", &b_);
    b += b_;
  }
  REP(i, n-1) scanf("%d", &c.at(i));

  int manzoku = 0;
  REP(i, n - 1){
    if (a.at(i + 1) - a.at(i) == 1){
      manzoku += c.at(a.at(i) - 1);
    }
  }
  printf("%d\n", manzoku + b);
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    while(n--){
        vector<int> a(10);
        for(int i=0; i<10; i++) cin>>a[i];

        string ans = "NO";
        for(int bit=0; bit<(1<<10); bit++){
            vector<int> l, r;
            for(int i=0; i<10; i++){
                if(bit & (1 << i)) l.emplace_back(a[i]);
                else r.emplace_back(a[i]);
            }

            bool valid = true;
            for(int i=0; i+1<l.size(); i++){
                if(l[i] > l[i+1]) valid = false;
            }
            for(int i=0; i+1<r.size(); i++){
                if(r[i] > r[i+1]) valid = false;
            }

            if(valid) ans = "YES";
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3156
# n = gets.to_i
# out = "#{n.to_s}:"
#
# while n % 2 == 0
#   out += " 2"
#   n /= 2
# end
#
# i = 3
# while n != 1 and i * i <= n
#   while n % i == 0
#     out += " #{i.to_s}"
#     n /= i
#   end
#   i += 2
# end
#
# if n != 1
#   out += " #{n}"
# end
#
# puts out

require 'prime'
n = gets.to_i

puts "#{n}:" + Prime.prime_division(n).map{|a,b| " #{a}"*b}.join("")



Measured memory_bytes: 7032
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next(), t = "keyence";
		if (s.length() >= t.length()) {
			int d = s.length() - t.length();
			for (int i = 0; i + d <= s.length(); i++) {
				if (t.equals(s.substring(0, i) + s.substring(i + d))) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

Measured memory_bytes: 23764
n, c, k = map(int, input().split())
passenger = sorted([int(input()) for _ in range(n)], reverse = True)
#cは一度に乗れる乗客の数
#kは時間の幅
count = 0
while passenger != []:
    bus = []
    time = passenger[0]
    count += 1
    while len(bus) != c and time - k <= passenger[0]:
        bus.append(passenger.pop(0))
        if passenger == []:
            break
print(count)



Measured memory_bytes: 8280
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int A, B; cin >> A >> B;
    cout << max({A+B, A-B, A*B}) << endl;
}

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

    using namespace std;

     long long a[10000003];
     long long b[10000003];

    int main(){

    	long long  n,k;
    	cin>>n>>k;

    	for (int i=0;i<n;i++)
    	{
    		cin>>a[i];
    	}
    	b[0]=0;
    	b[1]=abs(a[1]-a[0]);


    	for(int i=2;i<n;i++){

        long long  temp=1e15,j=1;

    		while(j<=k&&(i-j)>=0){

    			temp=min(temp, abs(a[i]-a[i-j]) + b[i-j]);
    			j++;
    		}
    		b[i]=temp;
    	}
    	cout<<b[n-1]<<endl;
    	return 0;
    }


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define NL '\n'
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define all(x) (x).begin(), (x).end()
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(ii,aa,bb) for(ll (ii)=ll(aa);(ii)<(ll)(bb);++(ii))
#define _fastIO() ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

//#define LOCAL
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#ifdef LOCAL
#define debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 6660999
#endif

void absinthe() {
    int n, mx = 1; cin >> n;
    vector<int>a(n+1), p(n+2), s(n+2);
    rep(i, 1, n+1) cin >> a[i];
    p[0] = 0, s[n+1] = 0;
    for(int i = 1; i <= n; i++) p[i] = __gcd(p[i-1], a[i]);
    for(int i = n; i > 0; i--) s[i] = __gcd(s[i+1], a[i]);
    for(int i = 1; i <= n; i++) mx = max(mx,__gcd(p[i-1], s[i+1]));
    cout << mx << NL;
}
 
int main(){
  _fastIO();
  int tx = 1; 
  //cin >> tx;
  while(tx--) absinthe();
}  

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int N;
long long M;
vector<int> A;
vector<long long> S;

long long cnt(int x) {
    long long ret = 0;
    for(int i=0; i<N; ++i) {
        ret += N - (lower_bound(begin(A), end(A), x - A[i]) - begin(A));
    }
    return ret;
}

pair<long long, long long> res(int x) {
    long long ret = 0, c = 0;
    for(int i=0; i<N; ++i) {
        int tmp = upper_bound(begin(A), end(A), x - A[i]) - begin(A);
        c += N - tmp;
        ret += S[N] - S[tmp] + 1LL * (N - tmp) * A[i];
    }
    return make_pair(ret, c);
}

int main() {
    cin >> N >> M; A.resize(N); S.resize(N + 1, 0);
    for(int i=0; i<N; ++i) cin >> A[i];
    sort(begin(A), end(A));
    for(int i=0; i<N; ++i) S[i + 1] = S[i] + A[i];

    int l = 0, r = 200001;
    while(r - l > 1) {
        int m = (l + r) / 2;
        if(cnt(m) >= M) l = m;
        else r = m;
    }

    auto x = res(l);
    long long a = x.first + l * (M - x.second);
    cout << a << '\n';
}

Measured memory_bytes: 1536
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int group = in.nextInt();
        int total = 0;
        for (int i = 0; i < group; i++){
            int start = in.nextInt();
            int finish = in.nextInt();
            total += finish - start + 1;
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 25592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,a,b;
  cin >> S ;
  a = "ABC";
  b = "ARC";
  if(S == a) {
    cout << "ARC" << endl;
  }
  if(S == b) {
    cout << "ABC" << endl;
  }
}

Measured memory_bytes: 3596
<?php

$array_data=array();
while(1){

	$x=trim(fgets(STDIN));

	// ????????\??????????????¨?????????
	if($x==""){

		break;
	}

	$array_data[]=$x;
}


// $input=trim(fgets(STDIN));

$array_char=array();

for($i=97;$i<97+26;$i++){

	$array_char[chr($i)]=0;
}


foreach($array_data as $v){

	// ?°???????????????????????????????????????????????????????
	foreach(str_split(strtolower($v)) as $s){

		if(array_key_exists($s,$array_char)){

			$array_char[$s]+=1;

		}

	}

}

#????????¨
foreach($array_char as $key=>$val){

	printf("%s : %d\n",$key,$val);
}

Measured memory_bytes: 15292
import sys
if __name__ == '__main__':

    N,M = map(int, input().split())

    A = []
    B = []
    for i in range(N):
        A.append(input())
    for i in range(M):
        B.append(input())

    char = B[0][0]
    matc = False
    for i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == char:
                matc = True
                for k in range(M):
                    for l in range(M):
                        if A[i+k][j+l] == B[k][l]:
                            matc = True
                        else:
                            matc = False
                            break
                    if not matc:
                        break
                if matc == True:
                    print("Yes")
                    sys.exit(0)

    if matc == True:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	int X;
	cin >> X >> N;
	vector< int > P(N);
	rep(i, N) cin >> P[i];
	int ans = LINF;
	set< int > s;
	rep(i, N) s.insert(P[i]);
	for (int i = -1; i <= 1000; i++) {
		if (s.count(i))
			continue;
		if (abs(X - i) < abs(X - ans)) {
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
N = int(input())
A = list(map(lambda a: int(a), input().split(" ")))
A.sort(reverse=True)
Alice = []
Bob = []

for i in range(N):
  if i % 2 == 0:
    Alice.append(A[i])
  else:
    Bob.append(A[i])

print(sum(Alice) - sum(Bob))

Measured memory_bytes: 9112
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int calc(int n, int a, int b, vector<int> v)
{
	int result = 0;
	rep(i, n)
	{
		if (i % 2 == 0)
		{
			if (v[i] != a)
				result += 1;
		}
		else if (i % 2 == 1)
		{
			if (v[i] != b)
				result += 1;
		}
	}

	return result;
}

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

	string ans = to_string(floor(A*B));
	cout << ans.substr(0, ans.find(".")) << endl;
	return 0;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define endl "\n"
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(0)                   
using namespace std;                            
                                                
void yes() {cout << "YES" << endl;}                                               
void no() {cout << "NO" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const long long INF = 8e18 + 8;
const double EPS = 1e-9;
const long long MOD = 998244353;

void solve() {
	int n; cin >> n;
	vector<int> a(n), b(n);
	map<int, int> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(all(b));
	for (int i = 0; i < n; i++) {
		m[b[i]] = i;
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		a[i] = m[a[i]];
		cnt += (a[i] % 2 == 0 and i % 2 == 1);
	}
	cout << cnt << endl;
}

int main() {
    jonathan; 
    livingston;
    bool tests = 0;
    int t = 1;
    if (tests) cin >> t;
    for (int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 8712
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        char[] s = in.next().toCharArray();

        System.out.println((s[0] == s[1] && s[1] == s[2]) ? "No": "Yes");

        out.close();
    }


    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long Long() throws IOException {
            return Long.parseLong(next());
        }

        int Int() throws IOException {
            return Integer.parseInt(next());
        }

        double Double() throws IOException {
            return Double.parseDouble(next());
        }

        char Char() throws IOException {
            return next().charAt(0);
        }

        String Line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 22996
N = int(input())
S = [input() for _ in range(N)]

ans = {'AC': 0, 'WA': 0, 'TLE':0, 'RE':0}
for s in S:
    ans[s] += 1

for s in ('AC','WA','TLE','RE'):
    print(f'{s} x {ans[s]}')

Measured memory_bytes: 16284
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int n, rd[100005], a[100005], x, y, mn[100005];
struct tree {
	int hd[100005], vr[200005], nt[200005], tt;
	void push(int x, int y) {
		vr[++tt] = y; nt[tt] = hd[x]; hd[x] = tt;
	}
	void dfs(int nw, int en) {
		if(nt[hd[nw]] == 0) {mn[nw] = a[nw]; return;}
		int sm, S = 0, T = 0, mx = 0, db = 0, hc = 0;
		for(int i = hd[nw]; i; i = nt[i]) {
			if(vr[i] == en) continue;
			dfs(vr[i], nw);
			if(mx < mn[vr[i]]) S += mx, mx = mn[vr[i]];
			else S += mn[vr[i]];
		}
		
		if(mx > S) {
			T = mx - S;
			sm = mx;
			db = S;
		} else {
			T = (S + mx) & 1;
			sm = (S + mx) / 2 + T;
			db = (S + mx) / 2;
		}
		mn[nw] = T;
		if(sm > a[nw]) {puts("NO"); exit(0);}
		hc = a[nw] - sm;
		if(db < hc) {puts("NO"); exit(0);}
		else mn[nw] += hc * 2;
		return;
	}
}T;
signed main() {
	scanf("%lld", &n);
	rep(i, 1, n) scanf("%lld", &a[i]);
	if(n == 2) {
		if(a[1] == a[2]) puts("YES");
		else puts("NO");
		return 0;
	}
	rop(i, 1, n) {
		scanf("%lld%lld", &x, &y);
		T.push(x, y);
		T.push(y, x);
		rd[x]++;
		rd[y]++; 
	}
	rep(i, 1, n) {
		if(rd[i] > 1) {
			T.dfs(i, 0);
			if(mn[i]) puts("NO");
			else puts("YES");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
    
    return 0;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
#define vi vector<ll>
#define vvi vector<vi>
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
vvi E(100010);
vi ans(300000);
int n;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m;cin>>n>>m;
  int lnum=1,rnum=2;
  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;
    E[a].pb(b);
    E[b].pb(a);
    if(i==0){lnum=a;rnum=b;}
  }
  bool flag=false;
  int leaf;
  int left=149999;
  int right=150002;

  ans[150000]=lnum;
  ans[150001]=rnum;
  bool used[100100]={};
  used[lnum]=true;used[rnum]=true;
  while(1){
    bool lfl=true;
    bool rfl=true;
    int lto;
    for(int i=0;i<E[lnum].size();i++){
      if(!used[E[lnum][i]]){
	lto=E[lnum][i];
	used[E[lnum][i]]=true;
	lfl=false;
	lnum=lto;
	break;
      }
    }
    if(!lfl){
      ans[left--]=lto;
      continue;
    }
    int rto;
    for(int i=0;i<E[rnum].size();i++){
      if(!used[E[rnum][i]]){
	rto=E[rnum][i];
	used[E[rnum][i]]=true;
	rfl=false;
	rnum=rto;
	break;
      }
    }
    if(!rfl){
      ans[right++]=rto;
      continue;
    }
    cout<<right-left-1<<endl;
    for(int i=0;i<300000;i++)
      if(ans[i]>0)
	cout<<ans[i]<<" ";
    cout<<endl;
    break;
  }
  return 0;
}


Measured memory_bytes: 8832
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;

#define MAX_AC 100000

typedef long long ll;
ll N, M;
ll A[MAX_AC + 1], B[MAX_AC + 1], C[MAX_AC + 1];
typedef pair<ll, ll> Pair;

int main(void)
{
  cin >> N >> M;
  std::priority_queue<Pair> queue;
  for (ll i = 0; i < N; ++i) {
    cin >> A[i];
    Pair p = Pair(A[i], 1);
    queue.push(p);
  }

  for (ll i = 0; i < M; ++i) {
    cin >> B[i] >> C[i];
    Pair p = Pair(C[i], B[i]);
    queue.push(p);
  }

  long long ans = 0;
  for (ll i = 0; i < N; ++i) {
    Pair p = queue.top();
    queue.pop();
    if (p.second > 1) {
      p.second--;
      queue.push(p);
    }
    ans += p.first;
  }

  printf("%lld\n", ans);

  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

//------------------------------------------------------

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

    int dist = 0;

    rep(i, n) {
        int x;
        cin >> x;
        dist += 2 * min(x - 0, k - x);
    }

    cout << dist << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<vector>
#include<string>
using namespace std;
const int inf=0x3f3f3f3f;
typedef long long ll;
int a[1005],b[1005];
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",a*b);
    return 0;
}


Measured memory_bytes: 3820
//AOJ0077

#include<iostream>
#include<string>
int main(){
	std::string s;
	while (std::cin >> s){
		std::string ans;
		for (int i = 0; i < s.size(); ++i){
			if (s[i] == '@'){
				std::string p(s[i + 1] - '0', s[i + 2]);
				ans.append(p);
				i += 2;
			}
			else{
				ans.push_back(s[i]);
			}
		}
		std::cout << ans << std::endl;
	}
}

Measured memory_bytes: 1196
#include <stdio.h>

int main(){
	int a,b;
	int c;
	int i;
	int cnt=0;
	scanf("%d%d%d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 596
s = input()
l = int(s[0:2])
r = int(s[2:4])
yymm = False
mmyy = False

if 0 < l and l < 13:
    mmyy = True
if 0 < r and r < 13:
    yymm = True

if mmyy and yymm:
    print("AMBIGUOUS")
elif mmyy:
    print("MMYY")
elif yymm:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using u32 = uint64_t;

int main()
{
	u32 n, m;
	
	std::cin >> n >> m;

	std::multiset<u32, std::greater<u32>> v;

	for(u32 i=0; i<n ;i++)
	{
		u32 x;
		std::cin >> x;

		v.insert(x);
	}

	while(m!=0)
	{
		bool mod = false;

		auto front = v.begin();

		if((*front) != 2)
		{
			u32 val = *front/2;
			v.erase(front);
			v.insert(val);
			mod = true;
			m--;
		}

		if(m==0) {
			break;
		}
		
		if(!mod)
		{
			break;
		}
	}
	
	while(m!=0)
	{
		bool mod = false;
		auto front = v.begin();

		if((*front) != 0)
		{
			u32 val = *front/2;
			v.erase(front);
			v.insert(val);
			mod = true;
			m--;
		}
		if(!mod)
		{
			break;
		}
	}

	u32 sum = 0;

	for(auto it = v.begin(); it != v.end(); it++)
	{
		sum+= *it;
	}

	std::cout << sum << "\n";
	
	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep (i, n) {
    cin >> a[i];
  }
  vector<int> p2{0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 263404, 526808, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824};
  vector<vector<int>> v(32);
  rep (i, n) {
    rep (j, 32) {
      if (p2[j] < a[i] && a[i] <= p2[j+1]) v[j].push_back(a[i]);
    }
  }
  rep (i, 32) {
    sort(v[i].rbegin(), v[i].rend());
  }
  int upper1 = 32;
  int upper2 = 0;
  for (int i = 31; i > 0; i--) {
    rep (j, v[i].size()) {
      v[i-1].push_back(v[i][j] / 2);
      m--;
      upper2 = j;
      if (m == 0) goto repeat_end;
    }
    upper1--;
    if (i != 1) sort(v[i-1].rbegin(), v[i-1].rend());
  }
  repeat_end:
  ll ans = 0;
  rep (i, upper1) {
    rep (j, v[i].size()) {
      if (!(i == upper1 - 1 && j <= upper2)) ans += v[i][j];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
  
using namespace std;
 
#define endl "\n"
#define JAM(x) cout<< #x <<" = "<<x<<"\n"
#define II() ( { int a ; read(a) ; a; } )
#define LL() ( { ll a ; read(a) ; a; } )
#define DD() ({double a; scanf("%lf", &a); a;})
 
 
//Fast Reader
template<class T>inline bool read(T &x){
    int c=getchar();int sgn=1;
    while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}
    for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; 
    x*=sgn; return ~c;
}
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef vector<PII> VPI;
 
const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);
 
long long int power(long long int a,long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
 
/*_______________________________________________*/


int main()
{
    int n,i,j,k;
    cin>>n;
    long int a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    long int ans=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(a[j]==a[i] || a[i]==a[k]||a[j]==a[k])
                continue;
                if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[k]+a[j]>a[i])
                ans++;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
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;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,k,s;
  cin >> n >> k >> s;
  vector<ll> v;
  rep(i,k) v.pb(s);
  if(s==1000000000) s--;
  else s++;
  REP(i,k,n) v.pb(s);
  PR(v,v.size());
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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

const ll INF=1e9+7;

int main()
{
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> b(n);
    set<ll> s;
    rep(i,n){
        cin >> a[i];
        s.insert(a[i]);
        b[a[i]-1]++;
    }
    sort(b.begin(),b.end());
    if(s.size()<=k){
        cout << 0 << endl;
        return 0;
    }
    ll times=s.size()-k;
    ll ans=0;
    ll i=0;
    while(times){
        if(b[i]==0){
            i++;
            continue;
        }
        ans+=b[i];
        i++;
        times--;
    }
    cout << ans << endl;
    return 0;
} 


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

using namespace std;


int main()
{
    int n;
    cin >> n;
    vector<int>p;
    for(int i = 0;i < n;i++)
    {
        int a;
        cin >> a;
        if(a & 1)continue;
        else p.push_back(a);
    }
    int flag = 0;
    for(int i= 0;i < p.size();i++)
    {
        if(p[i] % 3 == 0 || p[i] % 5 == 0)
        ;
        else flag = 1;
    }
    if(flag)cout <<"DENIED";
    else cout <<"APPROVED";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0){
      break;
    }
    int p,ice[10];
    for(int i=0;i<=9;i++){
      ice[i]=0;
    }
    for(int i=0;i<n;i++){
      cin>>p;
      ice[p]++;
    }
    for(int i=0;i<=9;i++){
      if(ice[i]==0){
	cout<<'-';
      }else{
	for(int j=0;j<ice[i];j++){
	  cout<<'*';
	}
      }
      cout<<endl;
    }
  }
  return(0);
}



Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const int mod = 1000000007;

int n, m;
vector<pair<int, int>> vec[310];
ll d[310][310][310];
ll ans;

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int l, r, x; cin >> l >> r >> x;
		vec[r].push_back(make_pair(l, x));
	}
	d[0][0][0] = 1;
	for (int i = 0; i <= n; i++)for (int j = 0; j <= n; j++)for (int k = 0; k <= n; k++) {
		int x = max({ i,j,k });
		int s = d[i][j][k];
		for (int l = 0; l < (int)vec[x].size(); l++) {
			int cnt = 0;
			if (vec[x][l].first <= i)cnt++;
			if (vec[x][l].first <= j)cnt++;
			if (vec[x][l].first <= k)cnt++;
			if (vec[x][l].second != cnt)s = 0;
		}
		d[x + 1][j][k] = (d[x + 1][j][k] + s) % mod;
		d[i][x + 1][k] = (d[i][x + 1][k] + s) % mod;
		d[i][j][x + 1] = (d[i][j][x + 1] + s) % mod;
		if (x == n)ans = (ans + s) % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 225668
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  int sum = 0;
  int sq_sum = 0;
  for (int i = 0; i < n; i++) {
    sum += d[i];
    sq_sum += d[i] * d[i];
  }
  cout << ((sum * sum) - sq_sum) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	double a,b,c,d,e,f;
	double x,y;
	double D;
	
	while ( (cin >> a) && (cin >> b) && (cin >> c) && (cin >> d) && (cin >> e) && (cin >> f) ) {
		D = a*e - b*d;
		x = (e*c - b*f) / D;  x+=0;
		y = (-d*c + a*f) / D; y+=0;

		cout << fixed << setprecision(3);
		cout << x << " " << y << endl;
	}
	
	return 0;
}

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

int main(){
  string s;
  cin>>s;
  int l=0;
  l=s.size();
  int sum=0;
  for(int i=0;i<l;i++){
    if(i%2 == 1){
      if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
        sum++;
      }
    }

    if(i%2 == 0){
      if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
        sum++;
      }
    }
  }

  if(sum==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -Wall -Werror #-}

import System.IO

main :: IO ()
main = do
  end <- isEOF
  if end
     then return ()
     else do
      input <- getLine
      let a:b:_ = map read $ words input :: [Int]
          g = show $ gcd a b
          l = show $ lcm a b
      putStrLn $ g ++ " " ++ l
      main

Measured memory_bytes: 4056
while 1:
    a, op, b = raw_input().split()
    a, b = map(int, [a, b])
    if op == '?':
        break
    elif op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a // b

Measured memory_bytes: 4212
//rohitaas_15
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> o_set;
#define ll  long long
#define int ll
#define um(a,b) unordered_map<a,b>
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define f(a,b) for(ll i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define show(x) cout<<x<<"\n"
#define printvector(v,n) f(0,n-1){cout<<v[i]<<" ";}
#define input(v,n) f(0,n-1){cin>>v[i];}
#define vr vector<ll>
#define check() cout<<"hi"<<"\n"
#define MOD 1000000007
//#define endl "\n"
#define len() length()
#define maxv(v) *max_element(all(v));
#define minv(v) *min_element(all(v));
#define sumv(v) accumulate(all(v),0)
#define test() ll t;cin>>t;while(t--)
ll search(vr arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
ll CmP(ll n, ll r, ll p=MOD){if (r==0)return 1;ll fac[n+1];fac[0] = 1;for (ll i=1 ; i<=n; i++)fac[i] = fac[i-1]*i%p; return (fac[n]* modInverse(fac[r], p) % p *modInverse(fac[n-r], p) % p) % p; }
/*ll constructSTUtil(vr v,ll start,ll end,int *st,ll index)
{
	if(start==end)
	{
		st[index]=v[start];
		return st[index];
	}
	ll mid=(start+end)/2;
	st[index]=constructSTUtil(v,start,mid,st,2*index)+constructSTUtil(v,mid+1,end,st,2*index+1);
	return st[index];
}
ll *constructST(vr v,ll n)
{
	ll po=(ll)(ceil(log2(n)));
	ll msize=2*power(2,po)+1;
	vr st[msize];
	constructSTUtil(v,0,n-1,st,1);
	return st;
}*/
ll ask1(ll y)
{
	cout<<1<<" "<<y<<endl;
	ll x;
	cin>>x;
	return x;
}
bool compare(pair<ll,ll> &a,pair<ll,ll> &b)
{
	return a.second<b.second;
}
signed main()
{
	/*
	#ifndef ONLINE_JUDGE
	 freopen("input.txt","r",stdin);
	 freopen("output.txt","w",stdout);
	 #endif
	 //*/
	 /*ll t;
	 cin>>t;
	 ll cccc=t;
	 while(t--)
	 {
	 */
	 	ll x;
	 	cin>>x;
	 	ll sum=100;
	 	ll t=0;
	 	while(sum<x)
        {
            sum+=sum/100;
            t++;
        }
        show(t);
	 //}
	/*cout<<"Case #"<<cccc-t<<": ";*/

}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
LL K;
int P[5000];
LL C[5000];

LL solve(int p){
 vector<LL> V;
 int pp=p;
 do{
  V.push_back(C[pp]);
  pp=P[pp];
 }while(pp!=p);
 for(int i=1; i<V.size(); i++) V[i]+=V[i-1];
 LL ans=V[0];
 rep(i,min(LL(V.size()),K)) ans=max(ans,V[i]);
 if(V.back()>0 && K>=V.size()){
  rep(i,V.size()){
   LL tmp = V[i];
   tmp += (K-i-1)/V.size()*V.back();
   ans = max(ans,tmp);
  }
 }
 return ans;
}

int main() {
 cin>>N>>K;
 rep(i,N){ scanf("%d",&P[i]); P[i]--; }
 rep(i,N){ scanf("%lld",&C[i]); }

 LL ans=-1000000000000;
 rep(i,N) ans = max(ans,solve(i));
 cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 3836
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    long long n,a,c=0;
    cin >> n >> a;
    vector<long long>x(n);
    for(long long i=0;i<n;i++){
        cin>>x[i];
    }
    sort(x.begin(),x.end());
    long long big=max(x[n-1],a);
    long long dp[50+10][50+10][2500+10];
    memset(dp,0,sizeof(dp));
    dp[0][0][0]=1;
    for(long long j=1;j<=n;j++){
        for(long long k=0;k<=n;k++){
            for(long long s=0;s<=n*big;s++){
                if(s<x[j-1])dp[j][k][s]+=dp[j-1][k][s];
                else if(k>=1&&s>=x[j-1])dp[j][k][s]+=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]];
                else dp[j][k][s]=0;
            }
        }
    }
    for(long long j=1;j<=n;j++){
        c+=dp[n][j][a*j];
    }
    cout<<c;
}

Measured memory_bytes: 70912